PreparationMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.platform.dao.mapper.preparation.PreparationMapper">
  4. <sql id="Base_Column_List">
  5. preparation.id,
  6. preparation.position_id,
  7. preparation.user_id,
  8. preparation.depart_id,
  9. preparation.apply_time,
  10. preparation.content,
  11. preparation.status,
  12. preparation.remark,
  13. preparation.created_time,
  14. preparation.update_time,
  15. preparation.created_user_id,
  16. preparation.created_user_name,
  17. preparation.update_user_id,
  18. preparation.update_user_name,
  19. preparation.repair_start_time,
  20. preparation.repair_end_time,
  21. preparation.repair_minutes,
  22. preparation.repair_user_id,
  23. preparation.repair_content,
  24. preparation.limit_hours,
  25. preparation.fee,
  26. preparation.fee_file
  27. </sql>
  28. <sql id="Ref_Column_List">
  29. preparation.position_id,
  30. preparation.user_id,
  31. preparation.depart_id,
  32. preparation.apply_time,
  33. preparation.content,
  34. preparation.status,
  35. preparation.remark,
  36. preparation.repair_start_time,
  37. preparation.repair_end_time,
  38. preparation.repair_minutes,
  39. preparation.repair_user_id,
  40. preparation.repair_content,
  41. preparation.limit_hours,
  42. preparation.fee,
  43. preparation.fee_file
  44. </sql>
  45. <sql id="List_Condition">
  46. <if test="id != null and id != ''">
  47. and preparation.id = #{id}
  48. </if>
  49. <if test="positionId != null and positionId != ''">
  50. and preparation.position_id = #{positionId}
  51. </if>
  52. <if test="applyVerifyUserId != null and applyVerifyUserId != ''">
  53. and (preparation.user_id = #{applyVerifyUserId} or preparation.apply_verify_user_id = #{applyVerifyUserId})
  54. </if>
  55. <if test="userId != null and userId != ''">
  56. and preparation.user_id = #{userId}
  57. </if>
  58. <if test="departId != null and departId != ''">
  59. and preparation.depart_id = #{departId}
  60. </if>
  61. <if test="applyTimeStart != null">
  62. and preparation.apply_time <![CDATA[>=]]> #{applyTimeStart}
  63. </if>
  64. <if test="applyTimeEnd != null">
  65. and preparation.apply_time <![CDATA[<=]]> #{applyTimeEnd}
  66. </if>
  67. <if test="applyTime != null">
  68. and preparation.apply_time = #{applyTime}
  69. </if>
  70. <if test="content != null and content != ''">
  71. and preparation.content = #{content}
  72. </if>
  73. <if test="status != null">
  74. and preparation.status = #{status}
  75. </if>
  76. <if test="remark != null and remark != ''">
  77. and preparation.remark = #{remark}
  78. </if>
  79. <if test="createdTimeStart != null">
  80. and preparation.created_time <![CDATA[>=]]> #{createdTimeStart}
  81. </if>
  82. <if test="createdTimeEnd != null">
  83. and preparation.created_time <![CDATA[<=]]> #{createdTimeEnd}
  84. </if>
  85. <if test="createdTime != null">
  86. and preparation.created_time = #{createdTime}
  87. </if>
  88. <if test="updateTimeStart != null">
  89. and preparation.update_time <![CDATA[>=]]> #{updateTimeStart}
  90. </if>
  91. <if test="updateTimeEnd != null">
  92. and preparation.update_time <![CDATA[<=]]> #{updateTimeEnd}
  93. </if>
  94. <if test="updateTime != null">
  95. and preparation.update_time = #{updateTime}
  96. </if>
  97. <if test="createdUserId != null and createdUserId != ''">
  98. and preparation.created_user_id = #{createdUserId}
  99. </if>
  100. <if test="createdUserName != null and createdUserName != ''">
  101. and preparation.created_user_name = #{createdUserName}
  102. </if>
  103. <if test="updateUserId != null and updateUserId != ''">
  104. and preparation.update_user_id = #{updateUserId}
  105. </if>
  106. <if test="updateUserName != null and updateUserName != ''">
  107. and preparation.update_user_name = #{updateUserName}
  108. </if>
  109. <if test="repairStartTimeStart != null">
  110. and preparation.repair_start_time <![CDATA[>=]]> #{repairStartTimeStart}
  111. </if>
  112. <if test="repairStartTimeEnd != null">
  113. and preparation.repair_start_time <![CDATA[<=]]> #{repairStartTimeEnd}
  114. </if>
  115. <if test="repairStartTime != null">
  116. and preparation.repair_start_time = #{repairStartTime}
  117. </if>
  118. <if test="repairEndTimeStart != null">
  119. and preparation.repair_end_time <![CDATA[>=]]> #{repairEndTimeStart}
  120. </if>
  121. <if test="repairEndTimeEnd != null">
  122. and preparation.repair_end_time <![CDATA[<=]]> #{repairEndTimeEnd}
  123. </if>
  124. <if test="repairEndTime != null">
  125. and preparation.repair_end_time = #{repairEndTime}
  126. </if>
  127. <if test="repairMinutes != null">
  128. and preparation.repair_minutes = #{repairMinutes}
  129. </if>
  130. <if test="repairUserId != null and repairUserId != ''">
  131. and (preparation.user_id = #{repairUserId} or preparation.repair_user_id = #{repairUserId})
  132. </if>
  133. <if test="repairContent != null and repairContent != ''">
  134. and preparation.repair_content = #{repairContent}
  135. </if>
  136. <if test="limitHoursStart != null">
  137. and preparation.limit_hours <![CDATA[>=]]> #{limitHoursStart}
  138. </if>
  139. <if test="limitHoursEnd != null">
  140. and preparation.limit_hours <![CDATA[<=]]> #{limitHoursEnd}
  141. </if>
  142. <if test="limitHours != null">
  143. and preparation.limit_hours = #{limitHours}
  144. </if>
  145. <if test="fee != null">
  146. and preparation.fee = #{fee}
  147. </if>
  148. <if test="feeFile != null and feeFile != ''">
  149. and preparation.fee_file = #{feeFile}
  150. </if>
  151. <if test="keyword != null and keyword != ''">
  152. and preparation.id like concat(concat('%',#{keyword}),'%')
  153. </if>
  154. <!-- 新增查询参数 -->
  155. <if test="statusList != null and statusList.size > 0">
  156. AND preparation.status in
  157. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  158. #{item}
  159. </foreach>
  160. </if>
  161. <if test="tempUserId != null and tempUserId != ''">
  162. and (preparation.user_id = #{tempUserId} or preparation.receive_verify_leader = #{tempUserId}
  163. or preparation.apply_verify_leader = #{tempUserId})
  164. </if>
  165. <if test="delUserId != null and delUserId != ''">
  166. and preparation.del_user_id not like concat(concat('%',#{delUserId}),'%')
  167. </if>
  168. </sql>
  169. <select id="selectList" parameterType="com.platform.dao.dto.preparation.PreparationDTO"
  170. resultType="com.platform.dao.vo.query.preparation.PreparationVO">
  171. select preparation.*,applyU.real_name as userName,sp.name as positionName,dept.name as deptName,psp.name as parentPositionName
  172. from t_preparation as preparation join t_sys_user applyU on preparation.user_id = applyU.user_id
  173. join t_building sp on preparation.position_id = sp.id
  174. left join t_building psp on psp.id = preparation.parent_position_id
  175. join t_sys_dept dept on preparation.depart_id = dept.dept_id
  176. <where>
  177. <include refid="List_Condition"/>
  178. </where>
  179. </select>
  180. <select id="getPreparationReportByStatusVO" resultType="com.platform.dao.vo.report.PreparationReportByStatusVO"
  181. parameterType="com.platform.dao.dto.preparation.PreparationDTO">
  182. select preparation.status,count(1) as num
  183. from t_preparation as preparation join t_sys_user applyU on preparation.user_id = applyU.user_id
  184. join t_building sp on preparation.position_id = sp.id
  185. join t_sys_dept dept on preparation.depart_id = dept.dept_id
  186. <where>
  187. <include refid="List_Condition"/>
  188. </where>
  189. group by status
  190. </select>
  191. <select id="getCountByUserId" resultType="com.platform.dao.vo.query.preparation.PreparationVO"
  192. parameterType="com.platform.dao.dto.preparation.PreparationDTO">
  193. select status, count(1) counts from t_preparation
  194. <where>
  195. <if test="applyVerifyUserId != null and applyVerifyUserId != ''">
  196. and (user_id = #{applyVerifyUserId} or apply_verify_user_id = #{applyVerifyUserId})
  197. </if>
  198. <if test="userId !=null and userId !='' ">
  199. and user_id = #{userId}
  200. </if>
  201. <if test="repairUserId!=null and repairUserId!=''">
  202. and (user_id = #{repairUserId} or repair_user_id = #{repairUserId})
  203. </if>
  204. <if test="tempUserId != null and tempUserId != ''">
  205. and (user_id = #{tempUserId} or receive_verify_leader = #{tempUserId}
  206. or apply_verify_leader = #{tempUserId})
  207. </if>
  208. <if test="delUserId != null and delUserId != ''">
  209. and del_user_id not like concat(concat('%',#{delUserId}),'%')
  210. </if>
  211. </where>
  212. group by status
  213. </select>
  214. </mapper>