Files
zentao/src/main/resources/mapper/ZtTaskMapper.xml
2025-05-13 14:09:46 +08:00

655 lines
19 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.ZtTaskMapper">
<resultMap id="BaseResultMap" type="com.sa.zentao.entity.ZtTask">
<result column="id" property="id"/>
<result column="project" property="project"/>
<result column="parent" property="parent"/>
<result column="execution" property="execution"/>
<result column="module" property="module"/>
<result column="design" property="design"/>
<result column="story" property="story"/>
<result column="storyVersion" property="storyversion"/>
<result column="designVersion" property="designversion"/>
<result column="fromBug" property="frombug"/>
<result column="feedback" property="feedback"/>
<result column="fromIssue" property="fromissue"/>
<result column="name" property="name"/>
<result column="type" property="type"/>
<result column="mode" property="mode"/>
<result column="pri" property="pri"/>
<result column="estimate" property="estimate"/>
<result column="consumed" property="consumed"/>
<result column="left" property="left"/>
<result column="deadline" property="deadline"/>
<result column="status" property="status"/>
<result column="subStatus" property="substatus"/>
<result column="color" property="color"/>
<result column="mailto" property="mailto"/>
<result column="desc" property="desc"/>
<result column="version" property="version"/>
<result column="openedBy" property="openedby"/>
<result column="openedDate" property="openeddate"/>
<result column="assignedTo" property="assignedto"/>
<result column="assignedDate" property="assigneddate"/>
<result column="estStarted" property="eststarted"/>
<result column="realStarted" property="realstarted"/>
<result column="finishedBy" property="finishedby"/>
<result column="finishedDate" property="finisheddate"/>
<result column="finishedList" property="finishedlist"/>
<result column="canceledBy" property="canceledby"/>
<result column="canceledDate" property="canceleddate"/>
<result column="closedBy" property="closedby"/>
<result column="closedDate" property="closeddate"/>
<result column="planDuration" property="planduration"/>
<result column="realDuration" property="realduration"/>
<result column="closedReason" property="closedreason"/>
<result column="lastEditedBy" property="lasteditedby"/>
<result column="lastEditedDate" property="lastediteddate"/>
<result column="activatedDate" property="activateddate"/>
<result column="order" property="order"/>
<result column="repo" property="repo"/>
<result column="mr" property="mr"/>
<result column="entry" property="entry"/>
<result column="lines" property="lines"/>
<result column="v1" property="v1"/>
<result column="v2" property="v2"/>
<result column="deleted" property="deleted"/>
<result column="vision" property="vision"/>
</resultMap>
<select id="taskPageList" resultType="com.sa.zentao.dao.ZtTaskDTO">
select
s.reviewing_user,
s.deadline_time,
s.product,
s.finished_flag,
s.approval_result,
s.use_time,
s.apply_date,
s.approval_remark,
s.files,
s.vision,
s.deleted,
s.v2,
s.v1,
s.`lines`,
s.entry,
s.mr,
s.`order`,
s.repo,
s.activatedDate,
s.lastEditedDate,
s.lastEditedBy,
s.closedReason,
s.realDuration,
s.planDuration,
s.closedDate,
s.closedBy,
s.canceledDate,
s.canceledBy,
s.finishedList,
s.finishedDate,
s.finishedBy,
s.realStarted,
s.estStarted,
s.assignedDate,
s.assignedTo,
s.openedDate,
s.openedBy,
s.version,
s.mailto,
s.color,
s.subStatus,
s.`status`,
s.deadline,
s.`left`,
s.consumed,
s.estimate,
s.pri,
s.`mode`,
s.type,
s.`name`,
s.fromIssue,
s.feedback,
s.fromBug,
s.designVersion,
s.storyVersion,
s.story,
s.design,
s.module,
s.execution,
s.parent,
s.project,
s.id,
pt.name productName from zt_task s left join zt_project project on s.project = project.id
left join zt_product pt on s.product = pt.id
where 1= 1
<if test="qo.delayFlag != null and qo.delayFlag != 0">
<if test="qo.delayFlag==1">
and (date(deadline ) <![CDATA[<]]> date(finishedDate ) or( finishedDate is null and date(deadline) <![CDATA[<]]> date(now())))
</if>
<if test="qo.delayFlag==2">
and (date(deadline ) <![CDATA[>=]]> date(finishedDate ) or( finishedDate is null and date(deadline) <![CDATA[>=]]> date(now())))
</if>
</if>
<if test="qo.id != null and qo.id != 0">
and s.id = #{qo.id}
</if>
<if test="qo.name != null and qo.name != ''">
and s.name like concat('%', #{qo.name}, '%')
</if>
<if test="qo.type != null and qo.type != ''">
and s.`type` = #{qo.type}
</if>
<if test="qo.pri != null and qo.pri != ''">
and s.pri = #{qo.pri}
</if>
<if test="qo.assignedTo != null and qo.assignedTo != ''">
and s.assignedTo = #{qo.assignedTo}
</if>
<if test="qo.status != null and qo.status != ''">
and s.status = #{qo.status}
</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.projectList != null and qo.projectList.size() > 0">
and s.project in
<foreach collection="qo.projectList" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="qo.productIds != null and qo.productIds.size() > 0">
and pt.id in
<foreach collection="qo.productIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</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>
<if test="qo.searchVal == 'ALL' ">
</if>
<if test="qo.searchVal == 'WGB' ">
and s.status != 'closed'
</if>
<if test="qo.searchVal == 'DPS' ">
and s.status = 'reviewing'
</if>
<if test="qo.searchVal == 'ZPGW' ">
and s.assignedTo= #{qo.userName}
</if>
<if test="qo.searchVal == 'YWCY' ">
and s.mailto like concat('%', #{qo.userName}, '%')
</if>
<if test="qo.searchVal == 'YWCJ' ">
and s.openedBy like concat('%', #{qo.userName}, '%')
</if>
<if test="qo.searchVal == 'YWZP' ">
and s.lastEditedBy = #{qo.userName}
</if>
<if test="qo.searchVal == 'RJXQBG' ">
and s.status != 'active'
</if>
<if test="qo.execution != '' and qo.execution != null ">
and s.execution =#{qo.execution}
</if>
<if test="qo.projectIds != null and qo.projectIds.size() > 0">
and s.execution in
<foreach collection="qo.projectIds" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="qo.searchCode != null and qo.searchCode != '' ">
-- //任务名称
<if test="qo.searchCode=='rwmc' and qo.searchValue != null and qo.searchValue != '' ">
and s.name like concat('%', #{qo.searchValue}, '%')
</if>
-- 项目id
<if test="qo.searchCode=='bh' 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.status =#{qo.searchValue}
</if>
-- 指派给
<if test="qo.searchCode=='zpg' and qo.searchValue != null and qo.searchValue != '' ">
and s.assignedTo =#{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 test="qo.searchCode=='ysqx' and qo.searchValue != null and qo.searchValue != '' ">
and s.canceledBy = #{qo.searchValue}
</if>
<if test="qo.searchCode=='zhxg' and qo.searchValue != null and qo.searchValue != '' ">
and s.lastEditedBy = #{qo.searchValue}
</if>
<if test="qo.searchCode=='cjrq' and qo.searchValue != null and qo.searchValue != '' ">
and s.openedDate ${qo.searchValue}
</if>
<if test="qo.searchCode=='jzrq' and qo.searchValue != null and qo.searchValue != '' ">
and s.deadline ${qo.searchValue}
</if>
<if test="qo.searchCode=='yjks' and qo.searchValue != null and qo.searchValue != '' ">
and s.estStarted ${qo.searchValue}
</if>
<if test="qo.searchCode=='sjks' and qo.searchValue != null and qo.searchValue != '' ">
and s.realstarted ${qo.searchValue}
</if>
<if test="qo.searchCode=='sjwc' and qo.searchValue != null and qo.searchValue != '' ">
and s.lastEditedBy ${qo.searchValue}
</if>
<!-- <if test="qo.searchCode=='sjwc' and qo.searchValue != null and qo.searchValue != '' ">-->
<!-- and s.end_date <![CDATA[>=]]> #{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>
<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}
<choose>
<when test="qo.orderName == 'deadline' ">
,id ${qo.orderSort}
</when>
</choose>
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</when>
<otherwise>
order by s.id desc
</otherwise>
</choose>
</select>
<select id="taskListPrd" resultType="com.sa.zentao.dao.ZtTaskDTO">
select * from zt_task where execution = #{id}
</select>
<select id="itApprovalByUserName" resultType="com.sa.zentao.dao.ItApproval">
SELECT * from os_system.it_approval a WHERE 1=1
and a.name = #{name}
and
(
(date(apply_time_start) BETWEEN date( #{startDate}) and date(#{endDate}))
or(
date(apply_time_end) BETWEEN date(#{startDate}) and date(#{endDate}))
)
</select>
<select id="taskListByIds" resultType="com.sa.zentao.entity.ZtTask">
select
s.reviewing_user,
s.deadline_time,
s.product,
s.finished_flag,
s.approval_result,
s.use_time,
s.apply_date,
s.approval_remark,
s.files,
s.vision,
s.deleted,
s.v2,
s.v1,
s.`lines`,
s.entry,
s.mr,
s.`order`,
s.repo,
s.activatedDate,
s.lastEditedDate,
s.lastEditedBy,
s.closedReason,
s.realDuration,
s.planDuration,
s.closedDate,
s.closedBy,
s.canceledDate,
s.canceledBy,
s.finishedList,
s.finishedDate,
s.finishedBy,
s.realStarted,
s.estStarted,
s.assignedDate,
s.assignedTo,
s.openedDate,
s.openedBy,
s.version,
s.mailto,
s.color,
s.subStatus,
s.`status`,
s.deadline,
s.`left`,
s.consumed,
s.estimate,
s.pri,
s.`mode`,
s.type,
s.`name`,
s.fromIssue,
s.feedback,
s.fromBug,
s.designVersion,
s.storyVersion,
s.story,
s.design,
s.module,
s.execution,
s.parent,
s.project,
s.id
from zt_task s
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>
</select>
<select id="taskListByStoryIds" resultType="com.sa.zentao.entity.ZtTask">
select
s.reviewing_user,
s.deadline_time,
s.product,
s.finished_flag,
s.approval_result,
s.use_time,
s.apply_date,
s.approval_remark,
s.files,
s.vision,
s.deleted,
s.v2,
s.v1,
s.`lines`,
s.entry,
s.mr,
s.`order`,
s.repo,
s.activatedDate,
s.lastEditedDate,
s.lastEditedBy,
s.closedReason,
s.realDuration,
s.planDuration,
s.closedDate,
s.closedBy,
s.canceledDate,
s.canceledBy,
s.finishedList,
s.finishedDate,
s.finishedBy,
s.realStarted,
s.estStarted,
s.assignedDate,
s.assignedTo,
s.openedDate,
s.openedBy,
s.version,
s.mailto,
s.color,
s.subStatus,
s.`status`,
s.deadline,
s.`left`,
s.consumed,
s.estimate,
s.pri,
s.`mode`,
s.type,
s.`name`,
s.fromIssue,
s.feedback,
s.fromBug,
s.designVersion,
s.storyVersion,
s.story,
s.design,
s.module,
s.execution,
s.parent,
s.project,
s.id
from zt_task s
where 1= 1
and s.story in
<foreach collection="ids" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="multipleDepartProjectTeam" resultType="com.sa.zentao.entity.ZtTask">
SELECT s.reviewing_user,
s.deadline_time,
s.product,
s.finished_flag,
s.approval_result,
s.use_time,
s.apply_date,
s.approval_remark,
s.files,
s.vision,
s.deleted,
s.v2,
s.v1,
s.`lines`,
s.entry,
s.mr,
s.`order`,
s.repo,
s.activatedDate,
s.lastEditedDate,
s.lastEditedBy,
s.closedReason,
s.realDuration,
s.planDuration,
s.closedDate,
s.closedBy,
s.canceledDate,
s.canceledBy,
s.finishedList,
s.finishedDate,
s.finishedBy,
s.realStarted,
s.estStarted,
s.assignedDate,
s.assignedTo,
s.openedDate,
s.openedBy,
s.version,
s.mailto,
s.color,
s.subStatus,
s.`status`,
s.deadline,
s.`left`,
s.consumed,
s.estimate,
s.pri,
s.`mode`,
s.type,
s.`name`,
s.fromIssue,
s.feedback,
s.fromBug,
s.designVersion,
s.storyVersion,
s.story,
s.design,
s.module,
s.execution,
s.parent,
s.project,
s.id
from (
SELECT p.program,t.* from zt_task t,zt_product p WHERE t.product = p.id
and ((t.openedDate >= #{start} and t.openedDate <![CDATA[<=]]> #{end}) or (t.finishedDate <![CDATA[>=]]> #{start} and t.finishedDate <![CDATA[<=]]> #{end} ) )
and t.`status` = 'done'
GROUP BY p.program ,t.assignedTo
ORDER BY assignedTo desc
) s GROUP BY s.assignedTo
HAVING count(1) >1
</select>
<select id="taskListByPIdsAndDate" resultType="com.sa.zentao.entity.ZtTask">
SELECT s.reviewing_user,
s.deadline_time,
s.product,
s.finished_flag,
s.approval_result,
s.use_time,
s.apply_date,
s.approval_remark,
s.files,
s.vision,
s.deleted,
s.v2,
s.v1,
s.`lines`,
s.entry,
s.mr,
s.`order`,
s.repo,
s.activatedDate,
s.lastEditedDate,
s.lastEditedBy,
s.closedReason,
s.realDuration,
s.planDuration,
s.closedDate,
s.closedBy,
s.canceledDate,
s.canceledBy,
s.finishedList,
s.finishedDate,
s.finishedBy,
s.realStarted,
s.estStarted,
s.assignedDate,
s.assignedTo,
s.openedDate,
s.openedBy,
s.version,
s.mailto,
s.color,
s.subStatus,
s.`status`,
s.deadline,
s.`left`,
s.consumed,
s.estimate,
s.pri,
s.`mode`,
s.type,
s.`name`,
s.fromIssue,
s.feedback,
s.fromBug,
s.designVersion,
s.storyVersion,
s.story,
s.design,
s.module,
s.execution,
s.parent,
s.project,
s.id
from zt_task s where 1=1
and s.product in
<foreach collection="pids" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
and (
(openedDate >= #{start} and s.openedDate <![CDATA[<=]]> #{end})
or
( finishedDate >= #{start} and s.finishedDate <![CDATA[<=]]> #{end})
)
</select>
</mapper>