IsJobTicketPointsMapper.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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.ktg.iscs.mapper.IsJobTicketPointsMapper">
  6. <resultMap type="IsJobTicketPoints" id="IsJobTicketPointsResult">
  7. <result property="recordId" column="record_id" />
  8. <result property="ticketId" column="ticket_id" />
  9. <result property="workshopId" column="workshop_id" />
  10. <result property="workareaId" column="workarea_id" />
  11. <result property="pointId" column="point_id" />
  12. <result property="pointStatus" column="point_status" />
  13. <result property="delFlag" column="del_flag" />
  14. <result property="createBy" column="create_by" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="updateBy" column="update_by" />
  18. <result property="lockId" column="lock_id" />
  19. <result property="lockedByKeyId" column="locked_by_key_id" />
  20. <result property="unlockedByKeyId" column="unlocked_by_key_id" />
  21. <result property="lockTime" column="lock_time" />
  22. <result property="unlockTime" column="unlock_time" />
  23. <result property="prePointId" column="pre_point_id" />
  24. </resultMap>
  25. <sql id="selectIsJobTicketPointsVo">
  26. select * from is_job_ticket_points
  27. </sql>
  28. <select id="selectIsJobTicketPointsList" parameterType="IsJobTicketPoints" resultMap="IsJobTicketPointsResult">
  29. <include refid="selectIsJobTicketPointsVo"/>
  30. <where>
  31. <if test="ticketId != null "> and ticket_id = #{ticketId}</if>
  32. <if test="workshopId != null "> and workshop_id = #{workshopId}</if>
  33. <if test="workareaId != null "> and workarea_id = #{workareaId}</if>
  34. <if test="pointId != null "> and point_id = #{pointId}</if>
  35. <if test="pointStatus != null and pointStatus != ''"> and point_status = #{pointStatus}</if>
  36. </where>
  37. </select>
  38. <select id="selectIsJobTicketPointsByRecordId" parameterType="Long" resultMap="IsJobTicketPointsResult">
  39. <include refid="selectIsJobTicketPointsVo"/>
  40. where record_id = #{recordId}
  41. </select>
  42. <insert id="insertIsJobTicketPoints" parameterType="IsJobTicketPoints" useGeneratedKeys="true" keyProperty="recordId">
  43. insert into is_job_ticket_points
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="ticketId != null">ticket_id,</if>
  46. <if test="workshopId != null">workshop_id,</if>
  47. <if test="workareaId != null">workarea_id,</if>
  48. <if test="pointId != null">point_id,</if>
  49. <if test="pointStatus != null">point_status,</if>
  50. <if test="delFlag != null">del_flag,</if>
  51. <if test="createBy != null">create_by,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="updateTime != null">update_time,</if>
  54. <if test="updateBy != null">update_by,</if>
  55. <if test="lockId != null">lock_id,</if>
  56. <if test="lockedByKeyId != null">locked_by_key_id,</if>
  57. <if test="unlockedByKeyId != null">unlocked_by_key_id,</if>
  58. <if test="lockTime != null">lock_time,</if>
  59. <if test="unlockTime != null">unlock_time,</if>
  60. <if test="prePointId != null">pre_point_id,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="ticketId != null">#{ticketId},</if>
  64. <if test="workshopId != null">#{workshopId},</if>
  65. <if test="workareaId != null">#{workareaId},</if>
  66. <if test="pointId != null">#{pointId},</if>
  67. <if test="pointStatus != null">#{pointStatus},</if>
  68. <if test="delFlag != null">#{delFlag},</if>
  69. <if test="createBy != null">#{createBy},</if>
  70. <if test="createTime != null">#{createTime},</if>
  71. <if test="updateTime != null">#{updateTime},</if>
  72. <if test="updateBy != null">#{updateBy},</if>
  73. <if test="lockId != null">#{lockId},</if>
  74. <if test="lockedByKeyId != null">#{lockedByKeyId},</if>
  75. <if test="unlockedByKeyId != null">#{unlockedByKeyId},</if>
  76. <if test="lockTime != null">#{lockTime},</if>
  77. <if test="unlockTime != null">#{unlockTime},</if>
  78. <if test="prePointId != null">#{prePointId},</if>
  79. </trim>
  80. </insert>
  81. <update id="updateIsJobTicketPoints" parameterType="IsJobTicketPoints">
  82. update is_job_ticket_points
  83. <trim prefix="SET" suffixOverrides=",">
  84. <if test="ticketId != null">ticket_id = #{ticketId},</if>
  85. <if test="workshopId != null">workshop_id = #{workshopId},</if>
  86. <if test="workareaId != null">workarea_id = #{workareaId},</if>
  87. <if test="pointId != null">point_id = #{pointId},</if>
  88. <if test="pointStatus != null">point_status = #{pointStatus},</if>
  89. <if test="delFlag != null">del_flag = #{delFlag},</if>
  90. <if test="createBy != null">create_by = #{createBy},</if>
  91. <if test="createTime != null">create_time = #{createTime},</if>
  92. <if test="updateTime != null">update_time = #{updateTime},</if>
  93. <if test="updateBy != null">update_by = #{updateBy},</if>
  94. <if test="lockId != null">lock_id = #{lockId},</if>
  95. <if test="lockedByKeyId != null">locked_by_key_id = #{lockedByKeyId},</if>
  96. <if test="unlockedByKeyId != null">unlocked_by_key_id = #{unlockedByKeyId},</if>
  97. <if test="lockTime != null">lock_time = #{lockTime},</if>
  98. <if test="unlockTime != null">unlock_time = #{unlockTime},</if>
  99. <if test="prePointId != null">pre_point_id = #{prePointId},</if>
  100. </trim>
  101. where record_id = #{recordId}
  102. </update>
  103. <delete id="deleteIsJobTicketPointsByRecordId" parameterType="Long">
  104. delete from is_job_ticket_points where record_id = #{recordId}
  105. </delete>
  106. <delete id="deleteIsJobTicketPointsByRecordIds" parameterType="String">
  107. delete from is_job_ticket_points where record_id in
  108. <foreach item="recordId" collection="array" open="(" separator="," close=")">
  109. #{recordId}
  110. </foreach>
  111. </delete>
  112. <select id="getListByTicketId" resultType="com.ktg.iscs.domain.vo.ticketPoints.IsJobTicketPointsVO">
  113. SELECT
  114. j.*,
  115. i.point_name,
  116. r.rfid as point_nfc,
  117. i.point_serial_number,
  118. l.lock_name,
  119. l.lock_nfc,
  120. i.remark as effect,
  121. s.loto_id,
  122. s.loto_serial_number
  123. FROM
  124. is_job_ticket_points j
  125. LEFT JOIN is_isolation_point i ON j.point_id = i.point_id
  126. left join is_rfid_token r on r.rfid_id = i.rfid_id
  127. LEFT JOIN is_lock l ON j.lock_id = l.lock_id
  128. LEFT JOIN is_loto_station s ON s.loto_id = i.loto_id
  129. WHERE
  130. j.ticket_id = #{ticketId}
  131. ORDER BY
  132. j.record_id ASC
  133. </select>
  134. <select id="getFinishConflictJob" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
  135. SELECT
  136. p.*
  137. FROM
  138. is_job_ticket_points p
  139. LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
  140. WHERE
  141. t.ticket_status = '5'
  142. AND p.point_status = '1'
  143. AND p.unlocked_by_key_id IS NULL
  144. AND p.point_id = #{pointId}
  145. AND p.lock_id = #{lockId}
  146. </select>
  147. <select id="getNotFinishConflictJob" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
  148. SELECT
  149. p.*
  150. FROM
  151. is_job_ticket_points p
  152. LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
  153. LEFT JOIN is_job_ticket_key k ON k.ticket_id = p.ticket_id and k.ticket_type = '1'
  154. WHERE
  155. t.ticket_status &lt; 5
  156. AND p.point_status = '1'
  157. AND p.unlocked_by_key_id IS NULL
  158. AND p.point_id = #{pointId}
  159. AND p.lock_id = #{lockId}
  160. AND k.collect_time IS NOT NULL
  161. </select>
  162. <select id="getLockingData" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
  163. SELECT
  164. p.*
  165. FROM
  166. is_job_ticket_points p
  167. LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
  168. LEFT JOIN is_job_ticket_key k ON k.ticket_id = p.ticket_id and k.ticket_type = '1'
  169. WHERE
  170. t.ticket_status &lt; 5
  171. AND p.point_status = '1'
  172. AND p.unlocked_by_key_id IS NULL
  173. AND p.point_id = #{pointId}
  174. AND k.collect_time IS NULL
  175. order by p.ticket_id asc
  176. offset 0 rows fetch next 1 rows only
  177. </select>
  178. <select id="getVirtualLockConflictPoint" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
  179. SELECT
  180. p.*
  181. FROM
  182. is_job_ticket_points p
  183. LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
  184. LEFT JOIN is_job_ticket_key k ON k.ticket_id = p.ticket_id and k.ticket_type = '1'
  185. WHERE
  186. t.ticket_status &lt; 5
  187. AND p.point_status = '1'
  188. AND p.unlocked_by_key_id IS NULL
  189. AND p.point_id = #{pointId}
  190. AND p.lock_id = #{lockId}
  191. AND p.ticket_id != #{ticketId}
  192. AND k.collect_time IS NULL
  193. </select>
  194. </mapper>