DetailsOfTheRefuelingPlanSpinningMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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.zkqy.business.mapper.DetailsOfTheRefuelingPlanSpinningMapper">
  6. <resultMap type="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning" id="DetailsOfTheRefuelingPlanSpinningResult">
  7. <result property="id" column="id" />
  8. <result property="timestampRandomCode" column="timestamp_random_code" />
  9. <result property="macId" column="mac_id" />
  10. <result property="machineId" column="machine_id" />
  11. <result property="productionDigit" column="production_digit" />
  12. <result property="currentColorCode" column="current_color_code" />
  13. <result property="currentSpecification" column="current_specification" />
  14. <result property="currentLotNumber" column="current_lot_number" />
  15. <result property="startTime" column="start_time" />
  16. <result property="plannedEndTime" column="planned_end_time" />
  17. <result property="planStatus" column="plan_status" />
  18. <result property="number" column="number" />
  19. <result property="remark" column="remark" />
  20. <result property="createById" column="create_by_id" />
  21. <result property="createBy" column="create_by" />
  22. <result property="updateById" column="update_by_id" />
  23. <result property="updateBy" column="update_by" />
  24. <result property="createTime" column="create_time" />
  25. <result property="updateTime" column="update_time" />
  26. <result property="productId" column="product_id" />
  27. <result property="salesmanId" column="salesman_id" />
  28. <result property="productTypeName" column="productTypeName"/>
  29. <result property="createById" column="create_by_id" />
  30. <result property="createBy" column="create_by" />
  31. <result property="createTime" column="create_time"/>
  32. <result property="tubeweight" column="tube_weight"/>
  33. <result property="boxweight" column="box_weight"/>
  34. <result property="tubecolor" column="tube_color"/>
  35. </resultMap>
  36. <sql id="selectDetailsOfTheRefuelingPlanSpinningVo">
  37. select id, timestamp_random_code, mac_id,machine_id, production_digit, current_color_code, current_specification, current_lot_number, start_time, planned_end_time,
  38. plan_status, number, remark, create_by_id, create_by, update_by, update_by, create_time, update_time,tube_weight,box_weight,tube_color,
  39. product_id, salesman_id,productTypeName,create_by_id,create_by,create_time
  40. from huaxian.details_of_the_refueling_plan_spinning
  41. </sql>
  42. <select id="selectDetailsOfTheRefuelingPlanSpinningList" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning" resultMap="DetailsOfTheRefuelingPlanSpinningResult">
  43. <include refid="selectDetailsOfTheRefuelingPlanSpinningVo"/>
  44. <where>
  45. <if test="timestampRandomCode != null and timestampRandomCode != ''"> and timestamp_random_code = #{timestampRandomCode}</if>
  46. <if test="macId != null and machineId != ''"> and mac_id = #{macId}</if>
  47. <if test="machineId != null and machineId != ''"> and machine_id = #{machineId}</if>
  48. <if test="productionDigit != null and productionDigit != ''"> and production_digit = #{productionDigit}</if>
  49. <if test="currentColorCode != null and currentColorCode != ''"> and current_color_code = #{currentColorCode}</if>
  50. <if test="currentSpecification != null and currentSpecification != ''"> and current_specification = #{currentSpecification}</if>
  51. <if test="currentLotNumber != null and currentLotNumber != ''"> and current_lot_number = #{currentLotNumber}</if>
  52. <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
  53. <if test="plannedEndTime != null and plannedEndTime != ''"> and planned_end_time = #{plannedEndTime}</if>
  54. <if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
  55. <if test="number != null and number != ''"> and number = #{number}</if>
  56. <if test="createById != null and createById != ''"> and create_by_id = #{createById}</if>
  57. <if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createby}, '%')</if>
  58. <if test="updateById != null and updateById != ''"> and update_by_id = #{updateById}</if>
  59. <if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateby}, '%')</if>
  60. <if test="productId != null and productId != ''"> and product_id = #{productId}</if>
  61. <if test="salesmanId != null and salesmanId != ''"> and salesman_id = #{salesmanId}</if>
  62. and plan_status != 3
  63. </where>
  64. </select>
  65. <select id="selectDetailsOfTheRefuelingPlanSpinningById" parameterType="Long" resultMap="DetailsOfTheRefuelingPlanSpinningResult">
  66. <include refid="selectDetailsOfTheRefuelingPlanSpinningVo"/>
  67. where id = #{id}
  68. </select>
  69. <select id="selectDetailsOfTheRefuelingPlanSpinningListCount" resultType="java.lang.Integer">
  70. select count(id) from {DBNAME}.details_of_the_refueling_plan_spinning where plan_status !=2 and plan_status!=3
  71. </select>
  72. <select id="getCurrentProductionLineSuperior"
  73. resultType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning">
  74. <include refid="selectDetailsOfTheRefuelingPlanSpinningVo"/>
  75. <where>
  76. <if test="id != null and id != ''"> and id != #{id}</if>
  77. <if test="timestampRandomCode != null and timestampRandomCode != ''"> and timestamp_random_code = #{timestampRandomCode}</if>
  78. <if test="macId != null and machineId != ''"> and mac_id = #{macId}</if>
  79. <if test="machineId != null and machineId != ''"> and machine_id = #{machineId}</if>
  80. <if test="productionDigit != null and productionDigit != ''"> and production_digit = #{productionDigit}</if>
  81. <if test="currentColorCode != null and currentColorCode != ''"> and current_color_code = #{currentColorCode}</if>
  82. <if test="currentSpecification != null and currentSpecification != ''"> and current_specification = #{currentSpecification}</if>
  83. <if test="currentLotNumber != null and currentLotNumber != ''"> and current_lot_number = #{currentLotNumber}</if>
  84. <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
  85. <if test="plannedEndTime != null and plannedEndTime != ''"> and planned_end_time = #{plannedEndTime}</if>
  86. <if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
  87. <if test="number != null and number != ''"> and number = #{number}</if>
  88. <if test="createById != null and createById != ''"> and create_by_id = #{createById}</if>
  89. <if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
  90. <if test="updateById != null and updateById != ''"> and update_by_id = #{updateById}</if>
  91. <if test="updateBy != null and updateBy!= ''"> and update_by like concat('%', #{updateBy}, '%')</if>
  92. <if test="productId != null and productId != ''"> and product_id = #{productId}</if>
  93. <if test="salesmanId != null and salesmanId != ''"> and salesman_id = #{salesmanId}</if>
  94. </where>
  95. </select>
  96. <select id="getIsTheOrderProductProduced"
  97. parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning"
  98. resultType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning">
  99. select * from {DBNAME}.details_of_the_refueling_plan_spinning as dotrps
  100. left join
  101. {DBNAME}.sale_products as sp
  102. on dotrps.product_id=sp.id and dotrps.salesman_id=sp.sale_order_no
  103. where sp.`status`=4 and dotrps.id=#{id}
  104. </select>
  105. <select id="getUpdatePlanSpinningInfo"
  106. resultType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning">
  107. select * from {DBNAME}.details_of_the_refueling_plan_spinning as dotrps
  108. left join
  109. {DBNAME}.sale_products as sp
  110. on dotrps.product_id=sp.id and dotrps.salesman_id=sp.sale_order_no
  111. where sp.`status`!=4 and dotrps.id=#{id}
  112. </select>
  113. <insert id="insertDetailsOfTheRefuelingPlanSpinning" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning" useGeneratedKeys="true" keyProperty="id">
  114. insert into {DBNAME}.details_of_the_refueling_plan_spinning
  115. <trim prefix="(" suffix=")" suffixOverrides=",">
  116. <if test="timestampRandomCode != null">timestamp_random_code,</if>
  117. <if test="machineId != null">machine_id,</if>
  118. <if test="productionDigit != null">production_digit,</if>
  119. <if test="currentColorCode != null and currentColorCode != ''">current_color_code,</if>
  120. <if test="currentSpecification != null">current_specification,</if>
  121. <if test="currentLotNumber != null">current_lot_number,</if>
  122. <if test="startTime != null">start_time,</if>
  123. <if test="plannedEndTime != null">planned_end_time,</if>
  124. <if test="planStatus != null">plan_status,</if>
  125. <if test="number != null">`number`,</if>
  126. <if test="remark != null">remark,</if>
  127. <if test="createById != null">create_by_id,</if>
  128. <if test="createBy != null">create_by,</if>
  129. <if test="updateById != null">update_by_id,</if>
  130. <if test="updateBy != null">update_by,</if>
  131. <if test="createTime != null">create_time,</if>
  132. <if test="updateTime != null">update_time,</if>
  133. <if test="productId != null">product_id,</if>
  134. <if test="salesmanId != null">salesman_id,</if>
  135. <if test="createById!=null and createById!=''">create_by_id,</if>
  136. <if test="createBy!=null and createBy!=''">create_by,</if>
  137. <if test="createTime!=null and createTime!=''">create_time,</if>
  138. <if test="tubeweight!=null and tubeweight!=''">tube_weight,</if>
  139. <if test="boxweight!=null and boxweight!=''">box_weight,</if>
  140. <if test="tubecolor!=null and tubecolor!=''">tube_color,</if>
  141. </trim>
  142. <trim prefix="values (" suffix=")" suffixOverrides=",">
  143. <if test="timestampRandomCode != null">#{timestampRandomCode},</if>
  144. <if test="machineId != null">#{machineId},</if>
  145. <if test="productionDigit != null">#{productionDigit},</if>
  146. <if test="currentColorCode != null and currentColorCode != ''">#{currentColorCode},</if>
  147. <if test="currentSpecification != null">#{currentSpecification},</if>
  148. <if test="currentLotNumber != null">#{currentLotNumber},</if>
  149. <if test="startTime != null">#{startTime},</if>
  150. <if test="plannedEndTime != null">#{plannedEndTime},</if>
  151. <if test="planStatus != null">#{planStatus},</if>
  152. <if test="number != null">#{number},</if>
  153. <if test="remark != null">#{remark},</if>
  154. <if test="createById != null">#{createById},</if>
  155. <if test="createBy != null">#{createBy},</if>
  156. <if test="updateById != null">#{updatebyId},</if>
  157. <if test="updateBy != null">#{updateBy},</if>
  158. <if test="createTime != null">#{createTime},</if>
  159. <if test="updateTime != null">#{updateTime},</if>
  160. <if test="productId != null">#{productId},</if>
  161. <if test="salesmanId != null">#{salesmanId},</if>
  162. <if test="createById!=null and createById!=''">#{createById},</if>
  163. <if test="createBy!=null and createBy!=''">#{createBy},</if>
  164. <if test="createTime!=null and createTime!=''">#{createTime},</if>
  165. <if test="tubeweight!=null and tubeweight!=''">#{tubeweight},</if>
  166. <if test="boxweight!=null and boxweight!=''">#{boxweight},</if>
  167. <if test="tubecolor!=null and tubecolor!=''">#{tubecolor},</if>
  168. </trim>
  169. </insert>
  170. <update id="updateDetailsOfTheRefuelingPlanSpinning" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlanSpinning">
  171. update {DBNAME}.details_of_the_refueling_plan_spinning
  172. <trim prefix="SET" suffixOverrides=",">
  173. <if test="timestampRandomCode != null">timestamp_random_code = #{timestampRandomCode},</if>
  174. <if test="machineId != null">machine_id = #{machineId},</if>
  175. <if test="productionDigit != null">production_digit = #{productionDigit},</if>
  176. <if test="currentColorCode != null and currentColorCode != ''">current_color_code = #{currentColorCode},</if>
  177. <if test="currentSpecification != null">current_specification = #{currentSpecification},</if>
  178. <if test="currentLotNumber != null">current_lot_number = #{currentLotNumber},</if>
  179. <if test="startTime != null">start_time = #{startTime},</if>
  180. <if test="plannedEndTime != null">planned_end_time = #{plannedEndTime},</if>
  181. <if test="planStatus != null">plan_status = #{planStatus},</if>
  182. <if test="number != null">`number` = #{number},</if>
  183. <if test="remark != null">remark = #{remark},</if>
  184. <if test="createById != null">create_by_id = #{createById},</if>
  185. <if test="createBy != null">create_by = #{createBy},</if>
  186. <if test="updateById != null">update_by_id = #{updateById},</if>
  187. <if test="updateBy != null">update_by = #{updateBy},</if>
  188. <if test="createTime != null">create_time = #{createTime},</if>
  189. <if test="updateTime != null">update_time = #{updateTime},</if>
  190. <if test="productId != null">product_id = #{productId},</if>
  191. <if test="salesmanId != null">salesman_id = #{salesmanId},</if>
  192. <if test="tubeweight !=null and tubeweight !=''">tube_weight= #{tubeweight},</if>
  193. <if test="boxweight !=null and boxweight !=''">box_weight= #{boxweight},</if>
  194. <if test="tubecolor !=null and tubecolor !=''">tube_color= #{tubecolor},</if>
  195. </trim>
  196. where id = #{id}
  197. </update>
  198. <delete id="deleteDetailsOfTheRefuelingPlanSpinningById" parameterType="Long">
  199. delete from {DBNAME}.details_of_the_refueling_plan_spinning where id = #{id}
  200. </delete>
  201. <delete id="deleteDetailsOfTheRefuelingPlanSpinningByIds" parameterType="String">
  202. delete from {DBNAME}.details_of_the_refueling_plan_spinning where id in
  203. <foreach item="id" collection="array" open="(" separator="," close=")">
  204. #{id}
  205. </foreach>
  206. </delete>
  207. <delete id="deleteDetailsOfTheRefuelingPlanSpinningBySalesmanId">
  208. delete from {DBNAME}.details_of_the_refueling_plan_spinning where salesman_id in
  209. <foreach item="id" collection="list" open="(" separator="," close=")">
  210. #{id}
  211. </foreach>
  212. </delete>
  213. <insert id="insertBatchDetailsOfTheRefuelingPlanSpinning" parameterType="java.util.List">
  214. INSERT INTO {DBNAME}.details_of_the_refueling_plan_spinning
  215. <trim prefix="(" suffix=")" suffixOverrides=",">
  216. timestamp_random_code,
  217. mac_id,
  218. machine_id,
  219. current_color_code,
  220. current_specification,
  221. current_lot_number,
  222. production_digit,
  223. start_time,
  224. planned_end_time,
  225. plan_status,
  226. `number`,
  227. `product_id`,
  228. `salesman_id`,
  229. `productTypeName`,
  230. `plan_type`,
  231. create_by,
  232. create_by_id,
  233. create_time,
  234. tube_weight,
  235. box_weight,
  236. tube_color,
  237. </trim>
  238. VALUES
  239. <foreach collection="list" item="item" separator=",">
  240. <trim prefix="(" suffix=")" suffixOverrides=",">
  241. #{item.timestampRandomCode},
  242. #{item.macId},
  243. #{item.machineId},
  244. #{item.currentColorCode},
  245. #{item.currentSpecification},
  246. #{item.currentLotNumber},
  247. #{item.productionDigit},
  248. #{item.startTime},
  249. #{item.plannedEndTime},
  250. #{item.planStatus},
  251. #{item.number},
  252. #{item.productId},
  253. #{item.salesmanId},
  254. #{item.productTypeName},
  255. #{item.planType},
  256. #{item.createBy},
  257. #{item.createById},
  258. #{item.createTime},
  259. #{item.tubeweight},
  260. #{item.boxweight},
  261. #{item.tubecolor},
  262. </trim>
  263. </foreach>
  264. </insert>
  265. </mapper>