CheckStandardMapper.xml 9.7 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.check.CheckStandardMapper">
  4. <sql id="Base_Column_List">
  5. checkstandard.id,
  6. checkstandard.sb_id,
  7. checkstandard.standard_hours,
  8. checkstandard.real_hours,
  9. checkstandard.check_user_id,
  10. checkstandard.name,
  11. checkstandard.level,
  12. checkstandard.no,
  13. checkstandard.type,
  14. checkstandard.period,
  15. checkstandard.period_type,
  16. checkstandard.action_type,
  17. checkstandard.check_user_type,
  18. checkstandard.enable,
  19. checkstandard.part,
  20. checkstandard.sort,
  21. checkstandard.requirement,
  22. checkstandard.remark,
  23. checkstandard.created_user_id,
  24. checkstandard.update_user_id,
  25. checkstandard.created_user_name,
  26. checkstandard.update_user_name,
  27. checkstandard.last_date,
  28. checkstandard.next_date,
  29. checkstandard.created_time,
  30. checkstandard.update_time
  31. </sql>
  32. <sql id="Ref_Column_List">
  33. checkstandard.sb_id,
  34. checkstandard.standard_hours,
  35. checkstandard.real_hours,
  36. checkstandard.check_user_id,
  37. checkstandard.name,checkstandard.level,
  38. checkstandard.sort,
  39. checkstandard.no,
  40. checkstandard.last_date,
  41. checkstandard.next_date,
  42. checkstandard.type,
  43. checkstandard.period,
  44. checkstandard.part,
  45. checkstandard.period_type,
  46. checkstandard.action_type,
  47. checkstandard.check_user_type,
  48. checkstandard.enable,
  49. checkstandard.requirement,
  50. checkstandard.remark,
  51. </sql>
  52. <sql id="List_Condition">
  53. <if test="id != null and id != ''">
  54. and checkstandard.id = #{id}
  55. </if>
  56. <if test="sbId != null and sbId != ''">
  57. and checkstandard.sb_id = #{sbId}
  58. </if>
  59. <if test="name != null and name != ''">
  60. and checkstandard.name = #{name}
  61. </if>
  62. <if test="level != null and level != ''">
  63. and checkstandard.level = #{level}
  64. </if>
  65. <if test="part != null and part != ''">
  66. and checkstandard.part = #{part}
  67. </if>
  68. <if test="checkUserId != null and checkUserId != ''">
  69. and checkstandard.check_user_id = #{checkUserId}
  70. </if>
  71. <if test="no != null and no != ''">
  72. and checkstandard.no = #{no}
  73. </if>
  74. <if test="type != null">
  75. and checkstandard.type = #{type}
  76. </if>
  77. <if test="lastDate != null">
  78. and checkstandard.last_date = #{lastDate}
  79. </if>
  80. <if test="nextDate != null">
  81. and checkstandard.next_date = #{nextDate}
  82. </if>
  83. <if test="period != null">
  84. and checkstandard.period = #{period}
  85. </if>
  86. <if test="periodType != null">
  87. and checkstandard.period_type = #{periodType}
  88. </if>
  89. <if test="checkUserType != null">
  90. and checkstandard.check_user_type = #{checkUserType}
  91. </if>
  92. <if test="actionType != null">
  93. and checkstandard.action_type = #{actionType}
  94. </if>
  95. <if test="enable != null">
  96. and checkstandard.enable = #{enable}
  97. </if>
  98. <if test="requirement != null and requirement != ''">
  99. and checkstandard.requirement = #{requirement}
  100. </if>
  101. <if test="remark != null and remark != ''">
  102. and checkstandard.remark = #{remark}
  103. </if>
  104. <if test="createdUserId != null and createdUserId != ''">
  105. and checkstandard.created_user_id = #{createdUserId}
  106. </if>
  107. <if test="updateUserId != null and updateUserId != ''">
  108. and checkstandard.update_user_id = #{updateUserId}
  109. </if>
  110. <if test="createdUserName != null and createdUserName != ''">
  111. and checkstandard.created_user_name = #{createdUserName}
  112. </if>
  113. <if test="updateUserName != null and updateUserName != ''">
  114. and checkstandard.update_user_name = #{updateUserName}
  115. </if>
  116. <if test="createdTimeStart != null">
  117. and checkstandard.created_time <![CDATA[>=]]>; #{createdTimeStart}
  118. </if>
  119. <if test="createdTimeEnd != null">
  120. and checkstandard.created_time <![CDATA[<=]]> #{createdTimeEnd}
  121. </if>
  122. <if test="createdTime != null">
  123. and checkstandard.created_time = #{createdTime}
  124. </if>
  125. <if test="updateTimeStart != null">
  126. and checkstandard.update_time <![CDATA[>=]]>; #{updateTimeStart}
  127. </if>
  128. <if test="updateTimeEnd != null">
  129. and checkstandard.update_time <![CDATA[<=]]> #{updateTimeEnd}
  130. </if>
  131. <if test="updateTime != null">
  132. and checkstandard.update_time = #{updateTime}
  133. </if>
  134. <if test="keyword != null and keyword != ''">
  135. and (checkstandard.name like concat('%',#{keyword},'%') or checkstandard.no like concat('%',#{keyword},'%') )
  136. </if>
  137. </sql>
  138. <select id="selectList" parameterType="com.platform.dao.dto.check.CheckStandardDTO"
  139. resultType="com.platform.dao.vo.query.check.CheckStandardVO">
  140. select checkstandard.*, sbInfo.name as sbName, sbInfo.no as sbNo,
  141. sbInfo.level as sbLevel,
  142. sbInfo.repair_user as repairUser,
  143. partInfo.name as partName
  144. from t_check_standard as checkstandard
  145. LEFT JOIN t_sb_info sbInfo on checkstandard.sb_id = sbInfo.id
  146. LEFT JOIN t_part_info partInfo on checkstandard.part = partInfo.id
  147. <where>
  148. <include refid="List_Condition"/>
  149. <if test="sbName != null and sbName != ''">
  150. and sbInfo.name like concat('%',#{sbName},'%')
  151. </if>
  152. <if test="sbNo != null and sbNo != ''">
  153. and sbInfo.no like concat('%',#{sbNo},'%')
  154. </if>
  155. <if test="typeId != null and typeId != ''">
  156. and sbInfo.type_id = #{typeId}
  157. </if>
  158. <if test="sbLevel != null and sbLevel != ''">
  159. and sbInfo.level = #{sbLevel}
  160. </if>
  161. </where>
  162. Order By
  163. checkstandard.level asc,
  164. sbInfo.level asc,
  165. sbInfo.no asc,
  166. checkstandard.period_type asc,
  167. checkstandard.period asc
  168. </select>
  169. <select id="selectProjectStandardList" resultType="com.platform.dao.vo.query.check.CheckStandardVO">
  170. select project.*, project.id as projectId
  171. from t_check_project_standard_relation tcppr
  172. inner join t_check_project project on tcppr.project_id = project.id
  173. inner join t_check_standard standard on tcppr.standard_id = standard.id
  174. where tcppr.project_id = #{projectId}
  175. </select>
  176. <select id="selectMaxNo" resultType="java.lang.String">
  177. select max(no) from t_check_standard
  178. </select>
  179. <update id="updateBatch" parameterType="java.util.List">
  180. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  181. update t_check_standard
  182. <set>
  183. <if test="item.requirement != null and item.requirement != ''">
  184. requirement = #{item.requirement},
  185. </if>
  186. <if test="item.remark != null and item.remark != ''">
  187. remark = #{item.remark},
  188. </if>
  189. <if test="item.no != null and item.no != ''">
  190. no = #{item.no},
  191. </if>
  192. <if test="item.name != null and item.name != ''">
  193. name = #{item.name},
  194. </if>
  195. <if test="item.period != null">
  196. period = #{item.period},
  197. </if>
  198. <if test="item.periodType != null">
  199. period_type = #{item.periodType},
  200. </if>
  201. <if test="item.checkUserType != null">
  202. check_user_type = #{item.checkUserType},
  203. </if>
  204. <if test="item.lastDate != null">
  205. last_date = #{item.lastDate},
  206. </if>
  207. <if test="item.nextDate != null">
  208. next_date = #{item.nextDate}
  209. </if>
  210. </set>
  211. where id = #{item.id}
  212. </foreach>
  213. </update>
  214. </mapper>