Files
zentao/src/main/resources/mapper/ZtStoryMapper.xml
2025-12-25 13:46:26 +08:00

1306 lines
41 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sa.zentao.mapper.ZtStoryMapper">
<resultMap id="BaseResultMap" type="com.sa.zentao.entity.ZtStory">
<result column="id" property="id" />
<result column="vision" property="vision" />
<result column="parent" property="parent" />
<result column="product" property="product" />
<result column="branch" property="branch" />
<result column="module" property="module" />
<result column="plan" property="plan" />
<result column="source" property="source" />
<result column="sourceNote" property="sourcenote" />
<result column="fromBug" property="frombug" />
<result column="feedback" property="feedback" />
<result column="title" property="title" />
<result column="keywords" property="keywords" />
<result column="type" property="type" />
<result column="category" property="category" />
<result column="pri" property="pri" />
<result column="estimate" property="estimate" />
<result column="status" property="status" />
<result column="subStatus" property="substatus" />
<result column="color" property="color" />
<result column="stage" property="stage" />
<result column="stagedBy" property="stagedby" />
<result column="mailto" property="mailto" />
<result column="lib" property="lib" />
<result column="fromStory" property="fromstory" />
<result column="fromVersion" property="fromversion" />
<result column="openedBy" property="openedby" />
<result column="openedDate" property="openeddate" />
<result column="assignedTo" property="assignedto" />
<result column="assignedDate" property="assigneddate" />
<result column="approvedDate" property="approveddate" />
<result column="lastEditedBy" property="lasteditedby" />
<result column="lastEditedDate" property="lastediteddate" />
<result column="changedBy" property="changedby" />
<result column="changedDate" property="changeddate" />
<result column="reviewedBy" property="reviewedby" />
<result column="reviewedDate" property="revieweddate" />
<result column="releasedDate" property="releaseddate" />
<result column="closedBy" property="closedby" />
<result column="closedDate" property="closeddate" />
<result column="closedReason" property="closedreason" />
<result column="activatedDate" property="activateddate" />
<result column="toBug" property="tobug" />
<result column="childStories" property="childstories" />
<result column="linkStories" property="linkstories" />
<result column="linkRequirements" property="linkrequirements" />
<result column="twins" property="twins" />
<result column="duplicateStory" property="duplicatestory" />
<result column="version" property="version" />
<result column="storyChanged" property="storychanged" />
<result column="feedbackBy" property="feedbackby" />
<result column="notifyEmail" property="notifyemail" />
<result column="BSA" property="bsa" />
<result column="duration" property="duration" />
<result column="demand" property="demand" />
<result column="submitedBy" property="submitedby" />
<result column="roadmap" property="roadmap" />
<result column="URChanged" property="urchanged" />
<result column="deleted" property="deleted" />
</resultMap>
<select id="pageList" resultType="com.sa.zentao.dao.ZtStoryDTO">
select
s.id,
s.vision,
s.parent,
s.product,
s.project,
s.branch,
s.module,
s.plan,
s.source,
s.sourceNote,
s.fromBug,
s.feedback,
s.title,
s.keywords,
s.type,
s.category,
s.pri,
s.estimate,
s.`status`,
s.subStatus,
s.color,
s.stage,
s.stagedBy,
s.mailto,
s.lib,
s.fromStory,
s.fromVersion,
s.openedBy,
s.openedDate,
s.assignedTo,
s.assignedDate,
s.approvedDate,
s.lastEditedBy,
s.lastEditedDate,
s.changedBy,
s.changedDate,
s.reviewedBy,
s.reviewedDate,
s.releasedDate,
s.closedBy,
s.closedDate,
s.closedReason,
s.activatedDate,
s.toBug,
s.childStories,
s.linkStories,
s.linkRequirements,
s.twins,
s.duplicateStory,
s.version,
s.storyChanged,
s.feedbackBy,
s.notifyEmail,
s.BSA,
s.duration,
s.demand,
s.submitedBy,
s.roadmap,
s.URChanged,
s.deleted,
s.plan_start_date,
s.plan_end_date,
s.start_date,
s.end_date,
s.ys_flag,
s.user_story,
s.ys_remark,
s.ys_user,
s.task_count,
s.ys_date,
su.title userStoryName,
su.id userStoryId,
ps.title parentName,
su.openedDate userStoryCreateTime,
su.openedBy userStoryCreateUser,
s.devel_plan_end_time,
s.test_plan_end_time
from zt_story s
left join zt_story_user su on s.user_story = su.id
left join zt_storyreview v on s.id = v.story and s.version = v.version
left join zt_story ps on s.parent = ps.id
where 1=1
and s.product = #{qo.productId}
<if test="qo.searchVal == 'ALL' ">
</if>
<if test="qo.searchVal == 'WGB' ">
and s.status != 'closed'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ZGW' ">
and s.assignedTo= #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WCJ' ">
and s.openedBy= #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWPS' ">
and v.reviewer = #{qo.userName}
and s.status ='reviewing'
and v.result = ''
</if>
<if test="qo.searchVal != null and qo.searchVal == 'JH' ">
and s.status = 'active'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YGB' ">
and s.status = 'closed'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'DGB' ">
and s.stage = 'verified' and s.ys_flag =1
</if>
<if test="qo.searchVal != null and qo.searchVal == 'BGZ' ">
and s.status = '11'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WZP' ">
and s.status = '11'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WYS' ">
and s.ys_user = #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WPS' ">
and s.reviewedBy like concat('%', #{qo.userName}, '%')
</if>
<if test="qo.searchVal != null and qo.searchVal == 'PSZ' ">
and s.status = 'reviewing'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'DYS' ">
and ( s.stage = 'released'
and s.ys_flag =0)
or (s.stage = 'verified' and s.ys_flag =2)
</if>
<if test="qo.name != null and qo.name != '' ">
and s.title like concat('%', #{qo.name}, '%')
</if>
<if test="qo.title != null and qo.title != '' ">
and s.title like concat('%', #{qo.title}, '%')
</if>
<if test="qo.testUser != null and qo.testUser != '' ">
and s.test_user like concat('%', #{qo.testUser}, '%')
</if>
<if test="qo.productUser != null and qo.productUser != '' ">
and s.product_user like concat('%', #{qo.productUser}, '%')
</if>
<if test="qo.id != null ">
and s.id = #{qo.id}
</if>
<if test="qo.title != null and qo.title != '' ">
and s.title like concat('%', #{qo.title}, '%')
</if>
<if test="qo.module != null and qo.module != '' ">
and s.module = #{qo.module}
</if>
<if test="qo.assignedTo != null and qo.assignedTo != '' ">
and s.assignedTo = #{qo.assignedTo}
</if>
<if test="qo.pri != null and qo.pri != '' ">
and s.pri = #{qo.pri}
</if>
<if test="qo.status != null and qo.status != '' ">
and s.status = #{qo.status}
</if>
<if test="qo.stage != null and qo.stage != '' ">
and s.stage = #{qo.stage}
</if>
<if test="qo.openedby != null and qo.openedby != '' ">
and s.openedBy = #{qo.openedby}
</if>
<if test="qo.startDate !=null">
and s.openedDate <![CDATA[>=]]> #{qo.startDate}
</if>
<if test="qo.endDate !=null">
and s.openedDate <![CDATA[<=]]> #{qo.endDate}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWGB' ">
and s.status ='closed'
and closedBy =#{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWGB' ">
and s.status ='closed'
and closedBy =#{qo.userName}
</if>
group by s.id
<choose>
<when test="qo.orderName != '' and qo.orderName != null ">
<choose>
<when test="qo.orderSort != '' and qo.orderSort != null ">
order by s.${qo.orderName} ${qo.orderSort}
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
-- order by id desc
</select>
<select id="projectStoryPageList" resultType="com.sa.zentao.dao.ZtStoryDTO">
select s.id,
s.vision,
s.parent,
s.product,
s.project,
s.branch,
s.module,
s.plan,
s.source,
s.sourceNote,
s.fromBug,
s.feedback,
s.title,
s.keywords,
s.type,
s.category,
s.pri,
s.estimate,
s.`status`,
s.subStatus,
s.color,
s.stage,
s.stagedBy,
s.mailto,
s.lib,
s.fromStory,
s.fromVersion,
s.openedBy,
s.openedDate,
s.assignedTo,
s.assignedDate,
s.approvedDate,
s.lastEditedBy,
s.lastEditedDate,
s.changedBy,
s.changedDate,
s.reviewedBy,
s.reviewedDate,
s.releasedDate,
s.closedBy,
s.closedDate,
s.closedReason,
s.activatedDate,
s.toBug,
s.childStories,
s.linkStories,
s.linkRequirements,
s.twins,
s.duplicateStory,
s.version,
s.storyChanged,
s.feedbackBy,
s.notifyEmail,
s.BSA,
s.duration,
s.demand,
s.submitedBy,
s.roadmap,
s.URChanged,
s.deleted,
s.plan_start_date,
s.plan_end_date,
s.start_date,
s.end_date,
s.ys_flag,
s.user_story,
s.ys_remark,
s.ys_user,
s.task_count,
s.ys_date,
s.devel_plan_end_time,
s.test_plan_end_time,
pt.name productName
from zt_story s
left join zt_storyreview v on s.id = v.story and s.version = v.version
left join zt_projectstory pstory on s.id = pstory.story and pstory.`type` = 'project'
left join zt_project pj on pstory.project = pj.id
left join zt_product pt on s.product = pt.id
left join zt_projectstory ps on s.id = ps.story
WHERE 1=1
<!-- <if test="qo.startDate !=null">-->
<!-- and s.openedDate <![CDATA[>=]]> #{qo.startDate}-->
<!-- </if>-->
<!-- <if test="qo.endDate !=null">-->
<!-- and s.openedDate <![CDATA[<=]]> #{qo.endDate}-->
<!-- </if>-->
<if test="qo.testUser != null and qo.testUser != '' ">
and s.test_user like concat('%', #{qo.testUser}, '%')
</if>
<if test="qo.productUser != null and qo.productUser != '' ">
and s.product_user like concat('%', #{qo.productUser}, '%')
</if>
<if test="qo.pri != null and qo.pri != '' ">
and s.pri = #{qo.pri}
</if>
<if test="qo.status != null and qo.status != '' ">
and s.status = #{qo.status}
</if>
<if test="qo.title != null and qo.title != '' ">
and s.title like concat('%', #{qo.title}, '%')
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WYS' ">
and s.ys_user = #{qo.userName}
</if>
<if test="qo.stage != null and qo.stage != '' ">
and s.stage = #{qo.stage}
</if>
<if test="qo.openedby != null and qo.openedby != '' ">
and s.openedBy = #{qo.openedby}
</if>
<if test="qo.startDate !=null">
and s.openedDate <![CDATA[>=]]> #{qo.startDate}
</if>
<if test="qo.endDate !=null">
and s.openedDate <![CDATA[<=]]> #{qo.endDate}
</if>
<if test="qo.assignedTo != null and qo.assignedTo != '' ">
and s.assignedTo = #{qo.assignedTo}
</if>
<if test="qo.id != null ">
and s.id = #{qo.id}
</if>
<if test="qo.name != null and qo.name != '' ">
and s.title like concat('%', #{qo.name}, '%')
</if>
<if test="qo.productName != null and qo.productName != '' ">
and pt.name like concat('%', #{qo.productName}, '%')
</if>
<if test="qo.project != null ">
and ps.project =#{qo.project}
and ps.type= 'project'
</if>
<if test="qo.execution != null ">
and ps.project =#{qo.execution}
and ps.type= 'execution'
</if>
<if test="qo.moduleId != null ">
and s.module =#{qo.moduleId}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ALL' ">
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WGB' ">
and s.status !='closed'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ZGW' ">
and s.assignedTo = #{qo.userName}
</if>
<if test="qo.kfz == 1 ">
<if test="qo.userName != null and qo.userName != '' ">
and
(s.assignedTo = #{qo.userName}
or s.openedBy = #{qo.userName}
)
</if>
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WCJ' ">
and s.openedBy = #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWPS' ">
and v.reviewer = #{qo.userName}
and s.status ='reviewing'
and v.result = ''
</if>
<if test="qo.searchVal == 'JH' ">
and s.status = 'active'
</if>
<if test="qo.searchVal == 'YGB' ">
and s.status = 'closed'
</if>
<if test="qo.searchVal == 'DGB' ">
and s.stage = 'verified' and s.ys_flag =1
</if>
<if test="qo.searchVal == 'BGZ' ">
and s.status = '11'
</if>
<if test="qo.searchVal == 'WZP' ">
and s.status = '11'
</if>
<if test="qo.searchVal == 'WPS' ">
and s.reviewedBy like concat('%', #{qo.userName}, '%')
</if>
<if test="qo.searchVal == 'PSZ' ">
and s.status = 'reviewing'
</if>
<if test="qo.searchVal == 'DYS' ">
and ( s.stage = 'released'
and s.ys_flag =0)
or (s.stage = 'verified' and s.ys_flag =2)
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWGB' ">
and s.status ='closed'
and s.closedBy =#{qo.userName}
</if>
<if test="qo.searchCode != null and qo.searchCode != '' ">
-- //项目名称
<if test="qo.searchCode=='xmmc' and qo.searchValue != null and qo.searchValue != '' ">
and pj.name like concat('%', #{qo.searchValue}, '%')
</if>
-- 项目id
<if test="qo.searchCode=='xmid' and qo.searchValue != null and qo.searchValue != '' ">
and pj.id =#{qo.searchValue}
</if>
-- //需求名称
<if test="qo.searchCode=='xqmc' and qo.searchValue != null and qo.searchValue != '' ">
and s.title like concat('%', #{qo.searchValue}, '%')
</if>
-- 需求id
<if test="qo.searchCode=='xqid' and qo.searchValue != null and qo.searchValue != '' ">
and s.id =#{qo.searchValue}
</if>
-- 状态
<if test="qo.searchCode=='zt' and qo.searchValue != null and qo.searchValue != '' ">
and s.stage =#{qo.searchValue}
</if>
-- 项目描述
<if test="qo.searchCode=='xmms' and qo.searchValue != null and qo.searchValue != '' ">
and sp.`spec` =#{qo.searchValue}
</if>
-- 负责人
<if test="qo.searchCode=='fzr' and qo.searchValue != null and qo.searchValue != '' ">
and s.assignedTo =#{qo.searchValue}
</if>
<if test="qo.searchCode=='jhwc' and qo.searchValue != null and qo.searchValue != '' ">
and s.plan_end_date ${qo.searchValue}
</if>
<if test="qo.searchCode=='sjks' and qo.searchValue != null and qo.searchValue != '' ">
and s.start_date ${qo.searchValue}
</if>
<if test="qo.searchCode=='sjwc' and qo.searchValue != null and qo.searchValue != '' ">
and s.end_date ${qo.searchValue}
</if>
<if test="qo.searchCode=='yscj' and qo.searchValue != null and qo.searchValue != '' ">
and s.openedBy = #{qo.searchValue}
</if>
<if test="qo.searchCode=='ysgb' and qo.searchValue != null and qo.searchValue != '' ">
and s.closedBy = #{qo.searchValue}
</if>
</if>
<if test="qo.objIds != null and qo.objIds.size() > 0">
and s.id in
<foreach collection="qo.objIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
group by s.id
<choose>
<when test="qo.orderName != '' and qo.orderName != null ">
<choose>
<when test="qo.orderSort != '' and qo.orderSort != null ">
order by s.${qo.orderName} ${qo.orderSort}
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</select>
<select id="getPrdById" resultType="com.sa.zentao.entity.ZtStory">
SELECT * from zt_story WHERE id = #{id}
</select>
<select id="allStoryPageList" resultType="com.sa.zentao.dao.ZtStoryDTO">
select s.id,
s.vision,
s.parent,
s.product,
s.project,
s.branch,
s.module,
s.plan,
s.source,
s.sourceNote,
s.fromBug,
s.feedback,
s.title,
s.keywords,
s.type,
s.category,
s.pri,
s.estimate,
s.`status`,
s.subStatus,
s.color,
s.stage,
s.stagedBy,
s.mailto,
s.lib,
s.fromStory,
s.fromVersion,
s.openedBy,
s.openedDate,
s.assignedTo,
s.assignedDate,
s.approvedDate,
s.lastEditedBy,
s.lastEditedDate,
s.changedBy,
s.changedDate,
s.reviewedBy,
s.reviewedDate,
s.releasedDate,
s.closedBy,
s.closedDate,
s.closedReason,
s.activatedDate,
s.toBug,
s.childStories,
s.linkStories,
s.linkRequirements,
s.twins,
s.duplicateStory,
s.version,
s.storyChanged,
s.feedbackBy,
s.notifyEmail,
s.BSA,
s.duration,
s.demand,
s.submitedBy,
s.roadmap,
s.URChanged,
s.deleted,
s.plan_start_date,
s.plan_end_date,
s.start_date,
s.end_date,
s.ys_flag,
s.user_story,
s.ys_remark,
s.ys_user,
s.task_count,
s.ys_date,
from zt_story s
left join zt_storyreview v on s.id = v.story and s.version = v.version
WHERE 1=1
<if test="qo.pri != null and qo.pri != '' ">
and s.pri = #{qo.pri}
</if>
<if test="qo.status != null and qo.status != '' ">
and s.status = #{qo.status}
</if>
<if test="qo.stage != null and qo.stage != '' ">
and s.stage = #{qo.stage}
</if>
<if test="qo.openedby != null and qo.openedby != '' ">
and s.openedBy = #{qo.openedby}
</if>
<if test="qo.startDate !=null">
and s.openedDate <![CDATA[>=]]> #{qo.startDate}
</if>
<if test="qo.endDate !=null">
and s.openedDate <![CDATA[<=]]> #{qo.endDate}
</if>
<if test="qo.name != null and qo.name != '' ">
and s.title like concat('%', #{qo.name}, '%')
</if>
<if test="qo.id != null ">
and s.id = #{qo.id}
</if>
<if test="qo.title != null and qo.title != '' ">
and s.title like concat('%', #{qo.title}, '%')
</if>
<if test="qo.assignedTo != null and qo.assignedTo != '' ">
and s.assignedTo = #{qo.assignedTo}
</if>
<if test="qo.project != null ">
and ps.project =#{qo.project}
</if>
<if test="qo.execution != null ">
and ps.execution =#{qo.execution}
</if>
<if test="qo.module != null ">
and s.module =#{qo.module}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ALL' ">
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WGB' ">
and s.status !='closed'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ZGW' ">
and s.assignedTo = #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'INDEX' ">
<if test="qo.userName != null and qo.userName != '' ">
and s.assignedTo = #{qo.userName}
or s.openedBy = #{qo.userName}
</if>
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WCJ' ">
and s.openedBy = #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWPS' ">
and v.reviewer = #{qo.userName}
and s.status ='reviewing'
and v.result = ''
</if>
<if test="qo.searchVal == 'JH' ">
and s.status = 'active'
</if>
<if test="qo.searchVal == 'YGB' ">
and s.status = 'closed'
</if>
<if test="qo.searchVal == 'DGB' ">
and s.stage = 'verified'
and s.ys_flag =1
</if>
<if test="qo.searchVal == 'BGZ' ">
and s.status = '11'
</if>
<if test="qo.searchVal == 'WZP' ">
and s.status = '11'
</if>
<if test="qo.searchVal == 'WPS' ">
and s.reviewedBy like concat('%', #{qo.userName}, '%')
</if>
<if test="qo.searchVal == 'PSZ' ">
and s.status = 'reviewing'
</if>
<if test="qo.searchVal == 'DYS' ">
and ( s.stage = 'released'
and s.ys_flag =0)
or (s.stage = 'verified' and s.ys_flag =2)
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWGB' ">
and s.status ='closed'
and closedBy =#{qo.userName}
</if>
group by s.id
<choose>
<when test="qo.orderName != '' and qo.orderName != null ">
<choose>
<when test="qo.orderSort != '' and qo.orderSort != null ">
order by s.${qo.orderName} ${qo.orderSort}
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</select>
<select id="myStoryPageList" resultType="com.sa.zentao.dao.ZtStoryDTO">
select s.id,
s.vision,
s.parent,
s.product,
s.project,
s.branch,
s.module,
s.plan,
s.source,
s.sourceNote,
s.fromBug,
s.feedback,
s.title,
s.keywords,
s.type,
s.category,
s.pri,
s.estimate,
s.`status`,
s.subStatus,
s.color,
s.stage,
s.stagedBy,
s.mailto,
s.lib,
s.fromStory,
s.fromVersion,
s.openedBy,
s.openedDate,
s.assignedTo,
s.assignedDate,
s.approvedDate,
s.lastEditedBy,
s.lastEditedDate,
s.changedBy,
s.changedDate,
s.reviewedBy,
s.reviewedDate,
s.releasedDate,
s.closedBy,
s.closedDate,
s.closedReason,
s.activatedDate,
s.toBug,
s.childStories,
s.linkStories,
s.linkRequirements,
s.twins,
s.duplicateStory,
s.version,
s.storyChanged,
s.feedbackBy,
s.notifyEmail,
s.BSA,
s.duration,
s.demand,
s.submitedBy,
s.roadmap,
s.URChanged,
s.deleted,
s.plan_start_date,
s.plan_end_date,
s.start_date,
s.end_date,
s.ys_flag,
s.user_story,
s.ys_user,
s.task_count,
s.devel_plan_end_time,
s.test_plan_end_time,
s.ys_date
,pt.name productName
from zt_story s
left join zt_product pt on s.product = pt.id
left join zt_storyreview v on s.id = v.story and s.version = v.version
WHERE 1=1
<if test="qo.testUser != null and qo.testUser != '' ">
and s.test_user like concat('%', #{qo.testUser}, '%')
</if>
<if test="qo.productUser != null and qo.productUser != '' ">
and s.product_user like concat('%', #{qo.productUser}, '%')
</if>
<if test="qo.pri != null and qo.pri != '' ">
and s.pri = #{qo.pri}
</if>
<if test="qo.status != null and qo.status != '' ">
and s.status = #{qo.status}
</if>
<if test="qo.stage != null and qo.stage != '' ">
and s.stage = #{qo.stage}
</if>
<if test="qo.openedby != null and qo.openedby != '' ">
and s.openedBy = #{qo.openedby}
</if>
<if test="qo.assignedTo != null and qo.assignedTo != '' ">
and s.assignedTo = #{qo.assignedTo}
</if>
<if test="qo.name != null and qo.name != '' ">
and s.title like concat('%', #{qo.name}, '%')
</if>
<if test="qo.startDate !=null">
and s.openedDate <![CDATA[>=]]> #{qo.startDate}
</if>
<if test="qo.endDate !=null">
and s.openedDate <![CDATA[<=]]> #{qo.endDate}
</if>
<if test="qo.id != null ">
and s.id = #{qo.id}
</if>
<if test="qo.title != null and qo.title != '' ">
and s.title like concat('%', #{qo.title}, '%')
</if>
<if test="qo.productIds != null and qo.productIds.size() > 0">
and s.product in
<foreach collection="qo.productIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="qo.startDate !=null">
and s.openedDate <![CDATA[>=]]> #{qo.startDate}
</if>
<if test="qo.endDate !=null">
and s.openedDate <![CDATA[<=]]> #{qo.endDate}
</if>
<if test="qo.productName != null and qo.productName != '' ">
and pt.name like concat('%', #{qo.productName}, '%')
</if>
<if test="qo.project != null ">
and ps.project =#{qo.project}
</if>
<if test="qo.execution != null ">
and ps.execution =#{qo.execution}
</if>
<if test="qo.module != null ">
and s.module =#{qo.module}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ALL' ">
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WGB' ">
and s.status !='closed'
</if>
<if test="qo.searchVal != null and qo.searchVal == 'ZGW' ">
and s.assignedTo = #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'INDEX' ">
<if test="qo.userName != null and qo.userName != '' ">
and ( s.assignedTo = #{qo.userName}
or s.openedBy = #{qo.userName}
)
</if>
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WCJ' ">
and s.openedBy = #{qo.userName}
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWPS' ">
and v.reviewer = #{qo.userName}
and s.status ='reviewing'
and v.result = ''
</if>
<if test="qo.searchVal != null and qo.searchVal == 'WYS' ">
and s.ys_user = #{qo.userName}
</if>
<if test="qo.searchVal == 'JH' ">
and s.status = 'active'
</if>
<if test="qo.searchVal == 'YGB' ">
and s.status = 'closed'
</if>
<if test="qo.searchVal == 'DGB' ">
and s.stage = 'verified' and s.ys_flag =1
</if>
<if test="qo.searchVal == 'BGZ' ">
and s.status = '11'
</if>
<if test="qo.searchVal == 'WZP' ">
and s.status = '11'
</if>
<if test="qo.searchVal == 'WPS' ">
and s.reviewedBy like concat('%', #{qo.userName}, '%')
</if>
<if test="qo.searchVal == 'PSZ' ">
and s.status = 'reviewing'
</if>
<if test="qo.searchVal == 'DYS' ">
and ( s.stage = 'released'
and s.ys_flag =0)
or (s.stage = 'verified' and s.ys_flag =2)
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWGB' ">
and s.status ='closed'
and closedBy =#{qo.userName}
</if>
<if test="qo.objIds != null and qo.objIds.size() > 0">
and s.id in
<foreach collection="qo.objIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
group by s.id
<choose>
<when test="qo.orderName != '' and qo.orderName != null ">
<choose>
<when test="qo.orderSort != '' and qo.orderSort != null ">
order by s.${qo.orderName} ${qo.orderSort}
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</select>
<select id="storyPageListByIds" resultType="com.sa.zentao.dao.ZtStoryDTO">
select s.id,
s.vision,
s.parent,
s.product,
s.project,
s.branch,
s.module,
s.plan,
s.source,
s.sourceNote,
s.fromBug,
s.feedback,
s.title,
s.keywords,
s.type,
s.category,
s.pri,
s.estimate,
s.`status`,
s.subStatus,
s.color,
s.stage,
s.stagedBy,
s.mailto,
s.lib,
s.fromStory,
s.fromVersion,
s.openedBy,
s.openedDate,
s.assignedTo,
s.assignedDate,
s.approvedDate,
s.lastEditedBy,
s.lastEditedDate,
s.changedBy,
s.changedDate,
s.reviewedBy,
s.reviewedDate,
s.releasedDate,
s.closedBy,
s.closedDate,
s.closedReason,
s.activatedDate,
s.toBug,
s.childStories,
s.linkStories,
s.linkRequirements,
s.twins,
s.duplicateStory,
s.version,
s.storyChanged,
s.feedbackBy,
s.notifyEmail,
s.BSA,
s.duration,
s.demand,
s.submitedBy,
s.roadmap,
s.URChanged,
s.deleted,
s.plan_start_date,
s.plan_end_date,
s.start_date,
s.end_date,
s.ys_flag,
s.user_story,
s.ys_user,
s.task_count,
s.ys_date
from zt_story s
left join zt_storyreview v on s.id = v.story and s.version = v.version
WHERE 1=1
<if test="ids != null and ids.size() > 0">
and s.id in
<foreach collection="ids" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
order by s.id desc
</select>
<select id="getStoryListByDatePidsProject" resultType="com.sa.zentao.entity.ZtStory">
select s.id,
s.vision,
s.parent,
s.product,
s.project,
s.branch,
s.module,
s.plan,
s.source,
s.sourceNote,
s.fromBug,
s.feedback,
s.title,
s.keywords,
s.type,
s.category,
s.pri,
s.estimate,
s.`status`,
s.subStatus,
s.color,
s.stage,
s.stagedBy,
s.mailto,
s.lib,
s.fromStory,
s.fromVersion,
s.openedBy,
s.openedDate,
s.assignedTo,
s.assignedDate,
s.approvedDate,
s.lastEditedBy,
s.lastEditedDate,
s.changedBy,
s.changedDate,
s.reviewedBy,
s.reviewedDate,
s.releasedDate,
s.closedBy,
s.closedDate,
s.closedReason,
s.activatedDate,
s.toBug,
s.childStories,
s.linkStories,
s.linkRequirements,
s.twins,
s.duplicateStory,
s.version,
s.storyChanged,
s.feedbackBy,
s.notifyEmail,
s.BSA,
s.duration,
s.demand,
s.submitedBy,
s.roadmap,
s.URChanged,
s.deleted,
s.plan_start_date,
s.plan_end_date,
s.start_date,
s.end_date,
s.ys_flag,
s.user_story,
s.ys_user,
s.task_count,
s.ys_date
from zt_story s, zt_projectstory ps WHERE s.id = ps.story
<if test="ids != null and ids.size() > 0">
and s.product in
<foreach collection="ids" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
and ps.project = #{project}
<if test="start !=null">
and s.end_date <![CDATA[>=]]> #{start}
</if>
<if test="end !=null">
and s.end_date <![CDATA[<=]]> #{end}
</if>
</select>
<select id="searchBug" resultType="com.sa.zentao.dao.SearchDTO">
SELECT id,title name, steps spec,5 type,openedDate from zt_bug WHERE 1=1 and (title like concat('%', #{keyword}, '%') or steps like concat('%', #{keyword}, '%') ) order by id desc
</select>
<select id="searchTask" resultType="com.sa.zentao.dao.SearchDTO">
SELECT id,name name, `desc` spec,3 type,openedDate from zt_task WHERE 1=1 and (name like concat('%', #{keyword}, '%') or `desc` like concat('%', #{keyword}, '%') ) order by id desc
</select>
<select id="searchStory" resultType="com.sa.zentao.dao.SearchDTO">
SELECT id,st.title name, spc.spec spec,spc.verify verify,2 type,openedDate from zt_story st,zt_storyspec spc WHERE 1=1 and st.id=spc.story and (spc.spec like concat('%', #{keyword}, '%') or spc.verify like concat('%', #{keyword}, '%') ) order by id desc
</select>
<select id="searchFeedback" resultType="com.sa.zentao.dao.SearchDTO">
SELECT id,remark name, spec spec,4 type,opened_date from zt_story_feedback WHERE 1=1 and (remark like concat('%', #{keyword}, '%') or spec like concat('%', #{keyword}, '%') ) order by id desc
</select>
<select id="searchUserStory" resultType="com.sa.zentao.dao.SearchDTO">
SELECT id,st.title name, spc.spec spec,spc.verify verify,1 type,openedDate from zt_story_user st,zt_story_userspec spc WHERE 1=1 and st.id=spc.story and (spc.spec like concat('%', #{keyword}, '%') or spc.verify like concat('%', #{keyword}, '%') ) order by id desc
</select>
<select id="searchAll" resultType="com.sa.zentao.dao.SearchDTO">
(SELECT id,st.title name, spc.spec spec,spc.verify verify,2 type,openedDate from zt_story st left join zt_storyspec spc on st.id=spc.story
WHERE 1=1 and (spc.spec like concat('%', #{keyword}, '%') or spc.verify like concat('%', #{keyword}, '%') or st.title like concat('%', #{keyword}, '%') )
and st.product in
<foreach collection="pIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
order by id desc )
UNION
(SELECT id,title name, steps spec,'' verify,5 type,openedDate from zt_bug
WHERE 1=1 and (title like concat('%', #{keyword}, '%') or steps like concat('%', #{keyword}, '%') )
and product in
<foreach collection="pIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
order by id desc )
UNION
(SELECT id,remark name, spec spec,'' verify,4 type,opened_date from zt_story_feedback
WHERE 1=1 and (remark like concat('%', #{keyword}, '%') or spec like concat('%', #{keyword}, '%') )
and product in
<foreach collection="pIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
order by id desc )
UNION
(SELECT id,name name, `desc` spec,'' verify,3 type,openedDate from zt_task
WHERE 1=1 and (name like concat('%', #{keyword}, '%') or `desc` like concat('%', #{keyword}, '%') )
and product in
<foreach collection="pIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
order by id desc )
UNION
(SELECT id,st.title name, spc.spec spec,spc.verify verify,1 type,openedDate from zt_story_user st left join zt_story_userspec spc on st.id=spc.story
WHERE 1=1
and product in
<foreach collection="pIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
and (spc.spec like concat('%', #{keyword}, '%') or spc.verify like concat('%', #{keyword}, '%') or st.title like concat('%', #{keyword}, '%') ) order by id desc )
</select>
</mapper>