zcloud-gbs-eightwork/web-infrastructure/src/main/resources/mapper/EightworkInfoMapper.xml

113 lines
5.2 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.zcloud.eightwork.persistence.mapper.EightworkInfoMapper">
<select id="listPage" resultType="com.zcloud.eightwork.persistence.dataobject.EightworkInfoDO">
select t.*
from eightwork_info t
where t.delete_enum = 'FALSE'
and t.status != 0
<if test="params.eqWorkType != null and params.eqWorkType != ''">
and t.work_type = #{params.eqWorkType}
</if>
<if test="params.eqCheckNo != null and params.eqCheckNo != ''">
and t.check_no = #{params.eqCheckNo}
</if>
<if test="params.eqStatus != null">
and t.status = #{params.eqStatus}
</if>
<if test="params.eqWorkLevel != null and params.eqWorkLevel != ''">
and t.work_level = #{params.eqWorkLevel}
</if>
<if test="params.eqDepartmentId != null">
and t.department_id = #{params.eqDepartmentId}
</if>
<if test="params.eqXgfFlag != null">
and t.xgf_flag = #{params.eqXgfFlag}
</if>
<if test="params.eqInternalOperationFlag != null">
and t.internal_operation_flag = #{params.eqInternalOperationFlag}
</if>
<if test="params.eqProjectId != null and params.eqProjectId != ''">
and t.project_id = #{params.eqProjectId}
</if>
<if test="params.eqWorkDepartmentId != null">
and exists (select 1
from task_log log
where log.work_id = t.work_id
and log.act_user_department = #{params.eqWorkDepartmentId})
</if>
<if test="params.eqWorkUserId != null">
and exists (select 1
from task_log log
where log.work_id = t.work_id
and log.act_user = #{params.eqWorkUserId})
</if>
<if test="params.inDepartmentId != null and params.inDepartmentId.size() > 0">
and t.department_id in
<foreach collection="params.inDepartmentId" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.geCreateTime != null and params.geCreateTime != ''">
and t.create_time &gt;= #{params.geCreateTime}
</if>
<if test="params.leCreateTime != null and params.leCreateTime != ''">
and t.create_time &lt;= #{params.leCreateTime}
</if>
<if test="params.eqIsInnerWork != null and params.eqIsInnerWork != ''">
and t.info->>'$.isInnerWork' = #{params.eqIsInnerWork}
</if>
<if test="params.likeCreateName != null and params.likeCreateName != ''">
and t.create_name like concat('%', #{params.likeCreateName}, '%')
</if>
<if test="params.likeWorkContent != null and params.likeWorkContent != ''">
and t.info->>'$.workContent' like concat('%', #{params.likeCreateName}, '%')
</if>
<if test="params.eqBlindboardWorkType != null and params.eqBlindboardWorkType != ''">
and t.info->>'$.blindboardWorkType' = #{params.eqBlindboardWorkType}
</if>
<if test="params.geWorkStartTime != null and params.geWorkStartTime != ''">
and t.info->>'$.workStartTime' &gt;= #{params.geWorkStartTime}
</if>
<if test="params.leWorkStartTime != null and params.leWorkStartTime != ''">
and t.info->>'$.workStartTime' &lt;= #{params.leWorkStartTime}
</if>
<if test="params.likeLimitedSpaceNameAndCode != null and params.likeLimitedSpaceNameAndCode != ''">
and t.info->>'$.limitedSpaceNameAndCode' like concat('%', #{params.likeLimitedSpaceNameAndCode}, '%')
</if>
<if test="params.eqCurrentStepId != null">
and exists (select 1
from task_log log
where log.work_id = t.work_id
and log.status = 0
and log.step_id = #{params.eqCurrentStepId})
</if>
order by t.create_time desc
</select>
<select id="statisticsByWorkType" resultType="com.zcloud.eightwork.persistence.dataobject.dto.StatisticsByWorkTypeDTO">
select t.corpinfo_id,
sum(case t.status when 0 then 1 else 0 end) as draftCount,
sum(case t.status when 1 then 1 else 0 end) as doingCount,
sum(case t.status when 2 then 1 else 0 end) as rejectedCount,
sum(case t.status when 998 then 1 else 0 end) as forceTerminateCount,
sum(case t.status when 999 then 1 else 0 end) as doneCount
from eightwork_info t
where t.delete_enum = 'FALSE'
<if test="params.eqWorkType != null and params.eqWorkType != ''">
and t.work_type = #{params.eqWorkType}
</if>
<if test="params.inCorpInfoId != null and params.inCorpInfoId.size() > 0">
and t.corpinfo_id in
<foreach collection="params.inCorpInfoId" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by t.corpinfo_id
</select>
</mapper>