ProTaskIssueMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.mes.pro.mapper.ProTaskIssueMapper">
  6. <resultMap type="ProTaskIssue" id="ProTaskIssueResult">
  7. <result property="recordId" column="record_id" />
  8. <result property="taskId" column="task_id" />
  9. <result property="workorderId" column="workorder_id" />
  10. <result property="workstationId" column="workstation_id" />
  11. <result property="sourceDocId" column="source_doc_id" />
  12. <result property="sourceDocCode" column="source_doc_code" />
  13. <result property="sourceDocType" column="source_doc_type" />
  14. <result property="batchCode" column="batch_code" />
  15. <result property="sourceLineId" column="source_line_id" />
  16. <result property="itemId" column="item_id" />
  17. <result property="itemCode" column="item_code" />
  18. <result property="itemName" column="item_name" />
  19. <result property="specification" column="specification" />
  20. <result property="unitOfMeasure" column="unit_of_measure" />
  21. <result property="quantityIssued" column="quantity_issued" />
  22. <result property="quantityAvailable" column="quantity_available" />
  23. <result property="quantityUsed" column="quantity_used" />
  24. <result property="remark" column="remark" />
  25. <result property="attr1" column="attr1" />
  26. <result property="attr2" column="attr2" />
  27. <result property="attr3" column="attr3" />
  28. <result property="attr4" column="attr4" />
  29. <result property="createBy" column="create_by" />
  30. <result property="createTime" column="create_time" />
  31. <result property="updateBy" column="update_by" />
  32. <result property="updateTime" column="update_time" />
  33. </resultMap>
  34. <sql id="selectProTaskIssueVo">
  35. select record_id, task_id, workorder_id, workstation_id, source_doc_id, source_doc_code, source_doc_type, batch_code, source_line_id, item_id, item_code, item_name, specification, unit_of_measure, quantity_issued, quantity_available, quantity_used, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_task_issue
  36. </sql>
  37. <select id="selectProTaskIssueList" parameterType="ProTaskIssue" resultMap="ProTaskIssueResult">
  38. <include refid="selectProTaskIssueVo"/>
  39. <where>
  40. <if test="taskId != null "> and task_id = #{taskId}</if>
  41. <if test="workorderId != null "> and workorder_id = #{workorderId}</if>
  42. <if test="workstationId != null "> and workstation_id = #{workstationId}</if>
  43. <if test="sourceDocId != null "> and source_doc_id = #{sourceDocId}</if>
  44. <if test="sourceDocCode != null and sourceDocCode != ''"> and source_doc_code = #{sourceDocCode}</if>
  45. <if test="sourceDocType != null and sourceDocType != ''"> and source_doc_type = #{sourceDocType}</if>
  46. <if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
  47. <if test="sourceLineId != null "> and source_line_id = #{sourceLineId}</if>
  48. <if test="itemId != null "> and item_id = #{itemId}</if>
  49. <if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
  50. <if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
  51. <if test="specification != null and specification != ''"> and specification = #{specification}</if>
  52. <if test="unitOfMeasure != null and unitOfMeasure != ''"> and unit_of_measure = #{unitOfMeasure}</if>
  53. <if test="quantityIssued != null "> and quantity_issued = #{quantityIssued}</if>
  54. <if test="quantityAvailable != null "> and quantity_available = #{quantityAvailable}</if>
  55. <if test="quantityUsed != null "> and quantity_used = #{quantityUsed}</if>
  56. </where>
  57. </select>
  58. <select id="selectProTaskIssueByRecordId" parameterType="Long" resultMap="ProTaskIssueResult">
  59. <include refid="selectProTaskIssueVo"/>
  60. where record_id = #{recordId}
  61. </select>
  62. <select id="checkUnique" parameterType="ProTaskIssue" resultMap="ProTaskIssueResult">
  63. <include refid="selectProTaskIssueVo"/>
  64. where workstation_id = #{workstationId}
  65. and task_id = #{taskId}
  66. and source_doc_type = #{sourceDocType}
  67. and source_line_id = #{sourceLineId}
  68. offset 0 rows fetch next 1 rows only
  69. </select>
  70. <insert id="insertProTaskIssue" parameterType="ProTaskIssue" useGeneratedKeys="true" keyProperty="recordId">
  71. insert into pro_task_issue
  72. <trim prefix="(" suffix=")" suffixOverrides=",">
  73. <if test="taskId != null">task_id,</if>
  74. <if test="workorderId != null">workorder_id,</if>
  75. <if test="workstationId != null">workstation_id,</if>
  76. <if test="sourceDocId != null">source_doc_id,</if>
  77. <if test="sourceDocCode != null">source_doc_code,</if>
  78. <if test="sourceDocType != null">source_doc_type,</if>
  79. <if test="batchCode != null">batch_code,</if>
  80. <if test="sourceLineId != null">source_line_id,</if>
  81. <if test="itemId != null">item_id,</if>
  82. <if test="itemCode != null and itemCode != ''">item_code,</if>
  83. <if test="itemName != null and itemName != ''">item_name,</if>
  84. <if test="specification != null">specification,</if>
  85. <if test="unitOfMeasure != null and unitOfMeasure != ''">unit_of_measure,</if>
  86. <if test="quantityIssued != null">quantity_issued,</if>
  87. <if test="quantityAvailable != null">quantity_available,</if>
  88. <if test="quantityUsed != null">quantity_used,</if>
  89. <if test="remark != null">remark,</if>
  90. <if test="attr1 != null">attr1,</if>
  91. <if test="attr2 != null">attr2,</if>
  92. <if test="attr3 != null">attr3,</if>
  93. <if test="attr4 != null">attr4,</if>
  94. <if test="createBy != null">create_by,</if>
  95. <if test="createTime != null">create_time,</if>
  96. <if test="updateBy != null">update_by,</if>
  97. <if test="updateTime != null">update_time,</if>
  98. </trim>
  99. <trim prefix="values (" suffix=")" suffixOverrides=",">
  100. <if test="taskId != null">#{taskId},</if>
  101. <if test="workorderId != null">#{workorderId},</if>
  102. <if test="workstationId != null">#{workstationId},</if>
  103. <if test="sourceDocId != null">#{sourceDocId},</if>
  104. <if test="sourceDocCode != null">#{sourceDocCode},</if>
  105. <if test="sourceDocType != null">#{sourceDocType},</if>
  106. <if test="batchCode != null">#{batchCode},</if>
  107. <if test="sourceLineId != null">#{sourceLineId},</if>
  108. <if test="itemId != null">#{itemId},</if>
  109. <if test="itemCode != null and itemCode != ''">#{itemCode},</if>
  110. <if test="itemName != null and itemName != ''">#{itemName},</if>
  111. <if test="specification != null">#{specification},</if>
  112. <if test="unitOfMeasure != null and unitOfMeasure != ''">#{unitOfMeasure},</if>
  113. <if test="quantityIssued != null">#{quantityIssued},</if>
  114. <if test="quantityAvailable != null">#{quantityAvailable},</if>
  115. <if test="quantityUsed != null">#{quantityUsed},</if>
  116. <if test="remark != null">#{remark},</if>
  117. <if test="attr1 != null">#{attr1},</if>
  118. <if test="attr2 != null">#{attr2},</if>
  119. <if test="attr3 != null">#{attr3},</if>
  120. <if test="attr4 != null">#{attr4},</if>
  121. <if test="createBy != null">#{createBy},</if>
  122. <if test="createTime != null">#{createTime},</if>
  123. <if test="updateBy != null">#{updateBy},</if>
  124. <if test="updateTime != null">#{updateTime},</if>
  125. </trim>
  126. </insert>
  127. <update id="updateProTaskIssue" parameterType="ProTaskIssue">
  128. update pro_task_issue
  129. <trim prefix="SET" suffixOverrides=",">
  130. <if test="taskId != null">task_id = #{taskId},</if>
  131. <if test="workorderId != null">workorder_id = #{workorderId},</if>
  132. <if test="workstationId != null">workstation_id = #{workstationId},</if>
  133. <if test="sourceDocId != null">source_doc_id = #{sourceDocId},</if>
  134. <if test="sourceDocCode != null">source_doc_code = #{sourceDocCode},</if>
  135. <if test="sourceDocType != null">source_doc_type = #{sourceDocType},</if>
  136. <if test="batchCode != null">batch_code = #{batchCode},</if>
  137. <if test="sourceLineId != null">source_line_id = #{sourceLineId},</if>
  138. <if test="itemId != null">item_id = #{itemId},</if>
  139. <if test="itemCode != null and itemCode != ''">item_code = #{itemCode},</if>
  140. <if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
  141. <if test="specification != null">specification = #{specification},</if>
  142. <if test="unitOfMeasure != null and unitOfMeasure != ''">unit_of_measure = #{unitOfMeasure},</if>
  143. <if test="quantityIssued != null">quantity_issued = #{quantityIssued},</if>
  144. <if test="quantityAvailable != null">quantity_available = #{quantityAvailable},</if>
  145. <if test="quantityUsed != null">quantity_used = #{quantityUsed},</if>
  146. <if test="remark != null">remark = #{remark},</if>
  147. <if test="attr1 != null">attr1 = #{attr1},</if>
  148. <if test="attr2 != null">attr2 = #{attr2},</if>
  149. <if test="attr3 != null">attr3 = #{attr3},</if>
  150. <if test="attr4 != null">attr4 = #{attr4},</if>
  151. <if test="createBy != null">create_by = #{createBy},</if>
  152. <if test="createTime != null">create_time = #{createTime},</if>
  153. <if test="updateBy != null">update_by = #{updateBy},</if>
  154. <if test="updateTime != null">update_time = #{updateTime},</if>
  155. </trim>
  156. where record_id = #{recordId}
  157. </update>
  158. <delete id="deleteProTaskIssueByRecordId" parameterType="Long">
  159. delete from pro_task_issue where record_id = #{recordId}
  160. </delete>
  161. <delete id="deleteProTaskIssueByRecordIds" parameterType="String">
  162. delete from pro_task_issue where record_id in
  163. <foreach item="recordId" collection="array" open="(" separator="," close=")">
  164. #{recordId}
  165. </foreach>
  166. </delete>
  167. </mapper>