TPssrLightingMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.project.pssr.mapper.TPssrLightingMapper">
  6. <resultMap type="TPssrLighting" id="TPssrLightingResult">
  7. <result property="id" column="id" />
  8. <result property="subId" column="sub_id" />
  9. <result property="approveId" column="approve_id" />
  10. <result property="checkContent" column="check_content" />
  11. <result property="checkResult" column="check_result" />
  12. <result property="checkDes" column="check_des" />
  13. <result property="changeResult" column="change_result" />
  14. <result property="confirm" column="confirm" />
  15. <result property="confirmationDate" column="confirmation_date" />
  16. <result property="delFlag" column="del_flag" />
  17. <result property="createrCode" column="creater_code" />
  18. <result property="createdate" column="createdate" />
  19. <result property="updaterCode" column="updater_code" />
  20. <result property="updatedate" column="updatedate" />
  21. <result property="deptId" column="dept_id" />
  22. <result property="remarks" column="remarks" />
  23. <result property="approveStatus" column="approve_status" />
  24. <result property="deptName" column="dept_name" />
  25. <result property="confirm1" column="confirm1" />
  26. <result property="confirm2" column="confirm2" />
  27. <result property="lightingType" column="lighting_type" />
  28. <result property="confirm1Name" column="confirm1_name" />
  29. <result property="confirm2Name" column="confirm2_name" />
  30. <result property="serialNumber" column="serial_number" />
  31. </resultMap>
  32. <sql id="selectTPssrLightingVo">
  33. select d.id, d.serial_number, u1.nick_name confirm1_name, u2.nick_name confirm2_name, d.confirm1, d.confirm2, d.lighting_type, d.sub_id, d.approve_id, d.check_content, d.check_result, d.check_des, d.change_result, d.confirm, d.confirmation_date, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.approve_status ,s.dept_name from t_pssr_lighting d
  34. left join sys_dept s on s.dept_id = d.dept_id
  35. left join sys_user u1 on u1.user_id = d.CONFIRM1
  36. left join sys_user u2 on u2.user_id = d.CONFIRM2
  37. </sql>
  38. <select id="selectNoConfirmCount" parameterType="Long" resultType="int">
  39. select count(1) from t_pssr_Lighting where sub_id = #{subId} and (confirm1 is null or confirm2 is null) and d.del_flag = 0
  40. </select>
  41. <select id="selectTPssrLightingList" parameterType="TPssrLighting" resultMap="TPssrLightingResult">
  42. <include refid="selectTPssrLightingVo"/>
  43. <where>
  44. <if test="subId != null "> and sub_id = #{subId}</if>
  45. <if test="approveId != null "> and approve_id = #{approveId}</if>
  46. <if test="checkContent != null and checkContent != ''"> and check_content = #{checkContent}</if>
  47. <if test="checkResult != null and checkResult != ''"> and check_result = #{checkResult}</if>
  48. <if test="checkDes != null and checkDes != ''"> and check_des = #{checkDes}</if>
  49. <if test="changeResult != null and changeResult != ''"> and change_result = #{changeResult}</if>
  50. <if test="confirm != null and confirm != ''"> and confirm = #{confirm}</if>
  51. <if test="confirmationDate != null "> and confirmation_date = #{confirmationDate}</if>
  52. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  53. <if test="createdate != null "> and createdate = #{createdate}</if>
  54. <if test="updaterCode != null and updaterCode != ''"> and updater_code = #{updaterCode}</if>
  55. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  56. <if test="deptId != null "> and dept_id = #{deptId}</if>
  57. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  58. <if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
  59. <if test="confirm1 != null and confirm1 != ''"> and confirm1 = #{confirm1}</if>
  60. <if test="confirm2 != null and confirm2 != ''"> and confirm2 = #{confirm2}</if>
  61. <if test="lightingType != null and lightingType != ''"> and lighting_type = #{lightingType}</if>
  62. <if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
  63. and d.del_flag = 0
  64. </where>
  65. <!-- 数据范围过滤 -->
  66. ${params.dataScope}
  67. order by
  68. CASE
  69. WHEN confirm1 IS NULL AND confirm2 IS NULL THEN 0
  70. WHEN confirm1 IS NULL OR confirm2 IS NULL THEN 1
  71. ELSE 2
  72. END,d.serial_number asc
  73. </select>
  74. <select id="selectTPssrLightingById" parameterType="Long" resultMap="TPssrLightingResult">
  75. <include refid="selectTPssrLightingVo"/>
  76. where id = #{id}
  77. </select>
  78. <insert id="insertTPssrLighting" parameterType="TPssrLighting">
  79. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  80. SELECT seq_t_pssr_lighting.NEXTVAL as id FROM DUAL
  81. </selectKey>
  82. insert into t_pssr_lighting
  83. <trim prefix="(" suffix=")" suffixOverrides=",">
  84. <if test="id != null">id,</if>
  85. <if test="subId != null">sub_id,</if>
  86. <if test="approveId != null">approve_id,</if>
  87. <if test="checkContent != null">check_content,</if>
  88. <if test="checkResult != null">check_result,</if>
  89. <if test="checkDes != null">check_des,</if>
  90. <if test="changeResult != null">change_result,</if>
  91. <if test="confirm != null">confirm,</if>
  92. <if test="confirmationDate != null">confirmation_date,</if>
  93. <if test="delFlag != null">del_flag,</if>
  94. <if test="createrCode != null">creater_code,</if>
  95. <if test="createdate != null">createdate,</if>
  96. <if test="updaterCode != null">updater_code,</if>
  97. <if test="updatedate != null">updatedate,</if>
  98. <if test="deptId != null">dept_id,</if>
  99. <if test="remarks != null">remarks,</if>
  100. <if test="approveStatus != null">approve_status,</if>
  101. <if test="confirm1 != null">confirm1,</if>
  102. <if test="confirm2 != null">confirm2,</if>
  103. <if test="lightingType != null">lighting_type,</if>
  104. <if test="serialNumber != null">serial_number,</if>
  105. </trim>
  106. <trim prefix="values (" suffix=")" suffixOverrides=",">
  107. <if test="id != null">#{id},</if>
  108. <if test="subId != null">#{subId},</if>
  109. <if test="approveId != null">#{approveId},</if>
  110. <if test="checkContent != null">#{checkContent},</if>
  111. <if test="checkResult != null">#{checkResult},</if>
  112. <if test="checkDes != null">#{checkDes},</if>
  113. <if test="changeResult != null">#{changeResult},</if>
  114. <if test="confirm != null">#{confirm},</if>
  115. <if test="confirmationDate != null">#{confirmationDate},</if>
  116. <if test="delFlag != null">#{delFlag},</if>
  117. <if test="createrCode != null">#{createrCode},</if>
  118. <if test="createdate != null">#{createdate},</if>
  119. <if test="updaterCode != null">#{updaterCode},</if>
  120. <if test="updatedate != null">#{updatedate},</if>
  121. <if test="deptId != null">#{deptId},</if>
  122. <if test="remarks != null">#{remarks},</if>
  123. <if test="approveStatus != null">#{approveStatus},</if>
  124. <if test="confirm1 != null">#{confirm1},</if>
  125. <if test="confirm2 != null">#{confirm2},</if>
  126. <if test="lightingType != null">#{lightingType},</if>
  127. <if test="serialNumber != null">#{serialNumber},</if>
  128. </trim>
  129. </insert>
  130. <update id="updateTPssrLighting" parameterType="TPssrLighting">
  131. update t_pssr_lighting
  132. <trim prefix="SET" suffixOverrides=",">
  133. <if test="subId != null">sub_id = #{subId},</if>
  134. <if test="approveId != null">approve_id = #{approveId},</if>
  135. <if test="checkContent != null">check_content = #{checkContent},</if>
  136. <if test="checkResult != null">check_result = #{checkResult},</if>
  137. <if test="checkDes != null">check_des = #{checkDes},</if>
  138. <if test="changeResult != null">change_result = #{changeResult},</if>
  139. <if test="confirm != null">confirm = #{confirm},</if>
  140. <if test="confirmationDate != null">confirmation_date = #{confirmationDate},</if>
  141. <if test="delFlag != null">del_flag = #{delFlag},</if>
  142. <if test="createrCode != null">creater_code = #{createrCode},</if>
  143. <if test="createdate != null">createdate = #{createdate},</if>
  144. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  145. <if test="updatedate != null">updatedate = #{updatedate},</if>
  146. <if test="deptId != null">dept_id = #{deptId},</if>
  147. <if test="remarks != null and remarks != ''">remarks = #{remarks},</if>
  148. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  149. <if test="confirm1 != null">confirm1 = #{confirm1},</if>
  150. <if test="confirm2 != null">confirm2 = #{confirm2},</if>
  151. <if test="lightingType != null">lighting_type = #{lightingType},</if>
  152. <if test="serialNumber != null">serial_number = #{serialNumber},</if>
  153. </trim>
  154. where id = #{id}
  155. </update>
  156. <update id="updateTPssrLightingByIds" parameterType="TPssrLighting">
  157. update t_pssr_lighting
  158. <trim prefix="SET" suffixOverrides=",">
  159. <if test="confirm1 != null">confirm1 = #{confirm1},</if>
  160. <if test="confirm2 != null">confirm2 = #{confirm2},</if>
  161. <if test="confirmationDate != null">confirmation_date = #{confirmationDate},</if>
  162. <if test="createrCode != null">creater_code = #{createrCode},</if>
  163. <if test="createdate != null">createdate = #{createdate},</if>
  164. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  165. <if test="updatedate != null">updatedate = #{updatedate},</if>
  166. <if test="remarks != null and remarks != ''">remarks = #{remarks},</if>
  167. <if test="serialNumber != null">serial_number = #{serialNumber},</if>
  168. </trim>
  169. where id in
  170. <foreach item="id" collection="ids" open="(" separator="," close=")">
  171. #{id}
  172. </foreach>
  173. </update>
  174. <update id="deleteTPssrLightingById" parameterType="Long">
  175. update t_pssr_lighting set del_flag = 2 where id = #{id}
  176. </update>
  177. <update id="deleteTPssrLightingByIds" parameterType="String">
  178. update t_pssr_lighting set del_flag = 2 where id in
  179. <foreach item="id" collection="array" open="(" separator="," close=")">
  180. #{id}
  181. </foreach>
  182. </update>
  183. </mapper>