TApplyLockMapper.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.apply.mapper.TApplyLockMapper">
  6. <resultMap type="TApplyLock" id="TApplyLockResult">
  7. <result property="id" column="id" />
  8. <result property="unit" column="unit" />
  9. <result property="lockPost" column="lock_post" />
  10. <result property="pidNo" column="pid_no" />
  11. <result property="lockCode" column="lock_code" />
  12. <result property="medium" column="medium" />
  13. <result property="position" column="position" />
  14. <result property="reason" column="reason" />
  15. <result property="technology" column="technology" />
  16. <result property="riskLevel" column="risk_level" />
  17. <result property="lockSize" column="lock_size" />
  18. <result property="remarks" column="remarks" />
  19. <result property="status" column="status" />
  20. <result property="valveStatus" column="valve_status" />
  21. <result property="delFlag" column="del_flag" />
  22. <result property="createrCode" column="creater_code" />
  23. <result property="createdate" column="createdate" />
  24. <result property="updaterCode" column="updater_code" />
  25. <result property="updatedate" column="updatedate" />
  26. <result property="deptId" column="dept_id" />
  27. <result property="deptName" column="dept_name" />
  28. </resultMap>
  29. <sql id="selectTApplyLockVo">
  30. select d.id, d.unit, d.lock_post, d.pid_no, d.lock_code, d.medium, d.position, d.reason, d.technology, d.risk_level, d.lock_size, d.remarks, d.status, d.valve_status, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id ,s.dept_name from t_apply_lock d
  31. left join sys_dept s on s.dept_id = d.dept_id
  32. </sql>
  33. <select id="selectTApplyLockList" parameterType="TApplyLock" resultMap="TApplyLockResult">
  34. <include refid="selectTApplyLockVo"/>
  35. <where>
  36. <if test="unit != null and unit != ''"> and unit like concat(concat('%',#{unit}),'%')</if>
  37. <if test="lockPost != null and lockPost != ''"> and lock_post = #{lockPost}</if>
  38. <if test="pidNo != null and pidNo != ''"> and pid_no like concat(concat('%', #{pidNo}),'%')</if>
  39. <if test="lockCode != null and lockCode != ''"> and lock_code like concat(concat('%',#{lockCode}),'%')</if>
  40. <if test="medium != null and medium != ''"> and medium like concat(concat('%',#{medium}),'%')</if>
  41. <if test="position != null and position != ''"> and position like concat(concat('%',#{position}),'%')</if>
  42. <if test="reason != null and reason != ''"> and reason = #{reason}</if>
  43. <if test="technology != null and technology != ''"> and technology = #{technology}</if>
  44. <if test="riskLevel != null and riskLevel != ''"> and risk_level = #{riskLevel}</if>
  45. <if test="lockSize != null and lockSize != ''"> and lock_size = #{lockSize}</if>
  46. <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
  47. <if test="status != null "> and d.status = #{status}</if>
  48. <if test="valveStatus != null "> and valve_status = #{valveStatus}</if>
  49. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  50. <if test="createdate != null "> and createdate = #{createdate}</if>
  51. <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
  52. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  53. <if test="deptId != null "> and dept_id = #{deptId}</if>
  54. and d.del_flag = 0
  55. </where>
  56. <!-- 数据范围过滤 -->
  57. ${params.dataScope}
  58. order by createdate asc
  59. </select>
  60. <select id="selectTApplyLockPidList" parameterType="TApplyLock" resultMap="TApplyLockResult">
  61. select distinct(d.pid_no) from t_apply_lock d
  62. <where>
  63. and d.pid_no is not null and d.del_flag = 0
  64. <if test="units != null">and (unit IN
  65. <foreach collection="units" item="unit" open="(" separator="," close=")">
  66. #{unit}
  67. </foreach>
  68. </if>
  69. <if test="posts != null">or lock_post IN
  70. <foreach collection="posts" item="post" open="(" separator="," close=")">
  71. #{post}
  72. </foreach>
  73. </if>)
  74. </where>
  75. </select>
  76. <select id="selectTApplyLockById" parameterType="Long" resultMap="TApplyLockResult">
  77. <include refid="selectTApplyLockVo"/>
  78. where id = #{id}
  79. </select>
  80. <select id="selectTApplyLockByLockCode" parameterType="String" resultMap="TApplyLockResult">
  81. <include refid="selectTApplyLockVo"/>
  82. where lock_code =#{lockCode}
  83. </select>
  84. <insert id="insertTApplyLock" parameterType="TApplyLock">
  85. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  86. SELECT seq_t_apply_lock.NEXTVAL as id FROM DUAL
  87. </selectKey>
  88. insert into t_apply_lock
  89. <trim prefix="(" suffix=")" suffixOverrides=",">
  90. <if test="id != null">id,</if>
  91. <if test="unit != null">unit,</if>
  92. <if test="lockPost != null">lock_post,</if>
  93. <if test="pidNo != null">pid_no,</if>
  94. <if test="lockCode != null">lock_code,</if>
  95. <if test="medium != null">medium,</if>
  96. <if test="position != null">position,</if>
  97. <if test="reason != null">reason,</if>
  98. <if test="technology != null">technology,</if>
  99. <if test="riskLevel != null">risk_level,</if>
  100. <if test="lockSize != null">lock_size,</if>
  101. <if test="remarks != null">remarks,</if>
  102. <if test="status != null">status,</if>
  103. <if test="valveStatus != null">valve_status,</if>
  104. <if test="delFlag != null">del_flag,</if>
  105. <if test="createrCode != null">creater_code,</if>
  106. <if test="createdate != null">createdate,</if>
  107. <if test="updaterCode != null">updater_code,</if>
  108. <if test="updatedate != null">updatedate,</if>
  109. <if test="deptId != null">dept_id,</if>
  110. </trim>
  111. <trim prefix="values (" suffix=")" suffixOverrides=",">
  112. <if test="id != null">#{id},</if>
  113. <if test="unit != null">#{unit},</if>
  114. <if test="lockPost != null">#{lockPost},</if>
  115. <if test="pidNo != null">#{pidNo},</if>
  116. <if test="lockCode != null">#{lockCode},</if>
  117. <if test="medium != null">#{medium},</if>
  118. <if test="position != null">#{position},</if>
  119. <if test="reason != null">#{reason},</if>
  120. <if test="technology != null">#{technology},</if>
  121. <if test="riskLevel != null">#{riskLevel},</if>
  122. <if test="lockSize != null">#{lockSize},</if>
  123. <if test="remarks != null">#{remarks},</if>
  124. <if test="status != null">#{status},</if>
  125. <if test="valveStatus != null">#{valveStatus},</if>
  126. <if test="delFlag != null">#{delFlag},</if>
  127. <if test="createrCode != null">#{createrCode},</if>
  128. <if test="createdate != null">#{createdate},</if>
  129. <if test="updaterCode != null">#{updaterCode},</if>
  130. <if test="updatedate != null">#{updatedate},</if>
  131. <if test="deptId != null">#{deptId},</if>
  132. </trim>
  133. </insert>
  134. <update id="updateTApplyLock" parameterType="TApplyLock">
  135. update t_apply_lock
  136. <trim prefix="SET" suffixOverrides=",">
  137. <if test="unit != null">unit = #{unit},</if>
  138. <if test="lockPost != null">lock_post = #{lockPost},</if>
  139. <if test="pidNo != null">pid_no = #{pidNo},</if>
  140. <if test="lockCode != null">lock_code = #{lockCode},</if>
  141. <if test="medium != null">medium = #{medium},</if>
  142. <if test="position != null">position = #{position},</if>
  143. <if test="reason != null">reason = #{reason},</if>
  144. <if test="technology != null">technology = #{technology},</if>
  145. <if test="riskLevel != null">risk_level = #{riskLevel},</if>
  146. <if test="lockSize != null">lock_size = #{lockSize},</if>
  147. <if test="remarks != null">remarks = #{remarks},</if>
  148. <if test="status != null">status = #{status},</if>
  149. <if test="valveStatus != null">valve_status = #{valveStatus},</if>
  150. <if test="delFlag != null">del_flag = #{delFlag},</if>
  151. <if test="createrCode != null">creater_code = #{createrCode},</if>
  152. <if test="createdate != null">createdate = #{createdate},</if>
  153. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  154. <if test="updatedate != null">updatedate = #{updatedate},</if>
  155. <if test="deptId != null">dept_id = #{deptId},</if>
  156. </trim>
  157. where id = #{id}
  158. </update>
  159. <update id="deleteTApplyLockById" parameterType="Long">
  160. update t_apply_lock set status = 2 where id = #{id}
  161. </update>
  162. <update id="deleteTApplyLockByIds" parameterType="String">
  163. update t_apply_lock set status = 2 where id in
  164. <foreach item="id" collection="array" open="(" separator="," close=")">
  165. #{id}
  166. </foreach>
  167. </update>
  168. </mapper>