123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?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.idea.oa.flow2.mapper.FlowMainExtendMapper">
- <!-- 已办事项 -->
- <!-- -- apply_main.processname,-->
- <!-- -- apply_main.applytheme,-->
- <!-- -- apply_main.created_by,-->
- <!-- -- apply_main_log.id,-->
- <!-- -- apply_main_log.applymainid,-->
- <select id="listByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
- SELECT
- flow_main.*,
- frame_user.truename as applyUserName,
- sys_dept.dept_name as applyDeptName,
- case
- flow_main.flow_status
- when 1 then '审核中'
- when 2 then '退回发起人'
- when 3 then '已结束'
- when 4 then '已撤回'
- end as flowStatusString,
- case flow_main.flow_status when 1 then '' else (
- CASE flow_main_log2.audit_result WHEN '1' THEN '同意' WHEN '2' THEN '不同意驳回到申请人' WHEN '3' THEN '不同意驳回到上一个审核人' WHEN '4' THEN '委托别人进行审核' WHEN '5' THEN '不同意且结束流程' END) end AS auditResultString
- FROM
- flow_main_log
- LEFT JOIN flow_main ON flow_main_log.flow_main_id = flow_main.id
- LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
- LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
- LEFT JOIN flow_main_log flow_main_log2 on flow_main_log2.id=flow_main.last_main_log_id
- WHERE
- flow_main_log.STATUS =0
- <if test="entity.auditUser != null and entity.auditUser !=''">
- and flow_main_log.audit_user = #{entity.auditUser}
- </if>
- <if test="entity.groupId != null and entity.groupId !=''">
- and flow_main_log.group_id = #{entity.groupId}
- </if>
- <if test="entity.applyUserName != null and entity.applyUserName !=''">
- and frame_user.truename like concat('%',#{entity.applyUserName},'%')
- </if>
- <if test="entity.applyTheme != null and entity.applyTheme !=''">
- and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
- </if>
- <if test="entity.flowName != null and entity.flowName !=''">
- and flow_main.flow_name like concat('%',#{entity.flowName},'%')
- </if>
- <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
- and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
- or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
- or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
- </if>
- <if test="entity.auditResult != null and entity.auditResult !=''">
- AND flow_main_log.audit_result IN
- <foreach collection="entity.auditResult" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- order by flow_main_log.created_at desc
- </select>
- <select id="myApplylistByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
- SELECT
- flow_main.*,
- frame_user.truename as applyUserName,
- sys_dept.dept_name as applyDeptName,
- case
- flow_main.flow_status
- when 1 then '审核中'
- when 2 then '退回发起人'
- when 3 then '已结束'
- when 4 then '已撤回'
- end as flowStatusString,
- case flow_main.flow_status when 1 then '' else (
- CASE flow_main_log.audit_result WHEN '1' THEN '同意' WHEN '2' THEN '不同意驳回到申请人' WHEN '3' THEN '不同意驳回到上一个审核人' WHEN '4' THEN '委托别人进行审核' WHEN '5' THEN '不同意且结束流程' END) end AS auditResultString
- FROM
- flow_main
- LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
- LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
- LEFT JOIN flow_main_log on flow_main_log.id=flow_main.last_main_log_id
- WHERE
- flow_main.STATUS =0
- <if test="entity.auditUser != null and entity.auditUser !=''">
- and flow_main.apply_user = #{entity.auditUser}
- </if>
- <if test="entity.groupId != null and entity.groupId !=''">
- and flow_main.group_id = #{entity.groupId}
- </if>
- <if test="entity.applyUserName != null and entity.applyUserName !=''">
- and frame_user.truename like concat('%',#{entity.applyUserName},'%')
- </if>
- <if test="entity.applyTheme != null and entity.applyTheme !=''">
- and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
- </if>
- <if test="entity.flowName != null and entity.flowName !=''">
- and flow_main.flow_name like concat('%',#{entity.flowName},'%')
- </if>
- <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
- and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
- or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
- or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
- </if>
- order by flow_main.created_at desc
- </select>
- <!-- * 抄送事项 ok-->
- <!-- * web端开始页面查询,不同类型, 流程名称,主题,发起人查询-->
- <select id="cclistByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
- SELECT flow_main.*,
- frame_user.truename as applyUserName,
- sys_dept.dept_name as applyDeptName,
- case
- flow_main.flow_status
- when 1 then '审核中'
- when 2 then '退回发起人'
- when 3 then '已结束'
- when 4 then '已撤回'
- end as flowStatusString,
- case flow_main.flow_status when 1 then '' else (
- CASE flow_main_log.audit_result WHEN '1' THEN '同意' WHEN '2' THEN '不同意驳回到申请人' WHEN '3' THEN '不同意驳回到上一个审核人' WHEN '4' THEN '委托别人进行审核' WHEN '5' THEN '不同意且结束流程' END) end AS auditResultString
- FROM (select * from flow_main_cc
- <where>
- <if test="entity.auditUser != null and entity.auditUser !=''">
- and flow_main_cc.cc_user = #{entity.auditUser}
- </if>
- <if test="entity.isRead != null and entity.isRead != '' and entity.isRead =='1'.toString()">
- and flow_main_cc.is_read is null
- </if>
- <if test="entity.isRead != null and entity.isRead != '' and entity.isRead =='2'.toString()">
- and flow_main_cc.is_read = #{entity.isRead}
- </if>
- </where>
- group by flow_main_cc.cc_user, flow_main_cc.flow_main_id) as tt
- LEFT JOIN
- flow_main on flow_main.id = tt.flow_main_id
- LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
- LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
- LEFT JOIN flow_main_log on flow_main_log.id=flow_main.last_main_log_id
- WHERE flow_main.STATUS = 0
- <if test="entity.groupId != null and entity.groupId !=''">
- and flow_main.group_id = #{entity.groupId}
- </if>
- <if test="entity.applyUserName != null and entity.applyUserName !=''">
- and frame_user.truename like concat('%',#{entity.applyUserName},'%')
- </if>
- <if test="entity.applyTheme != null and entity.applyTheme !=''">
- and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
- </if>
- <if test="entity.flowName != null and entity.flowName !=''">
- and flow_main.flow_name like concat('%',#{entity.flowName},'%')
- </if>
- <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
- and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
- or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
- or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
- </if>
- order by flow_main.created_at desc
- </select>
- <select id="toDolistByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
- SELECT
- flow_main.*,
- frame_user.truename as applyUserName,
- sys_dept.dept_name as applyDeptName,
- flow_main_push.push_user_key as pushUserKey,
- flow_main_push.id as flowMainPushId,
- case
- flow_main.flow_status
- when 1 then '审核中'
- when 2 then '退回发起人'
- when 3 then '已结束'
- when 4 then '已撤回'
- end as flowStatusString,
- case flow_main.flow_status when 1 then '' else (
- CASE flow_main_log.audit_result WHEN '1' THEN '同意' WHEN '2' THEN '不同意驳回到申请人' WHEN '3' THEN '不同意驳回到上一个审核人' WHEN '4' THEN '委托别人进行审核' WHEN '5' THEN '不同意且结束流程' END) end AS auditResultString
- FROM
- flow_main_push
- LEFT JOIN flow_main ON flow_main_push.flow_main_id = flow_main.id
- LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
- LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
- LEFT JOIN flow_main_log on flow_main_log.id=flow_main.last_main_log_id
- WHERE
- flow_main_push.STATUS =0
- <if test="entity.auditUser != null and entity.auditUser !=''">
- and flow_main_push.push_user = #{entity.auditUser}
- </if>
- <if test="entity.groupId != null and entity.groupId !=''">
- and flow_main_push.group_id = #{entity.groupId}
- </if>
- <if test="entity.applyUserName != null and entity.applyUserName !=''">
- and frame_user.truename like concat('%',#{entity.applyUserName},'%')
- </if>
- <if test="entity.applyTheme != null and entity.applyTheme !=''">
- and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
- </if>
- <if test="entity.flowName != null and entity.flowName !=''">
- and flow_main.flow_name like concat('%',#{entity.flowName},'%')
- </if>
- <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
- and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
- or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
- or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
- </if>
- <if test="entity.auditResult != null and entity.auditResult !=''">
- AND flow_main_push.push_role IN
- <foreach collection="entity.auditResult" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- order by flow_main_push.created_at
- </select>
- <select id="numtoDolistByInfo" parameterType="java.util.Map" resultType="java.lang.Integer">
- SELECT
- count(1) as num
- FROM
- flow_main_push
- LEFT JOIN flow_main ON flow_main_push.flow_main_id = flow_main.id
- LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
- LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
- WHERE
- flow_main_push.STATUS =0
- <if test="entity.auditUser != null and entity.auditUser !=''">
- and flow_main_push.push_user = #{entity.auditUser}
- </if>
- <if test="entity.groupId != null and entity.groupId !=''">
- and flow_main_push.group_id = #{entity.groupId}
- </if>
- <if test="entity.applyUserName != null and entity.applyUserName !=''">
- and frame_user.truename like concat('%',#{entity.applyUserName},'%')
- </if>
- <if test="entity.applyTheme != null and entity.applyTheme !=''">
- and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
- </if>
- <if test="entity.flowName != null and entity.flowName !=''">
- and flow_main.flow_name like concat('%',#{entity.flowName},'%')
- </if>
- <if test="entity.auditResult != null and entity.auditResult !=''">
- AND flow_main_push.push_role IN
- <foreach collection="entity.auditResult" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- </mapper>
|