FlowMainExtendMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.idea.oa.flow2.mapper.FlowMainExtendMapper">
  4. <!-- 已办事项 -->
  5. <!-- &#45;&#45; apply_main.processname,-->
  6. <!-- &#45;&#45; apply_main.applytheme,-->
  7. <!-- &#45;&#45; apply_main.created_by,-->
  8. <!-- &#45;&#45; apply_main_log.id,-->
  9. <!-- &#45;&#45; apply_main_log.applymainid,-->
  10. <select id="listByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
  11. SELECT
  12. flow_main.*,
  13. frame_user.truename as applyUserName,
  14. sys_dept.dept_name as applyDeptName,
  15. case
  16. flow_main.flow_status
  17. when 1 then '审核中'
  18. when 2 then '退回发起人'
  19. when 3 then '已结束'
  20. when 4 then '已撤回'
  21. end as flowStatusString,
  22. case flow_main.flow_status when 1 then '' else (
  23. 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
  24. FROM
  25. flow_main_log
  26. LEFT JOIN flow_main ON flow_main_log.flow_main_id = flow_main.id
  27. LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
  28. LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
  29. LEFT JOIN flow_main_log flow_main_log2 on flow_main_log2.id=flow_main.last_main_log_id
  30. WHERE
  31. flow_main_log.STATUS =0
  32. <if test="entity.auditUser != null and entity.auditUser !=''">
  33. and flow_main_log.audit_user = #{entity.auditUser}
  34. </if>
  35. <if test="entity.groupId != null and entity.groupId !=''">
  36. and flow_main_log.group_id = #{entity.groupId}
  37. </if>
  38. <if test="entity.applyUserName != null and entity.applyUserName !=''">
  39. and frame_user.truename like concat('%',#{entity.applyUserName},'%')
  40. </if>
  41. <if test="entity.applyTheme != null and entity.applyTheme !=''">
  42. and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
  43. </if>
  44. <if test="entity.flowName != null and entity.flowName !=''">
  45. and flow_main.flow_name like concat('%',#{entity.flowName},'%')
  46. </if>
  47. <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
  48. and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
  49. or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
  50. or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
  51. </if>
  52. <if test="entity.auditResult != null and entity.auditResult !=''">
  53. AND flow_main_log.audit_result IN
  54. <foreach collection="entity.auditResult" index="index" item="item" open="(" separator="," close=")">
  55. #{item}
  56. </foreach>
  57. </if>
  58. order by flow_main_log.created_at desc
  59. </select>
  60. <select id="myApplylistByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
  61. SELECT
  62. flow_main.*,
  63. frame_user.truename as applyUserName,
  64. sys_dept.dept_name as applyDeptName,
  65. case
  66. flow_main.flow_status
  67. when 1 then '审核中'
  68. when 2 then '退回发起人'
  69. when 3 then '已结束'
  70. when 4 then '已撤回'
  71. end as flowStatusString,
  72. case flow_main.flow_status when 1 then '' else (
  73. 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
  74. FROM
  75. flow_main
  76. LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
  77. LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
  78. LEFT JOIN flow_main_log on flow_main_log.id=flow_main.last_main_log_id
  79. WHERE
  80. flow_main.STATUS =0
  81. <if test="entity.auditUser != null and entity.auditUser !=''">
  82. and flow_main.apply_user = #{entity.auditUser}
  83. </if>
  84. <if test="entity.groupId != null and entity.groupId !=''">
  85. and flow_main.group_id = #{entity.groupId}
  86. </if>
  87. <if test="entity.applyUserName != null and entity.applyUserName !=''">
  88. and frame_user.truename like concat('%',#{entity.applyUserName},'%')
  89. </if>
  90. <if test="entity.applyTheme != null and entity.applyTheme !=''">
  91. and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
  92. </if>
  93. <if test="entity.flowName != null and entity.flowName !=''">
  94. and flow_main.flow_name like concat('%',#{entity.flowName},'%')
  95. </if>
  96. <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
  97. and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
  98. or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
  99. or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
  100. </if>
  101. order by flow_main.created_at desc
  102. </select>
  103. <!-- * 抄送事项 ok-->
  104. <!-- * web端开始页面查询,不同类型, 流程名称,主题,发起人查询-->
  105. <select id="cclistByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
  106. SELECT flow_main.*,
  107. frame_user.truename as applyUserName,
  108. sys_dept.dept_name as applyDeptName,
  109. case
  110. flow_main.flow_status
  111. when 1 then '审核中'
  112. when 2 then '退回发起人'
  113. when 3 then '已结束'
  114. when 4 then '已撤回'
  115. end as flowStatusString,
  116. case flow_main.flow_status when 1 then '' else (
  117. 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
  118. FROM (select * from flow_main_cc
  119. <where>
  120. <if test="entity.auditUser != null and entity.auditUser !=''">
  121. and flow_main_cc.cc_user = #{entity.auditUser}
  122. </if>
  123. <if test="entity.isRead != null and entity.isRead != '' and entity.isRead =='1'.toString()">
  124. and flow_main_cc.is_read is null
  125. </if>
  126. <if test="entity.isRead != null and entity.isRead != '' and entity.isRead =='2'.toString()">
  127. and flow_main_cc.is_read = #{entity.isRead}
  128. </if>
  129. </where>
  130. group by flow_main_cc.cc_user, flow_main_cc.flow_main_id) as tt
  131. LEFT JOIN
  132. flow_main on flow_main.id = tt.flow_main_id
  133. LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
  134. LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
  135. LEFT JOIN flow_main_log on flow_main_log.id=flow_main.last_main_log_id
  136. WHERE flow_main.STATUS = 0
  137. <if test="entity.groupId != null and entity.groupId !=''">
  138. and flow_main.group_id = #{entity.groupId}
  139. </if>
  140. <if test="entity.applyUserName != null and entity.applyUserName !=''">
  141. and frame_user.truename like concat('%',#{entity.applyUserName},'%')
  142. </if>
  143. <if test="entity.applyTheme != null and entity.applyTheme !=''">
  144. and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
  145. </if>
  146. <if test="entity.flowName != null and entity.flowName !=''">
  147. and flow_main.flow_name like concat('%',#{entity.flowName},'%')
  148. </if>
  149. <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
  150. and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
  151. or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
  152. or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
  153. </if>
  154. order by flow_main.created_at desc
  155. </select>
  156. <select id="toDolistByInfo" parameterType="java.util.Map" resultType="com.idea.oa.flow2.model.in.FlowMainIn">
  157. SELECT
  158. flow_main.*,
  159. frame_user.truename as applyUserName,
  160. sys_dept.dept_name as applyDeptName,
  161. flow_main_push.push_user_key as pushUserKey,
  162. flow_main_push.id as flowMainPushId,
  163. case
  164. flow_main.flow_status
  165. when 1 then '审核中'
  166. when 2 then '退回发起人'
  167. when 3 then '已结束'
  168. when 4 then '已撤回'
  169. end as flowStatusString,
  170. case flow_main.flow_status when 1 then '' else (
  171. 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
  172. FROM
  173. flow_main_push
  174. LEFT JOIN flow_main ON flow_main_push.flow_main_id = flow_main.id
  175. LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
  176. LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
  177. LEFT JOIN flow_main_log on flow_main_log.id=flow_main.last_main_log_id
  178. WHERE
  179. flow_main_push.STATUS =0
  180. <if test="entity.auditUser != null and entity.auditUser !=''">
  181. and flow_main_push.push_user = #{entity.auditUser}
  182. </if>
  183. <if test="entity.groupId != null and entity.groupId !=''">
  184. and flow_main_push.group_id = #{entity.groupId}
  185. </if>
  186. <if test="entity.applyUserName != null and entity.applyUserName !=''">
  187. and frame_user.truename like concat('%',#{entity.applyUserName},'%')
  188. </if>
  189. <if test="entity.applyTheme != null and entity.applyTheme !=''">
  190. and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
  191. </if>
  192. <if test="entity.flowName != null and entity.flowName !=''">
  193. and flow_main.flow_name like concat('%',#{entity.flowName},'%')
  194. </if>
  195. <if test="dt.date_from_3 != null and dt.date_from_3 !=''">
  196. and (frame_user.truename like concat('%',#{dt.date_from_3},'%')
  197. or flow_main.apply_theme like concat('%',#{dt.date_from_3},'%')
  198. or flow_main.flow_name like concat('%',#{dt.date_from_3},'%'))
  199. </if>
  200. <if test="entity.auditResult != null and entity.auditResult !=''">
  201. AND flow_main_push.push_role IN
  202. <foreach collection="entity.auditResult" index="index" item="item" open="(" separator="," close=")">
  203. #{item}
  204. </foreach>
  205. </if>
  206. order by flow_main_push.created_at
  207. </select>
  208. <select id="numtoDolistByInfo" parameterType="java.util.Map" resultType="java.lang.Integer">
  209. SELECT
  210. count(1) as num
  211. FROM
  212. flow_main_push
  213. LEFT JOIN flow_main ON flow_main_push.flow_main_id = flow_main.id
  214. LEFT JOIN frame_user ON frame_user.id = flow_main.apply_user
  215. LEFT JOIN sys_dept ON sys_dept.id = frame_user.department
  216. WHERE
  217. flow_main_push.STATUS =0
  218. <if test="entity.auditUser != null and entity.auditUser !=''">
  219. and flow_main_push.push_user = #{entity.auditUser}
  220. </if>
  221. <if test="entity.groupId != null and entity.groupId !=''">
  222. and flow_main_push.group_id = #{entity.groupId}
  223. </if>
  224. <if test="entity.applyUserName != null and entity.applyUserName !=''">
  225. and frame_user.truename like concat('%',#{entity.applyUserName},'%')
  226. </if>
  227. <if test="entity.applyTheme != null and entity.applyTheme !=''">
  228. and flow_main.apply_theme like concat('%',#{entity.applyTheme},'%')
  229. </if>
  230. <if test="entity.flowName != null and entity.flowName !=''">
  231. and flow_main.flow_name like concat('%',#{entity.flowName},'%')
  232. </if>
  233. <if test="entity.auditResult != null and entity.auditResult !=''">
  234. AND flow_main_push.push_role IN
  235. <foreach collection="entity.auditResult" index="index" item="item" open="(" separator="," close=")">
  236. #{item}
  237. </foreach>
  238. </if>
  239. </select>
  240. </mapper>