FlowConfigHeaderMapper.xml 16 KB

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