FlowConfigHeaderMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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.ams.config.mapper.FlowConfigHeaderMapper">
  6. <resultMap type="FlowConfigHeader" id="FlowConfigHeaderResult">
  7. <result property="id" column="id" />
  8. <result property="flowName" column="flow_name" />
  9. <result property="flowType" column="flow_type" />
  10. <result property="skuType" column="sku_type" />
  11. <result property="skuTypeFlag" column="sku_type_flag" />
  12. <result property="qty" column="qty" />
  13. <result property="qtyRange" column="qty_range" />
  14. <result property="qtyFlag" column="qty_flag" />
  15. <result property="weight" column="weight" />
  16. <result property="weightRange" column="weight_range" />
  17. <result property="weightFlag" column="weight_flag" />
  18. <result property="supplier" column="supplier" />
  19. <result property="supplierRange" column="supplier_range" />
  20. <result property="supplierFlag" column="supplier_flag" />
  21. <result property="locationFrom" column="location_from" />
  22. <result property="locationFromFlag" column="location_from_flag" />
  23. <result property="locationFromDevice" column="location_from_device" />
  24. <result property="locationFromStrategyFlag" column="location_from_strategy_flag" />
  25. <result property="locationTo" column="location_to" />
  26. <result property="locationToFlag" column="location_to_flag" />
  27. <result property="locationToDevice" column="location_to_device" />
  28. <result property="locationToStrategyFlag" column="location_to_strategy_flag" />
  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. <result property="remark" column="remark" />
  34. </resultMap>
  35. <resultMap type="FlowConfigHeader" id="FlowConfigHeaderVOResult">
  36. <result property="id" column="id" />
  37. <result property="flowName" column="flow_name" />
  38. <result property="flowType" column="flow_type" />
  39. <result property="skuType" column="sku_type" />
  40. <result property="skuTypeFlag" column="sku_type_flag" />
  41. <result property="qty" column="qty" />
  42. <result property="qtyRange" column="qty_range" />
  43. <result property="qtyFlag" column="qty_flag" />
  44. <result property="weight" column="weight" />
  45. <result property="weightRange" column="weight_range" />
  46. <result property="weightFlag" column="weight_flag" />
  47. <result property="supplier" column="supplier" />
  48. <result property="supplierRange" column="supplier_range" />
  49. <result property="supplierFlag" column="supplier_flag" />
  50. <result property="locationFrom" column="location_from" />
  51. <result property="locationFromFlag" column="location_from_flag" />
  52. <result property="locationFromDevice" column="location_from_device" />
  53. <result property="locationFromStrategyFlag" column="location_from_strategy_flag" />
  54. <result property="locationTo" column="location_to" />
  55. <result property="locationToFlag" column="location_to_flag" />
  56. <result property="locationToDevice" column="location_to_device" />
  57. <result property="locationToStrategyFlag" column="location_to_strategy_flag" />
  58. <result property="createBy" column="create_by" />
  59. <result property="createTime" column="create_time" />
  60. <result property="updateBy" column="update_by" />
  61. <result property="updateTime" column="update_time" />
  62. <result property="remark" column="remark" />
  63. </resultMap>
  64. <resultMap id="FlowConfigHeaderFlowConfigDetailsResult" type="flowConfigHeaderVO" extends="FlowConfigHeaderVOResult">
  65. <collection property="flowConfigDetailsList" notNullColumn="sub_id" javaType="java.util.List" resultMap="FlowConfigDetailsResult" />
  66. </resultMap>
  67. <resultMap type="flowConfigDetailsVO" id="FlowConfigDetailsResult">
  68. <result property="id" column="sub_id" />
  69. <result property="headerId" column="sub_header_id" />
  70. <result property="lotattId" column="sub_lotatt_id" />
  71. <result property="lotattName" column="sub_lotatt_name" />
  72. <result property="lotattFlag" column="sub_lotatt_flag" />
  73. <result property="createBy" column="sub_create_by" />
  74. <result property="createTime" column="sub_create_time" />
  75. <result property="updateBy" column="sub_update_by" />
  76. <result property="updateTime" column="sub_update_time" />
  77. <result property="remark" column="sub_remark" />
  78. </resultMap>
  79. <resultMap type="flowConfigLotattVO" id="FlowConfigLotattVOResult">
  80. <result property="lotattId" column="lotatt_id" />
  81. <result property="lotattFlag" column="lotatt_flag" />
  82. <result property="lotattName" column="lotatt_name" />
  83. <result property="inputType" column="input_type" />
  84. <result property="inputScope" column="input_scope" />
  85. <result property="lotattValue" column="lotatt_value" />
  86. </resultMap>
  87. <sql id="selectFlowConfigHeaderVo">
  88. select id, flow_name,flow_type, sku_type, sku_type_flag, qty, qty_flag, weight, weight_flag, supplier, supplier_flag, location_from,location_from_flag, location_from_device, location_to,location_to_flag, location_to_device, create_by, create_time, update_by, update_time, remark,location_from_strategy_flag ,location_to_strategy_flag from flow_config_header
  89. </sql>
  90. <select id="selectFlowConfigHeaderList" parameterType="FlowConfigHeader" resultMap="FlowConfigHeaderResult">
  91. <include refid="selectFlowConfigHeaderVo"/>
  92. <where>
  93. <if test="flowName != null and flowName != ''"> and flow_name like concat('%', #{flowName}, '%')</if>
  94. </where>
  95. </select>
  96. <select id="selectFlowConfigHeaderBy" parameterType="FlowConfigHeader" resultMap="FlowConfigHeaderResult">
  97. <include refid="selectFlowConfigHeaderVo"/>
  98. <where>
  99. <if test="flowName != null and flowName != ''"> and flow_name = #{flowName}</if>
  100. </where>
  101. </select>
  102. <select id="selectFlowConfigHeaderById" parameterType="Long" resultMap="FlowConfigHeaderFlowConfigDetailsResult">
  103. select a.id, a.flow_name,a.flow_type, a.sku_type, a.sku_type_flag, a.qty, a.qty_flag, a.weight, a.weight_flag, a.supplier, a.supplier_flag, a.location_from,a.location_from_flag, a.location_from_device, a.location_to,a.location_to_flag, a.location_to_device, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
  104. a.qty_range,a.weight_range,a.supplier_range,b.id as sub_id, b.header_id as sub_header_id, b.lotatt_id as sub_lotatt_id,cf.lotatt_name as sub_lotatt_name, b.lotatt_flag as sub_lotatt_flag, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark,
  105. a.location_from_strategy_flag,a.location_to_strategy_flag
  106. from flow_config_header a
  107. left join flow_config_details b on b.header_id = a.id
  108. left join lotatt_config cf on b.lotatt_id = cf.lotatt_id
  109. where a.id = #{id}
  110. </select>
  111. <insert id="insertFlowConfigHeader" parameterType="FlowConfigHeader" useGeneratedKeys="true" keyProperty="id">
  112. insert into flow_config_header
  113. <trim prefix="(" suffix=")" suffixOverrides=",">
  114. <if test="flowName != null">flow_name,</if>
  115. <if test="flowType != null">flow_type,</if>
  116. <if test="skuType != null">sku_type,</if>
  117. <if test="skuTypeFlag != null">sku_type_flag,</if>
  118. <if test="qty != null">qty,</if>
  119. <if test="qtyRange != null">qty_range,</if>
  120. <if test="qtyFlag != null">qty_flag,</if>
  121. <if test="weight != null">weight,</if>
  122. <if test="weightRange != null">weight_range,</if>
  123. <if test="weightFlag != null">weight_flag,</if>
  124. <if test="supplier != null">supplier,</if>
  125. <if test="supplierRange != null">supplier_range,</if>
  126. <if test="supplierFlag != null">supplier_flag,</if>
  127. <if test="locationFrom != null">location_from,</if>
  128. <if test="locationFromFlag != null">location_from_flag,</if>
  129. <if test="locationFromDevice != null">location_from_device,</if>
  130. <if test="locationFromStrategyFlag != null">location_from_strategy_flag,</if>
  131. <if test="locationTo != null">location_to,</if>
  132. <if test="locationToFlag != null">location_to_flag,</if>
  133. <if test="locationToDevice != null">location_to_device,</if>
  134. <if test="locationToStrategyFlag != null">location_to_strategy_flag,</if>
  135. <if test="createBy != null">create_by,</if>
  136. <if test="createTime != null">create_time,</if>
  137. <if test="updateBy != null">update_by,</if>
  138. <if test="updateTime != null">update_time,</if>
  139. <if test="remark != null">remark,</if>
  140. </trim>
  141. <trim prefix="values (" suffix=")" suffixOverrides=",">
  142. <if test="flowName != null">#{flowName},</if>
  143. <if test="flowType != null">#{flowType},</if>
  144. <if test="skuType != null">#{skuType},</if>
  145. <if test="skuTypeFlag != null">#{skuTypeFlag},</if>
  146. <if test="qty != null">#{qty},</if>
  147. <if test="qtyRange != null">#{qtyRange},</if>
  148. <if test="qtyFlag != null">#{qtyFlag},</if>
  149. <if test="weight != null">#{weight},</if>
  150. <if test="weightRange != null">#{weightRange},</if>
  151. <if test="weightFlag != null">#{weightFlag},</if>
  152. <if test="supplier != null">#{supplier},</if>
  153. <if test="supplierRange != null">#{supplierRange},</if>
  154. <if test="supplierFlag != null">#{supplierFlag},</if>
  155. <if test="locationFrom != null">#{locationFrom},</if>
  156. <if test="locationFromFlag != null">#{locationFromFlag},</if>
  157. <if test="locationFromDevice != null">#{locationFromDevice},</if>
  158. <if test="locationFromStrategyFlag != null">#{locationFromStrategyFlag},</if>
  159. <if test="locationTo != null">#{locationTo},</if>
  160. <if test="locationToFlag != null">#{locationToFlag},</if>
  161. <if test="locationToDevice != null">#{locationToDevice},</if>
  162. <if test="locationToStrategyFlag != null">#{locationToStrategyFlag},</if>
  163. <if test="createBy != null">#{createBy},</if>
  164. <if test="createTime != null">#{createTime},</if>
  165. <if test="updateBy != null">#{updateBy},</if>
  166. <if test="updateTime != null">#{updateTime},</if>
  167. <if test="remark != null">#{remark},</if>
  168. </trim>
  169. </insert>
  170. <update id="updateFlowConfigHeader" parameterType="FlowConfigHeader">
  171. update flow_config_header
  172. <trim prefix="SET" suffixOverrides=",">
  173. <if test="flowName != null">flow_name = #{flowName},</if>
  174. <if test="flowType != null">flow_type = #{flowType},</if>
  175. <if test="skuType != null">sku_type = #{skuType},</if>
  176. <if test="skuTypeFlag != null">sku_type_flag = #{skuTypeFlag},</if>
  177. <if test="qty != null">qty = #{qty},</if>
  178. <if test="qtyFlag != null">qty_flag = #{qtyFlag},</if>
  179. <if test="weight != null">weight = #{weight},</if>
  180. <if test="weightFlag != null">weight_flag = #{weightFlag},</if>
  181. <if test="supplier != null">supplier = #{supplier},</if>
  182. <if test="supplierFlag != null">supplier_flag = #{supplierFlag},</if>
  183. <if test="locationFrom != null">location_from = #{locationFrom},</if>
  184. <if test="locationFromFlag != null">location_from_flag = #{locationFromFlag},</if>
  185. <if test="locationFromDevice != null">location_from_device = #{locationFromDevice},</if>
  186. <if test="locationFromStrategyFlag != null">location_from_strategy_flag = #{locationFromStrategyFlag},</if>
  187. <if test="locationTo != null">location_to = #{locationTo},</if>
  188. <if test="locationToFlag != null">location_to_flag = #{locationToFlag},</if>
  189. <if test="locationToDevice != null">location_to_device = #{locationToDevice},</if>
  190. <if test="locationToStrategyFlag != null">location_to_strategy_flag = #{locationToStrategyFlag},</if>
  191. <if test="createBy != null">create_by = #{createBy},</if>
  192. <if test="createTime != null">create_time = #{createTime},</if>
  193. <if test="updateBy != null">update_by = #{updateBy},</if>
  194. <if test="updateTime != null">update_time = #{updateTime},</if>
  195. <if test="remark != null">remark = #{remark},</if>
  196. </trim>
  197. where id = #{id}
  198. </update>
  199. <delete id="deleteFlowConfigHeaderById" parameterType="Long">
  200. delete from flow_config_header where id = #{id}
  201. </delete>
  202. <delete id="deleteFlowConfigHeaderByIds" parameterType="String">
  203. delete from flow_config_header where id in
  204. <foreach item="id" collection="array" open="(" separator="," close=")">
  205. #{id}
  206. </foreach>
  207. </delete>
  208. <delete id="deleteFlowConfigDetailsByHeaderIds" parameterType="String">
  209. delete from flow_config_details where header_id in
  210. <foreach item="headerId" collection="array" open="(" separator="," close=")">
  211. #{headerId}
  212. </foreach>
  213. </delete>
  214. <delete id="deleteFlowConfigDetailsByHeaderId" parameterType="Long">
  215. delete from flow_config_details where header_id = #{headerId}
  216. </delete>
  217. <insert id="batchFlowConfigDetails">
  218. insert into flow_config_details( id, header_id, lotatt_id, lotatt_flag, create_by, create_time, update_by, update_time, remark) values
  219. <foreach item="item" index="index" collection="list" separator=",">
  220. ( #{item.id}, #{item.headerId}, #{item.lotattId}, #{item.lotattFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
  221. </foreach>
  222. </insert>
  223. <select id="selectLotattDetails" parameterType="Long" resultMap="FlowConfigLotattVOResult">
  224. select d.lotatt_id,d.lotatt_flag,l.lotatt_name,l.input_type,l.input_scope,l.default_value lotatt_value
  225. from flow_config_details d
  226. left join lotatt_config l on d.lotatt_id = l.lotatt_id
  227. where d.header_id = #{id} and d.lotatt_flag &lt;&gt; 'Hidden'
  228. </select>
  229. </mapper>