山东众工仓储管理系统后台程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

StoreMapper.xml 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.th.demo.mapping.ware.StoreMapper" >
  4. <resultMap id="BaseResultMap" type="com.th.demo.model.ware.Store" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="layer" property="layer" jdbcType="INTEGER" />
  7. <result column="model" property="model" jdbcType="VARCHAR" />
  8. <result column="plate_no" property="plateNo" jdbcType="VARCHAR" />
  9. <result column="count" property="count" jdbcType="DOUBLE" />
  10. <result column="weight" property="weight" jdbcType="DOUBLE" />
  11. <result column="remark" property="remark" jdbcType="VARCHAR" />
  12. <result column="add_id" property="addId" jdbcType="VARCHAR" />
  13. <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
  14. <result column="modify_id" property="modifyId" jdbcType="VARCHAR" />
  15. <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
  16. <result column="cancel_id" property="cancelId" jdbcType="VARCHAR" />
  17. <result column="cancel_time" property="cancelTime" jdbcType="TIMESTAMP" />
  18. <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
  19. <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
  20. <result column="in_id" property="inId" jdbcType="VARCHAR" />
  21. <result column="out_id" property="outId" jdbcType="VARCHAR" />
  22. <result column="receive_address" property="receiveAddress" jdbcType="VARCHAR" />
  23. <result column="out_flag" property="outFlag" jdbcType="VARCHAR" />
  24. <result column="lock_flag" property="lockFlag" jdbcType="VARCHAR" />
  25. <result column="wgt_dcn_mtc_cd" property="wgtDcnMtcCd" jdbcType="VARCHAR" />
  26. <result column="edge_ty" property="edgeTy" jdbcType="VARCHAR" />
  27. <result column="production_place" property="productionPlace" jdbcType="VARCHAR" />
  28. <result column="ord_no" property="ordNo" jdbcType="VARCHAR" />
  29. <result column="car_no" property="carNo" jdbcType="VARCHAR" />
  30. <result column="tally_people" property="tallyPeople" jdbcType="VARCHAR" />
  31. <result column="fk_compony_id" property="fkComponyId" jdbcType="VARCHAR" />
  32. <result column="pack_no" property="packNo" jdbcType="VARCHAR" />
  33. <result column="contract_no" property="contractNo" jdbcType="VARCHAR" />
  34. <result column="attrib_01" property="attrib01" jdbcType="VARCHAR" />
  35. <result column="attrib_02" property="attrib02" jdbcType="VARCHAR" />
  36. <result column="attrib_03" property="attrib03" jdbcType="VARCHAR" />
  37. <result column="attrib_04" property="attrib04" jdbcType="VARCHAR" />
  38. <result column="attrib_05" property="attrib05" jdbcType="VARCHAR" />
  39. <result column="attrib_06" property="attrib06" jdbcType="VARCHAR" />
  40. <result column="attrib_07" property="attrib07" jdbcType="VARCHAR" />
  41. <result column="attrib_08" property="attrib08" jdbcType="VARCHAR" />
  42. <result column="attrib_09" property="attrib09" jdbcType="VARCHAR" />
  43. <result column="attrib_10" property="attrib10" jdbcType="VARCHAR" />
  44. <result column="fk_customer_name" property="fkCustomerName" jdbcType="VARCHAR" />
  45. <result column="invoice_price" property="invoicePrice" jdbcType="DOUBLE" />
  46. <result column="keep_day" property="keepDay" jdbcType="DOUBLE" />
  47. <result column="ord_price" property="ordPrice" jdbcType="DOUBLE" />
  48. <result column="out_ord_price" property="outOrdPrice" jdbcType="DOUBLE" />
  49. <result column="inware_day" property="inwareDay" jdbcType="DOUBLE" />
  50. <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
  51. <result column="change_count" property="changeCount" jdbcType="DOUBLE" />
  52. <result column="out_bound" property="outBound" jdbcType="VARCHAR" />
  53. <association column="ware_id" property="ware" select="com.th.demo.mapping.maint.WareMapper.selectByPrimaryKey" />
  54. <association column="stack_id" property="stack" select="com.th.demo.mapping.maint.StackMapper.selectByPrimaryKey" />
  55. <association column="material_id" property="material" select="com.th.demo.mapping.maint.MaterialMapper.selectByPrimaryKey" />
  56. <association column="customer_id" property="customer" select="com.th.demo.mapping.maint.CustomerMapper.selectByPrimaryKey" />
  57. <association column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
  58. </resultMap>
  59. <resultMap id="StoreOfWareStack" type="com.th.demo.model.ware.StoreOfWareStack" >
  60. <result column="ware_id" property="wareId" jdbcType="VARCHAR" />
  61. <result column="stack_id" property="stackId" jdbcType="VARCHAR" />
  62. </resultMap>
  63. <resultMap id="TotalResultMap" type="com.th.demo.model.ware.TotalRecord">
  64. <result column="total_amount" property="totalAmount" jdbcType="DOUBLE" />
  65. <result column="total_weight" property="totalWeight" jdbcType="DOUBLE" />
  66. </resultMap>
  67. <sql id="Base_Column_List" >
  68. id, ware_id, stack_id, layer, material_id, model, plate_no, customer_id, count, weight,
  69. remark, add_id, add_time, modify_id, modify_time, cancel_id, cancel_time, cancel_flag,
  70. belong_id, in_id, out_id, receive_address, out_flag, lock_flag,wgt_dcn_mtc_cd,edge_ty,production_place,
  71. pack_no,contract_no,attrib_01,attrib_02,attrib_03,attrib_04,attrib_05,attrib_06,attrib_07,attrib_08,attrib_09,attrib_10,
  72. keep_day,ord_price,out_ord_price,pay_way
  73. </sql>
  74. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  75. select
  76. *
  77. from t_ware_store
  78. where id = #{id,jdbcType=VARCHAR}
  79. </select>
  80. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  81. delete from t_ware_store
  82. where id = #{id,jdbcType=VARCHAR}
  83. </delete>
  84. <insert id="insert" parameterType="com.th.demo.model.ware.Store" >
  85. <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
  86. SELECT REPLACE(UUID(),'-','') as id from dual
  87. </selectKey>
  88. insert into t_ware_store (id, ware_id, stack_id,
  89. layer, material_id, model,
  90. plate_no, customer_id, count,
  91. weight, remark, add_id,
  92. add_time, modify_id, modify_time,
  93. cancel_id, cancel_time, cancel_flag,
  94. belong_id, in_id, out_id,
  95. receive_address, out_flag, lock_flag
  96. ,wgt_dcn_mtc_cd,edge_ty,production_place,ord_no
  97. ,car_no,tally_people,fk_compony_id,invoice_price,
  98. pack_no,contract_no,attrib_01,attrib_02,attrib_03,
  99. attrib_04,attrib_05,attrib_06,attrib_07,attrib_08,
  100. attrib_09,attrib_10,keep_day,ord_price,out_ord_price,pay_way
  101. )
  102. values (#{id,jdbcType=VARCHAR}, #{ware.id,jdbcType=VARCHAR}, #{stack.id,jdbcType=VARCHAR},
  103. #{layer,jdbcType=INTEGER}, #{material.id,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR},
  104. #{plateNo,jdbcType=VARCHAR}, #{customer.id,jdbcType=VARCHAR}, #{count,jdbcType=DOUBLE},
  105. #{weight,jdbcType=DOUBLE}, #{remark,jdbcType=VARCHAR}, #{addId,jdbcType=VARCHAR},
  106. #{addTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
  107. #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR},
  108. #{belongId,jdbcType=VARCHAR}, #{inId,jdbcType=VARCHAR}, #{outId,jdbcType=VARCHAR},
  109. #{receiveAddress,jdbcType=VARCHAR}, #{outFlag,jdbcType=VARCHAR}, #{lockFlag,jdbcType=VARCHAR}
  110. ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR},#{ordNo,jdbcType=VARCHAR}
  111. ,#{carNo,jdbcType=VARCHAR},#{tallyPeople,jdbcType=VARCHAR},#{fkComponyId,jdbcType=VARCHAR},#{invoicePrice,jdbcType=DOUBLE},
  112. #{packNo,jdbcType=VARCHAR},#{contractNo,jdbcType=VARCHAR},#{attrib01,jdbcType=VARCHAR},#{attrib02,jdbcType=VARCHAR},#{attrib03,jdbcType=VARCHAR},
  113. #{attrib04,jdbcType=VARCHAR},#{attrib05,jdbcType=VARCHAR},#{attrib06,jdbcType=VARCHAR},#{attrib07,jdbcType=VARCHAR},#{attrib08,jdbcType=VARCHAR},
  114. #{attrib09,jdbcType=VARCHAR},#{attrib10,jdbcType=VARCHAR},#{keepDay,jdbcType=DOUBLE},#{ordPrice,jdbcType=DOUBLE},#{outOrdPrice,jdbcType=DOUBLE},#{payWay,jdbcType=VARCHAR}
  115. )
  116. </insert>
  117. <insert id="insertSelective" parameterType="com.th.demo.model.ware.Store" >
  118. insert into t_ware_store
  119. <trim prefix="(" suffix=")" suffixOverrides="," >
  120. <if test="id != null" >
  121. id,
  122. </if>
  123. <if test="wareName != null" >
  124. ware_name,
  125. </if>
  126. <if test="stackName != null" >
  127. stack_name,
  128. </if>
  129. <if test="layer != null" >
  130. layer,
  131. </if>
  132. <if test="materialName != null" >
  133. material_name,
  134. </if>
  135. <if test="materialNo != null" >
  136. material_no,
  137. </if>
  138. <if test="standard != null" >
  139. standard,
  140. </if>
  141. <if test="model != null" >
  142. model,
  143. </if>
  144. <if test="customerName != null" >
  145. customer_name,
  146. </if>
  147. <if test="customerNo != null" >
  148. customer_no,
  149. </if>
  150. <if test="count != null" >
  151. count,
  152. </if>
  153. <if test="weight != null" >
  154. weight,
  155. </if>
  156. <if test="remark != null" >
  157. remark,
  158. </if>
  159. <if test="addId != null" >
  160. add_id,
  161. </if>
  162. <if test="addTime != null" >
  163. add_time,
  164. </if>
  165. <if test="modifyId != null" >
  166. modify_id,
  167. </if>
  168. <if test="modifyTime != null" >
  169. modify_time,
  170. </if>
  171. <if test="cancelId != null" >
  172. cancel_id,
  173. </if>
  174. <if test="cancelTime != null" >
  175. cancel_time,
  176. </if>
  177. <if test="cancelFlag != null" >
  178. cancel_flag,
  179. </if>
  180. <if test="belongId != null" >
  181. belong_id,
  182. </if>
  183. </trim>
  184. <trim prefix="values (" suffix=")" suffixOverrides="," >
  185. <if test="id != null" >
  186. #{id,jdbcType=VARCHAR},
  187. </if>
  188. <if test="wareName != null" >
  189. #{wareName,jdbcType=VARCHAR},
  190. </if>
  191. <if test="stackName != null" >
  192. #{stackName,jdbcType=VARCHAR},
  193. </if>
  194. <if test="layer != null" >
  195. #{layer,jdbcType=INTEGER},
  196. </if>
  197. <if test="materialName != null" >
  198. #{materialName,jdbcType=VARCHAR},
  199. </if>
  200. <if test="materialNo != null" >
  201. #{materialNo,jdbcType=VARCHAR},
  202. </if>
  203. <if test="standard != null" >
  204. #{standard,jdbcType=VARCHAR},
  205. </if>
  206. <if test="model != null" >
  207. #{model,jdbcType=VARCHAR},
  208. </if>
  209. <if test="customerName != null" >
  210. #{customerName,jdbcType=VARCHAR},
  211. </if>
  212. <if test="customerNo != null" >
  213. #{customerNo,jdbcType=VARCHAR},
  214. </if>
  215. <if test="count != null" >
  216. #{count,jdbcType=DOUBLE},
  217. </if>
  218. <if test="weight != null" >
  219. #{weight,jdbcType=DOUBLE},
  220. </if>
  221. <if test="remark != null" >
  222. #{remark,jdbcType=VARCHAR},
  223. </if>
  224. <if test="addId != null" >
  225. #{addId,jdbcType=VARCHAR},
  226. </if>
  227. <if test="addTime != null" >
  228. #{addTime,jdbcType=TIMESTAMP},
  229. </if>
  230. <if test="modifyId != null" >
  231. #{modifyId,jdbcType=VARCHAR},
  232. </if>
  233. <if test="modifyTime != null" >
  234. #{modifyTime,jdbcType=TIMESTAMP},
  235. </if>
  236. <if test="cancelId != null" >
  237. #{cancelId,jdbcType=VARCHAR},
  238. </if>
  239. <if test="cancelTime != null" >
  240. #{cancelTime,jdbcType=TIMESTAMP},
  241. </if>
  242. <if test="cancelFlag != null" >
  243. #{cancelFlag,jdbcType=VARCHAR},
  244. </if>
  245. <if test="belongId != null" >
  246. #{belongId,jdbcType=VARCHAR},
  247. </if>
  248. </trim>
  249. </insert>
  250. <update id="updateByPrimaryKeySelective" parameterType="com.th.demo.model.ware.Store" >
  251. update t_ware_store
  252. <set >
  253. <if test="wareName != null" >
  254. ware_name = #{wareName,jdbcType=VARCHAR},
  255. </if>
  256. <if test="stackName != null" >
  257. stack_name = #{stackName,jdbcType=VARCHAR},
  258. </if>
  259. <if test="layer != null" >
  260. layer = #{layer,jdbcType=INTEGER},
  261. </if>
  262. <if test="materialName != null" >
  263. material_name = #{materialName,jdbcType=VARCHAR},
  264. </if>
  265. <if test="materialNo != null" >
  266. material_no = #{materialNo,jdbcType=VARCHAR},
  267. </if>
  268. <if test="standard != null" >
  269. standard = #{standard,jdbcType=VARCHAR},
  270. </if>
  271. <if test="model != null" >
  272. model = #{model,jdbcType=VARCHAR},
  273. </if>
  274. <if test="customerName != null" >
  275. customer_name = #{customerName,jdbcType=VARCHAR},
  276. </if>
  277. <if test="customerNo != null" >
  278. customer_no = #{customerNo,jdbcType=VARCHAR},
  279. </if>
  280. <if test="count != null" >
  281. count = #{count,jdbcType=DOUBLE},
  282. </if>
  283. <if test="weight != null" >
  284. weight = #{weight,jdbcType=DOUBLE},
  285. </if>
  286. <if test="remark != null" >
  287. remark = #{remark,jdbcType=VARCHAR},
  288. </if>
  289. <if test="addId != null" >
  290. add_id = #{addId,jdbcType=VARCHAR},
  291. </if>
  292. <if test="addTime != null" >
  293. add_time = #{addTime,jdbcType=TIMESTAMP},
  294. </if>
  295. <if test="modifyId != null" >
  296. modify_id = #{modifyId,jdbcType=VARCHAR},
  297. </if>
  298. <if test="modifyTime != null" >
  299. modify_time = #{modifyTime,jdbcType=TIMESTAMP},
  300. </if>
  301. <if test="cancelId != null" >
  302. cancel_id = #{cancelId,jdbcType=VARCHAR},
  303. </if>
  304. <if test="cancelTime != null" >
  305. cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
  306. </if>
  307. <if test="cancelFlag != null" >
  308. cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
  309. </if>
  310. <if test="belongId != null" >
  311. belong_id = #{belongId,jdbcType=VARCHAR},
  312. </if>
  313. </set>
  314. where id = #{id,jdbcType=VARCHAR}
  315. </update>
  316. <update id="updateByPrimaryKey" parameterType="com.th.demo.model.ware.Store" >
  317. update t_ware_store
  318. set ware_id = #{ware.id,jdbcType=VARCHAR},
  319. stack_id = #{stack.id,jdbcType=VARCHAR},
  320. layer = #{layer,jdbcType=INTEGER},
  321. material_id = #{material.id,jdbcType=VARCHAR},
  322. model = #{model,jdbcType=VARCHAR},
  323. plate_no = #{plateNo,jdbcType=VARCHAR},
  324. customer_id = #{customer.id,jdbcType=VARCHAR},
  325. count = #{count,jdbcType=DOUBLE},
  326. weight = #{weight,jdbcType=DOUBLE},
  327. remark = #{remark,jdbcType=VARCHAR},
  328. add_id = #{addId,jdbcType=VARCHAR},
  329. add_time = #{addTime,jdbcType=TIMESTAMP},
  330. modify_id = #{modifyId,jdbcType=VARCHAR},
  331. modify_time = #{modifyTime,jdbcType=TIMESTAMP},
  332. cancel_id = #{cancelId,jdbcType=VARCHAR},
  333. cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
  334. cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
  335. belong_id = #{belongId,jdbcType=VARCHAR},
  336. in_id = #{inId,jdbcType=VARCHAR},
  337. out_id = #{outId,jdbcType=VARCHAR},
  338. receive_address = #{receiveAddress,jdbcType=VARCHAR},
  339. out_flag = #{outFlag,jdbcType=VARCHAR},
  340. lock_flag = #{lockFlag,jdbcType=VARCHAR},
  341. pack_no = #{packNo,jdbcType=VARCHAR},
  342. contract_no = #{contractNo,jdbcType=VARCHAR},
  343. attrib_01 = #{attrib01,jdbcType=VARCHAR},
  344. attrib_02 = #{attrib02,jdbcType=VARCHAR},
  345. attrib_03 = #{attrib03,jdbcType=VARCHAR},
  346. attrib_04 = #{attrib04,jdbcType=VARCHAR},
  347. attrib_05 = #{attrib05,jdbcType=VARCHAR},
  348. attrib_06 = #{attrib06,jdbcType=VARCHAR},
  349. attrib_07 = #{attrib07,jdbcType=VARCHAR},
  350. attrib_08 = #{attrib08,jdbcType=VARCHAR},
  351. attrib_09 = #{attrib09,jdbcType=VARCHAR},
  352. attrib_10 = #{attrib10,jdbcType=VARCHAR},
  353. keep_day = #{keepDay,jdbcType=DOUBLE},
  354. ord_price = #{ordPrice,jdbcType=DOUBLE},
  355. out_ord_price = #{outOrdPrice,jdbcType=DOUBLE},
  356. pay_way = #{payWay,jdbcType=VARCHAR},
  357. ord_no= #{ordNo,jdbcType=VARCHAR},
  358. production_place= #{productionPlace,jdbcType=VARCHAR}
  359. where id = #{id,jdbcType=VARCHAR}
  360. </update>
  361. <update id="updateFKByPKey" parameterType="com.th.demo.model.ware.Store" >
  362. update t_ware_store
  363. set customer_id = #{customer.id,jdbcType=VARCHAR},
  364. fk_compony_id = #{fkComponyId,jdbcType=VARCHAR},
  365. receive_address = #{receiveAddress,jdbcType=VARCHAR},
  366. change_count = #{changeCount,jdbcType=DOUBLE}
  367. where id = #{id,jdbcType=VARCHAR}
  368. </update>
  369. <select id="selectLayerByStackId" resultType="java.lang.String" >
  370. SELECT ifnull(max(t.layer),0) from t_ware_store t
  371. where t.stack_id =#{param1,jdbcType=VARCHAR}
  372. and t.belong_id = #{param2,jdbcType=VARCHAR}
  373. and ifnull(t.cancel_flag,'0') = '0'
  374. and ifnull(t.out_flag,'0') = '0'
  375. </select>
  376. <select id="selectByWareIdStackId" resultMap="BaseResultMap" >
  377. SELECT b.name as fk_compony_id,t.* from t_ware_store t left join t_maint_customer b
  378. on t.fk_compony_id = b.id
  379. where t.ware_id = #{param1,jdbcType=VARCHAR}
  380. and t.stack_id = #{param2,jdbcType=VARCHAR}
  381. and t.belong_id = #{param3,jdbcType=VARCHAR}
  382. and ifnull(t.cancel_flag,'0') = '0'
  383. and ifnull(t.out_flag,'0') = '0'
  384. order by layer desc
  385. </select>
  386. <select id="select" resultMap="BaseResultMap" >
  387. select t.* from t_ware_store t where 1=1 and t.belong_id = #{param4,jdbcType=VARCHAR}
  388. <if test="param1 != ''" >
  389. and t.ware_id = #{param1,jdbcType=VARCHAR}
  390. </if>
  391. <if test="param2 != ''" >
  392. and t.stack_id = #{param2,jdbcType=VARCHAR}
  393. </if>
  394. and ifnull(t.cancel_flag,'0') = '0'
  395. and ifnull(t.out_flag,'0') = '0'
  396. order by t.stack_id asc , t.layer asc
  397. </select>
  398. <select id="selectForUpDown" resultMap="BaseResultMap" >
  399. select t.* from t_ware_store t
  400. where t.ware_id in (
  401. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  402. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  403. and t.ware_id = #{param1,jdbcType=VARCHAR}
  404. and t.stack_id = #{param2,jdbcType=VARCHAR}
  405. and t.layer &gt;= #{param5,jdbcType=INTEGER}
  406. and t.layer &lt;= #{param6,jdbcType=INTEGER}
  407. and ifnull(t.cancel_flag,'0') = '0'
  408. and ifnull(t.out_flag,'0') = '0'
  409. </select>
  410. <update id="updateForUpDownByStep" >
  411. update t_ware_store t set t.layer = t.layer + #{param7,jdbcType=INTEGER}
  412. where t.ware_id in (
  413. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  414. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  415. and t.ware_id = #{param1,jdbcType=VARCHAR}
  416. and t.stack_id = #{param2,jdbcType=VARCHAR}
  417. and t.layer &gt;= #{param5,jdbcType=INTEGER}
  418. and t.layer &lt;= #{param6,jdbcType=INTEGER}
  419. and ifnull(t.cancel_flag,'0') = '0'
  420. and ifnull(t.out_flag,'0') = '0'
  421. </update>
  422. <update id="updateForUpDownByLayer" >
  423. update t_ware_store t set t.layer = #{param7,jdbcType=INTEGER}
  424. where t.ware_id in (
  425. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  426. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  427. and t.ware_id = #{param1,jdbcType=VARCHAR}
  428. and t.stack_id = #{param2,jdbcType=VARCHAR}
  429. and t.layer &gt;= #{param5,jdbcType=INTEGER}
  430. and t.layer &lt;= #{param6,jdbcType=INTEGER}
  431. and ifnull(t.cancel_flag,'0') = '0'
  432. and ifnull(t.out_flag,'0') = '0'
  433. </update>
  434. <select id="selectByOutId" resultMap="BaseResultMap" >
  435. select t.* from t_ware_store t
  436. where t.ware_id in (
  437. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  438. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  439. and t.out_id = #{param1,jdbcType=VARCHAR}
  440. </select>
  441. <update id="updateByOutId" >
  442. update t_ware_store t set t.cancel_flag = '1'
  443. where t.ware_id in (
  444. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  445. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  446. and t.out_id = #{param1,jdbcType=VARCHAR}
  447. and t.cancel_flag = '0'
  448. </update>
  449. <select id="selectStore" resultMap="BaseResultMap" >
  450. select e.name as fk_customer_name,DATEDIFF(now(), t.add_time) + IF(TIME(now()) > TIME(t.add_time), 1, 0) as inware_day,t.*
  451. from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d,t_maint_customer e
  452. where t.ware_id = a.id
  453. and t.stack_id = b.id
  454. and t.material_id = c.id
  455. and t.customer_id = d.id
  456. and t.fk_compony_id = e.id
  457. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  458. and b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  459. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  460. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  461. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  462. <if test="param6 != null and param6 != ''">
  463. and ifnull(d.name,'*') = #{param6,jdbcType=VARCHAR}
  464. </if>
  465. <if test="param9 != null and param9 != ''">
  466. and ifnull(e.name,'*') = #{param9,jdbcType=VARCHAR}
  467. </if>
  468. and (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
  469. <if test="param13 != null and param13.size() !=0" >
  470. or t.plate_no IN <foreach item="item" collection="param13" index="index" open="(" separator="," close=")">
  471. #{item,jdbcType=VARCHAR} </foreach>
  472. </if>
  473. )
  474. and (t.ord_no like concat('%',#{param11,jdbcType=VARCHAR},'%')
  475. <if test="param14 != null and param14.size() !=0" >
  476. OR t.ord_no IN <foreach item="item" collection="param14" index="index" open="(" separator="," close=")">
  477. #{item,jdbcType=VARCHAR} </foreach>
  478. </if>
  479. )
  480. and (t.contract_no like concat('%',#{param12,jdbcType=VARCHAR},'%')
  481. <if test="param15 != null and param15.size() !=0" >
  482. OR t.contract_no IN <foreach item="item" collection="param15" index="index" open="(" separator="," close=")">
  483. #{item,jdbcType=VARCHAR} </foreach>
  484. </if>
  485. )
  486. and (t.pack_no like concat('%',#{param16,jdbcType=VARCHAR},'%')
  487. <if test="param17 != null and param17.size() !=0" >
  488. OR t.pack_no IN <foreach item="item" collection="param17" index="index" open="(" separator="," close=")">
  489. #{item,jdbcType=VARCHAR} </foreach>
  490. </if>
  491. )
  492. and t.belong_id = #{param8,jdbcType=VARCHAR}
  493. and t.cancel_flag = '0'
  494. and t.out_flag = #{param18,jdbcType=VARCHAR}
  495. <if test="param19 != null and param19 !=''">
  496. and t.lock_flag = #{param19,jdbcType=VARCHAR}
  497. </if>
  498. <if test="param20 != null and param20 !=''">
  499. and t.out_bound = #{param20,jdbcType=VARCHAR}
  500. </if>
  501. <if test="param21 != null and param22 != null">
  502. and t.add_time between #{param21,jdbcType=TIMESTAMP} and #{param22,jdbcType=TIMESTAMP}
  503. </if>
  504. and t.ware_id in (
  505. select m.ware_id from t_maint_userware m where m.user_id = #{param7,jdbcType=VARCHAR}
  506. )
  507. order by b.code,t.layer desc
  508. </select>
  509. <select id="selectStoreTotal" resultMap="TotalResultMap" >
  510. select sum(t.count) as total_amount
  511. ,sum(t.weight) as total_weight
  512. from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d,t_maint_customer e
  513. where t.ware_id = a.id
  514. and t.stack_id = b.id
  515. and t.material_id = c.id
  516. and t.customer_id = d.id
  517. and t.fk_compony_id = e.id
  518. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  519. and b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  520. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  521. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  522. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  523. <if test="param6 != null and param6 != ''">
  524. and ifnull(d.name,'*') = #{param6,jdbcType=VARCHAR}
  525. </if>
  526. <if test="param9 != null and param9 != ''">
  527. and ifnull(e.name,'*') = #{param9,jdbcType=VARCHAR}
  528. </if>
  529. and (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
  530. <if test="param13 != null and param13.size() !=0" >
  531. or t.plate_no IN <foreach item="item" collection="param13" index="index" open="(" separator="," close=")">
  532. #{item,jdbcType=VARCHAR} </foreach>
  533. </if>
  534. )
  535. and (t.ord_no like concat('%',#{param11,jdbcType=VARCHAR},'%')
  536. <if test="param14 != null and param14.size() !=0" >
  537. OR t.ord_no IN <foreach item="item" collection="param14" index="index" open="(" separator="," close=")">
  538. #{item,jdbcType=VARCHAR} </foreach>
  539. </if>
  540. )
  541. and (t.contract_no like concat('%',#{param12,jdbcType=VARCHAR},'%')
  542. <if test="param15 != null and param15.size() !=0" >
  543. OR t.contract_no IN <foreach item="item" collection="param15" index="index" open="(" separator="," close=")">
  544. #{item,jdbcType=VARCHAR} </foreach>
  545. </if>
  546. )
  547. and (t.pack_no like concat('%',#{param16,jdbcType=VARCHAR},'%')
  548. <if test="param17 != null and param17.size() !=0" >
  549. OR t.pack_no IN <foreach item="item" collection="param17" index="index" open="(" separator="," close=")">
  550. #{item,jdbcType=VARCHAR} </foreach>
  551. </if>
  552. )
  553. and t.belong_id = #{param8,jdbcType=VARCHAR}
  554. and t.cancel_flag = '0'
  555. and t.out_flag = #{param18,jdbcType=VARCHAR}
  556. <if test="param19 != null and param19 != ''">
  557. and t.lock_flag = #{param19,jdbcType=VARCHAR}
  558. </if>
  559. <if test="param20 != null and param20 !=''">
  560. and t.out_bound = #{param20,jdbcType=VARCHAR}
  561. </if>
  562. <if test="param21 != null and param22 != null">
  563. and t.add_time between #{param21,jdbcType=TIMESTAMP} and #{param22,jdbcType=TIMESTAMP}
  564. </if>
  565. and t.ware_id in (
  566. select m.ware_id from t_maint_userware m where m.user_id = #{param7,jdbcType=VARCHAR}
  567. )
  568. order by b.code,t.layer desc
  569. </select>
  570. <select id="selectWareStackByDistributionStore" resultMap="StoreOfWareStack" >
  571. select distinct t.ware_id ,t.stack_id
  572. from t_ware_store t where t.id in
  573. <foreach item="item" index="index" collection="storeId"
  574. open="(" separator="," close=")">
  575. #{item}
  576. </foreach>
  577. </select>
  578. <select id="selectByWareIdStackIdInStoreId" resultMap="BaseResultMap" >
  579. select *
  580. from t_ware_store t where t.id in
  581. <foreach item="item" index="index" collection="storeId"
  582. open="(" separator="," close=")">
  583. #{item}
  584. </foreach>
  585. and t.ware_id like concat('%',#{wareId,jdbcType=VARCHAR},'%')
  586. and t.stack_id like concat('%',#{stackId,jdbcType=VARCHAR},'%')
  587. </select>
  588. <update id="updateDistributionById" >
  589. update t_ware_store t
  590. set t.lock_flag = #{lockFlag,jdbcType=VARCHAR} where t.id in
  591. <foreach item="item" index="index" collection="storeId"
  592. open="(" separator="," close=")">
  593. #{item}
  594. </foreach>
  595. </update>
  596. <select id="selectForCustomer" resultMap="BaseResultMap" >
  597. select e.name as fk_compony_id,t.*
  598. from t_ware_store t left join t_maint_customer e
  599. on t.fk_compony_id = e.id
  600. , t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d
  601. where t.ware_id = a.id
  602. and t.stack_id = b.id
  603. and t.material_id = c.id
  604. and t.customer_id = d.id
  605. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  606. and b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  607. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  608. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  609. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  610. <if test="param6 != null and param6 != ''" >
  611. and d.name = #{param6,jdbcType=VARCHAR}
  612. </if>
  613. and t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
  614. and t.cancel_flag = '0'
  615. and t.out_flag = '0'
  616. and IFNULL(t.ord_no,'*') like concat('%',#{param11,jdbcType=VARCHAR},'%')
  617. and d.name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%')
  618. </select>
  619. <select id="queryTotal" resultMap="TotalResultMap" >
  620. select sum(t.weight) as total_weight,
  621. sum(t.count) as total_amount
  622. from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d
  623. where t.ware_id = a.id
  624. and t.stack_id = b.id
  625. and t.material_id = c.id
  626. and t.customer_id = d.id
  627. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  628. and b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  629. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  630. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  631. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  632. <if test="param6 != null and param6 != ''">
  633. and ifnull(d.name,'*') = #{param6,jdbcType=VARCHAR}
  634. </if>
  635. <if test="param9 != null and param9 != ''">
  636. and ifnull(e.name,'*') = #{param9,jdbcType=VARCHAR}
  637. </if>
  638. and t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
  639. and t.cancel_flag = '0'
  640. and t.out_flag = '0'
  641. and IFNULL(t.ord_no,'*') like concat('%',#{param11,jdbcType=VARCHAR},'%')
  642. and d.name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%')
  643. </select>
  644. <select id="selEffStore" resultType="java.lang.Integer" parameterType="java.lang.String">
  645. select count(*)
  646. from t_ware_store t
  647. where t.cancel_flag = '0'
  648. and t.out_flag = '0'
  649. and t.plate_no = #{param1,jdbcType=VARCHAR};
  650. </select>
  651. <update id="updateOutBoundByPrimaryKey" parameterType="com.th.demo.model.ware.Store" >
  652. update t_ware_store t
  653. set t.out_bound = #{outBound,jdbcType=VARCHAR} where t.id = #{id,jdbcType=VARCHAR}
  654. </update>
  655. </mapper>