赫艾后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

136 lines
5.5 KiB

<?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.heai.modules.taskmanage.dao.TaskDetailDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.heai.modules.taskmanage.entity.TaskDetailEntity" id="taskListMap">
<result property="id" column="id"/>
<result property="department" column="department"/>
<result property="status" column="status"/>
<result property="createdDate" column="created_date"/>
<result property="createdBy" column="created_by"/>
<result property="updatedDate" column="updated_date"/>
<result property="updatedBy" column="updated_by"/>
</resultMap>
<select id="taskDetailList" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
select td.id
, tl.project
, tl.customer
, isnull(u2.username,tl.task_initiator) task_initiator
, tl.task_description
, td.department
, tl.required_completion_date
, td.status
, td.final_status
, tl.task_start_date
, tl.created_date
, tl.created_by
, tl.updated_date
, tl.updated_by
, tl.task_header
, u.username responsible_person
,( u.department + ' | ' + u.username) as dep_user_name
, td.task_id
, dbo.Get_chat_LastType(td.site,td.id,td.created_by) chatLastType
from task_detail td
left join task_list tl on td.task_id = tl.id AND td.site = tl.site
left join users u on td.site = u.site and u.userId = td.responsible_person
left join users u2 on td.site = u2.site and u2.userId = tl.task_initiator
LEFT JOIN report_mapping_ipaddress rmi on rmi.department = u.department
<where>
td.site = #{site}
and (tl.created_by=td.responsible_person OR dbo.Get_chat_LastType(td.site,td.id,td.created_by)!='有新回复')
<if test="ipAddress != null and ipAddress != ''">
and rmi.ipaddress like #{ipAddress}
</if>
<if test="taskInitiator != null and taskInitiator != ''">
and tl.created_by like #{taskInitiator}
</if>
<if test="department != null and department != ''">
and u.department like #{department}
</if>
<if test="customer != null and customer != ''">
and tl.customer like #{customer}
</if>
<if test="project != null and project != ''">
and tl.project like #{project}
</if>
<if test="status != null and status != ''">
and td.status = #{status}
</if>
<if test="finalStatus != null and finalStatus != ''">
and td.final_status = #{finalStatus}
</if>
<if test="responsiblePerson != null and responsiblePerson != ''">
and UPPER(td.responsible_person) like UPPER(#{responsiblePerson})
</if>
<if test="startDate !=null ">
and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
</if>
<if test="endDate !=null ">
and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
</if>
<if test="finishStartDate != null ">
and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
</if>
<if test="finishEndDate != null ">
and tl.required_completion_date <![CDATA[ <= ]]> #{finishEndDate}
</if>
</where>
</select>
<select id="taskDetailReportList" resultType="com.heai.modules.taskmanage.vo.TaskDetailVo">
select td.id
, tl.project
, tl.customer
, tl.task_initiator
, tl.task_description
, td.department
, tl.required_completion_date
, td.status
, tl.final_status
, tl.task_start_date
, tl.created_date
, tl.created_by
, tl.updated_date
, tl.updated_by
, tl.task_header
, u.username as responsible_person
, td.task_id
from task_detail td
left join task_list tl on td.task_id = tl.id AND td.site = tl.site
left join users u on td.site = u.site and u.userId = td.responsible_person
<where>
td.site = #{site}
<if test="department != null and department != ''">
and tl.department like #{department}
</if>
<if test="customer != null and customer != ''">
and tl.customer like #{customer}
</if>
<if test="status != null and status != ''">
and tl.status = #{status}
</if>
<if test="responsiblePerson != null and responsiblePerson != ''">
and td.responsible_person like #{responsiblePerson}
</if>
<if test="startDate !=null ">
and tl.task_start_date <![CDATA[ >= ]]> #{startDate}
</if>
<if test="endDate !=null ">
and tl.task_start_date <![CDATA[ <= ]]> #{endDate}
</if>
<if test="finishStartDate != null ">
and tl.required_completion_date <![CDATA[ >= ]]> #{finishStartDate}
</if>
<if test="finishEndDate != null ">
and tl.required_completion_date <![CDATA[ <= ]]>#{finishEndDate}
</if>
</where>
</select>
</mapper>