明晋临时用仓库程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

StoreMapper.xml 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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="remark1" property="remark1" jdbcType="VARCHAR" />
  33. <result column="invoice_price" property="invoicePrice" jdbcType="DOUBLE" />
  34. <result column="contract_no" property="contractNo" jdbcType="VARCHAR" />
  35. <association column="ware_id" property="ware" select="com.th.demo.mapping.maint.WareMapper.selectByPrimaryKey" />
  36. <association column="stack_id" property="stack" select="com.th.demo.mapping.maint.StackMapper.selectByPrimaryKey" />
  37. <association column="material_id" property="material" select="com.th.demo.mapping.maint.MaterialMapper.selectByPrimaryKey" />
  38. <association column="customer_id" property="customer" select="com.th.demo.mapping.maint.CustomerMapper.selectByPrimaryKey" />
  39. <association column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
  40. </resultMap>
  41. <resultMap id="StoreOfWareStack" type="com.th.demo.model.ware.StoreOfWareStack" >
  42. <result column="ware_id" property="wareId" jdbcType="VARCHAR" />
  43. <result column="stack_id" property="stackId" jdbcType="VARCHAR" />
  44. </resultMap>
  45. <resultMap id="TotalResultMap" type="com.th.demo.model.ware.TotalRecord">
  46. <result column="total_amount" property="totalAmount" jdbcType="DOUBLE" />
  47. <result column="total_weight" property="totalWeight" jdbcType="DOUBLE" />
  48. </resultMap>
  49. <sql id="Base_Column_List" >
  50. id, ware_id, stack_id, layer, material_id, model, plate_no, customer_id, count, weight,
  51. remark, add_id, add_time, modify_id, modify_time, cancel_id, cancel_time, cancel_flag,
  52. belong_id, in_id, out_id, receive_address, out_flag, lock_flag,wgt_dcn_mtc_cd,edge_ty,
  53. production_place,contract_no,remark1
  54. </sql>
  55. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  56. select
  57. <include refid="Base_Column_List" />
  58. from t_ware_store
  59. where id = #{id,jdbcType=VARCHAR}
  60. </select>
  61. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  62. delete from t_ware_store
  63. where id = #{id,jdbcType=VARCHAR}
  64. </delete>
  65. <insert id="insert" parameterType="com.th.demo.model.ware.Store" >
  66. <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
  67. SELECT REPLACE(UUID(),'-','') as id from dual
  68. </selectKey>
  69. insert into t_ware_store (id, ware_id, stack_id,
  70. layer, material_id, model,
  71. plate_no, customer_id, count,
  72. weight, remark, add_id,
  73. add_time, modify_id, modify_time,
  74. cancel_id, cancel_time, cancel_flag,
  75. belong_id, in_id, out_id,
  76. receive_address, out_flag, lock_flag
  77. ,wgt_dcn_mtc_cd,edge_ty,production_place,ord_no
  78. ,car_no,tally_people,fk_compony_id,invoice_price,contract_no,remark1
  79. )
  80. values (#{id,jdbcType=VARCHAR}, #{ware.id,jdbcType=VARCHAR}, #{stack.id,jdbcType=VARCHAR},
  81. #{layer,jdbcType=INTEGER}, #{material.id,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR},
  82. #{plateNo,jdbcType=VARCHAR}, #{customer.id,jdbcType=VARCHAR}, #{count,jdbcType=DOUBLE},
  83. #{weight,jdbcType=DOUBLE}, #{remark,jdbcType=VARCHAR}, #{addId,jdbcType=VARCHAR},
  84. #{addTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
  85. #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR},
  86. #{belongId,jdbcType=VARCHAR}, #{inId,jdbcType=VARCHAR}, #{outId,jdbcType=VARCHAR},
  87. #{receiveAddress,jdbcType=VARCHAR}, #{outFlag,jdbcType=VARCHAR}, #{lockFlag,jdbcType=VARCHAR}
  88. ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR},#{ordNo,jdbcType=VARCHAR}
  89. ,#{carNo,jdbcType=VARCHAR},#{tallyPeople,jdbcType=VARCHAR},#{fkComponyId,jdbcType=VARCHAR},#{invoicePrice,jdbcType=DOUBLE},#{contractNo,jdbcType=VARCHAR}
  90. ,#{remark1,jdbcType=VARCHAR}
  91. )
  92. </insert>
  93. <insert id="insertSelective" parameterType="com.th.demo.model.ware.Store" >
  94. insert into t_ware_store
  95. <trim prefix="(" suffix=")" suffixOverrides="," >
  96. <if test="id != null" >
  97. id,
  98. </if>
  99. <if test="wareName != null" >
  100. ware_name,
  101. </if>
  102. <if test="stackName != null" >
  103. stack_name,
  104. </if>
  105. <if test="layer != null" >
  106. layer,
  107. </if>
  108. <if test="materialName != null" >
  109. material_name,
  110. </if>
  111. <if test="materialNo != null" >
  112. material_no,
  113. </if>
  114. <if test="standard != null" >
  115. standard,
  116. </if>
  117. <if test="model != null" >
  118. model,
  119. </if>
  120. <if test="customerName != null" >
  121. customer_name,
  122. </if>
  123. <if test="customerNo != null" >
  124. customer_no,
  125. </if>
  126. <if test="count != null" >
  127. count,
  128. </if>
  129. <if test="weight != null" >
  130. weight,
  131. </if>
  132. <if test="remark != null" >
  133. remark,
  134. </if>
  135. <if test="addId != null" >
  136. add_id,
  137. </if>
  138. <if test="addTime != null" >
  139. add_time,
  140. </if>
  141. <if test="modifyId != null" >
  142. modify_id,
  143. </if>
  144. <if test="modifyTime != null" >
  145. modify_time,
  146. </if>
  147. <if test="cancelId != null" >
  148. cancel_id,
  149. </if>
  150. <if test="cancelTime != null" >
  151. cancel_time,
  152. </if>
  153. <if test="cancelFlag != null" >
  154. cancel_flag,
  155. </if>
  156. <if test="belongId != null" >
  157. belong_id,
  158. </if>
  159. </trim>
  160. <trim prefix="values (" suffix=")" suffixOverrides="," >
  161. <if test="id != null" >
  162. #{id,jdbcType=VARCHAR},
  163. </if>
  164. <if test="wareName != null" >
  165. #{wareName,jdbcType=VARCHAR},
  166. </if>
  167. <if test="stackName != null" >
  168. #{stackName,jdbcType=VARCHAR},
  169. </if>
  170. <if test="layer != null" >
  171. #{layer,jdbcType=INTEGER},
  172. </if>
  173. <if test="materialName != null" >
  174. #{materialName,jdbcType=VARCHAR},
  175. </if>
  176. <if test="materialNo != null" >
  177. #{materialNo,jdbcType=VARCHAR},
  178. </if>
  179. <if test="standard != null" >
  180. #{standard,jdbcType=VARCHAR},
  181. </if>
  182. <if test="model != null" >
  183. #{model,jdbcType=VARCHAR},
  184. </if>
  185. <if test="customerName != null" >
  186. #{customerName,jdbcType=VARCHAR},
  187. </if>
  188. <if test="customerNo != null" >
  189. #{customerNo,jdbcType=VARCHAR},
  190. </if>
  191. <if test="count != null" >
  192. #{count,jdbcType=DOUBLE},
  193. </if>
  194. <if test="weight != null" >
  195. #{weight,jdbcType=DOUBLE},
  196. </if>
  197. <if test="remark != null" >
  198. #{remark,jdbcType=VARCHAR},
  199. </if>
  200. <if test="addId != null" >
  201. #{addId,jdbcType=VARCHAR},
  202. </if>
  203. <if test="addTime != null" >
  204. #{addTime,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="modifyId != null" >
  207. #{modifyId,jdbcType=VARCHAR},
  208. </if>
  209. <if test="modifyTime != null" >
  210. #{modifyTime,jdbcType=TIMESTAMP},
  211. </if>
  212. <if test="cancelId != null" >
  213. #{cancelId,jdbcType=VARCHAR},
  214. </if>
  215. <if test="cancelTime != null" >
  216. #{cancelTime,jdbcType=TIMESTAMP},
  217. </if>
  218. <if test="cancelFlag != null" >
  219. #{cancelFlag,jdbcType=VARCHAR},
  220. </if>
  221. <if test="belongId != null" >
  222. #{belongId,jdbcType=VARCHAR},
  223. </if>
  224. </trim>
  225. </insert>
  226. <update id="updateByPrimaryKeySelective" parameterType="com.th.demo.model.ware.Store" >
  227. update t_ware_store
  228. <set >
  229. <if test="wareName != null" >
  230. ware_name = #{wareName,jdbcType=VARCHAR},
  231. </if>
  232. <if test="stackName != null" >
  233. stack_name = #{stackName,jdbcType=VARCHAR},
  234. </if>
  235. <if test="layer != null" >
  236. layer = #{layer,jdbcType=INTEGER},
  237. </if>
  238. <if test="materialName != null" >
  239. material_name = #{materialName,jdbcType=VARCHAR},
  240. </if>
  241. <if test="materialNo != null" >
  242. material_no = #{materialNo,jdbcType=VARCHAR},
  243. </if>
  244. <if test="standard != null" >
  245. standard = #{standard,jdbcType=VARCHAR},
  246. </if>
  247. <if test="model != null" >
  248. model = #{model,jdbcType=VARCHAR},
  249. </if>
  250. <if test="customerName != null" >
  251. customer_name = #{customerName,jdbcType=VARCHAR},
  252. </if>
  253. <if test="customerNo != null" >
  254. customer_no = #{customerNo,jdbcType=VARCHAR},
  255. </if>
  256. <if test="count != null" >
  257. count = #{count,jdbcType=DOUBLE},
  258. </if>
  259. <if test="weight != null" >
  260. weight = #{weight,jdbcType=DOUBLE},
  261. </if>
  262. <if test="remark != null" >
  263. remark = #{remark,jdbcType=VARCHAR},
  264. </if>
  265. <if test="addId != null" >
  266. add_id = #{addId,jdbcType=VARCHAR},
  267. </if>
  268. <if test="addTime != null" >
  269. add_time = #{addTime,jdbcType=TIMESTAMP},
  270. </if>
  271. <if test="modifyId != null" >
  272. modify_id = #{modifyId,jdbcType=VARCHAR},
  273. </if>
  274. <if test="modifyTime != null" >
  275. modify_time = #{modifyTime,jdbcType=TIMESTAMP},
  276. </if>
  277. <if test="cancelId != null" >
  278. cancel_id = #{cancelId,jdbcType=VARCHAR},
  279. </if>
  280. <if test="cancelTime != null" >
  281. cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
  282. </if>
  283. <if test="cancelFlag != null" >
  284. cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
  285. </if>
  286. <if test="belongId != null" >
  287. belong_id = #{belongId,jdbcType=VARCHAR},
  288. </if>
  289. </set>
  290. where id = #{id,jdbcType=VARCHAR}
  291. </update>
  292. <update id="updateByPrimaryKey" parameterType="com.th.demo.model.ware.Store" >
  293. update t_ware_store
  294. set ware_id = #{ware.id,jdbcType=VARCHAR},
  295. stack_id = #{stack.id,jdbcType=VARCHAR},
  296. layer = #{layer,jdbcType=INTEGER},
  297. material_id = #{material.id,jdbcType=VARCHAR},
  298. model = #{model,jdbcType=VARCHAR},
  299. plate_no = #{plateNo,jdbcType=VARCHAR},
  300. customer_id = #{customer.id,jdbcType=VARCHAR},
  301. count = #{count,jdbcType=DOUBLE},
  302. weight = #{weight,jdbcType=DOUBLE},
  303. remark = #{remark,jdbcType=VARCHAR},
  304. add_id = #{addId,jdbcType=VARCHAR},
  305. add_time = #{addTime,jdbcType=TIMESTAMP},
  306. modify_id = #{modifyId,jdbcType=VARCHAR},
  307. modify_time = #{modifyTime,jdbcType=TIMESTAMP},
  308. cancel_id = #{cancelId,jdbcType=VARCHAR},
  309. cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
  310. cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
  311. belong_id = #{belongId,jdbcType=VARCHAR},
  312. in_id = #{inId,jdbcType=VARCHAR},
  313. out_id = #{outId,jdbcType=VARCHAR},
  314. receive_address = #{receiveAddress,jdbcType=VARCHAR},
  315. out_flag = #{outFlag,jdbcType=VARCHAR},
  316. lock_flag = #{lockFlag,jdbcType=VARCHAR},
  317. contract_no = #{contractNo,jdbcType=VARCHAR},
  318. remark1 = #{remark1,jdbcType=VARCHAR}
  319. where id = #{id,jdbcType=VARCHAR}
  320. </update>
  321. <select id="selectLayerByStackId" resultType="java.lang.String" >
  322. SELECT ifnull(max(t.layer),0) from t_ware_store t
  323. where t.stack_id =#{param1,jdbcType=VARCHAR}
  324. and t.belong_id = #{param2,jdbcType=VARCHAR}
  325. and ifnull(t.cancel_flag,'0') = '0'
  326. and ifnull(t.out_flag,'0') = '0'
  327. </select>
  328. <select id="selectByWareIdStackId" resultMap="BaseResultMap" >
  329. SELECT b.name as fk_compony_id,t.* from t_ware_store t left join t_maint_customer b
  330. on t.fk_compony_id = b.id
  331. where t.ware_id = #{param1,jdbcType=VARCHAR}
  332. and t.stack_id = #{param2,jdbcType=VARCHAR}
  333. and t.belong_id = #{param3,jdbcType=VARCHAR}
  334. and ifnull(t.cancel_flag,'0') = '0'
  335. and ifnull(t.out_flag,'0') = '0'
  336. order by layer desc
  337. </select>
  338. <select id="select" resultMap="BaseResultMap" >
  339. select t.* from t_ware_store t where t.ware_name in (
  340. select b.name from t_maint_userware a ,t_maint_ware b where a.ware_id = b.id
  341. and user_id = #{param3,jdbcType=VARCHAR} ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  342. <if test="param1 != ''" >
  343. and t.ware_name = #{param1,jdbcType=VARCHAR}
  344. </if>
  345. <if test="param2 != ''" >
  346. and t.stack_name = #{param2,jdbcType=VARCHAR}
  347. </if>
  348. and ifnull(t.cancel_flag,'0') = '0'
  349. and ifnull(t.out_flag,'0') = '0'
  350. order by t.stack_name asc , t.layer desc
  351. </select>
  352. <select id="selectForUpDown" resultMap="BaseResultMap" >
  353. select t.* from t_ware_store t
  354. where t.ware_id in (
  355. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  356. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  357. and t.ware_id = #{param1,jdbcType=VARCHAR}
  358. and t.stack_id = #{param2,jdbcType=VARCHAR}
  359. and t.layer &gt;= #{param5,jdbcType=INTEGER}
  360. and t.layer &lt;= #{param6,jdbcType=INTEGER}
  361. and ifnull(t.cancel_flag,'0') = '0'
  362. and ifnull(t.out_flag,'0') = '0'
  363. </select>
  364. <update id="updateForUpDownByStep" >
  365. update t_ware_store t set t.layer = t.layer + #{param7,jdbcType=INTEGER}
  366. where t.ware_id in (
  367. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  368. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  369. and t.ware_id = #{param1,jdbcType=VARCHAR}
  370. and t.stack_id = #{param2,jdbcType=VARCHAR}
  371. and t.layer &gt;= #{param5,jdbcType=INTEGER}
  372. and t.layer &lt;= #{param6,jdbcType=INTEGER}
  373. and ifnull(t.cancel_flag,'0') = '0'
  374. and ifnull(t.out_flag,'0') = '0'
  375. </update>
  376. <update id="updateForUpDownByLayer" >
  377. update t_ware_store t set t.layer = #{param7,jdbcType=INTEGER}
  378. where t.ware_id in (
  379. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  380. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  381. and t.ware_id = #{param1,jdbcType=VARCHAR}
  382. and t.stack_id = #{param2,jdbcType=VARCHAR}
  383. and t.layer &gt;= #{param5,jdbcType=INTEGER}
  384. and t.layer &lt;= #{param6,jdbcType=INTEGER}
  385. and ifnull(t.cancel_flag,'0') = '0'
  386. and ifnull(t.out_flag,'0') = '0'
  387. </update>
  388. <select id="selectByOutId" resultMap="BaseResultMap" >
  389. select t.* from t_ware_store t
  390. where t.ware_id in (
  391. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  392. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  393. and t.out_id = #{param1,jdbcType=VARCHAR}
  394. </select>
  395. <update id="updateByOutId" >
  396. update t_ware_store t set t.cancel_flag = '1'
  397. where t.ware_id in (
  398. select a.ware_id from t_maint_userware a where a.user_id = #{param3,jdbcType=VARCHAR}
  399. ) and t.belong_id = #{param4,jdbcType=VARCHAR}
  400. and t.out_id = #{param1,jdbcType=VARCHAR}
  401. </update>
  402. <select id="selectStore" resultMap="BaseResultMap" >
  403. select d.name as fk_compony_id,t.* from t_ware_store t, t_maint_ware a, t_maint_stack b,
  404. t_maint_material c,t_maint_customer d,t_maint_customer e
  405. where t.ware_id = a.id
  406. and t.stack_id = b.id
  407. and t.material_id = c.id
  408. and t.fk_compony_id = d.id
  409. and t.customer_id = e.id
  410. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  411. and e.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  412. and d.name like concat('%',#{param14,jdbcType=VARCHAR},'%')
  413. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  414. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  415. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  416. and d.name like concat('%',#{param6,jdbcType=VARCHAR},'%')
  417. and t.remark1 like concat('%',#{param13,jdbcType=VARCHAR},'%')
  418. and (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
  419. <if test="param9 != null and param9.size() !=0" >
  420. OR t.plate_no IN <foreach item="item" collection="param9" index="index" open="(" separator="," close=")">
  421. #{item,jdbcType=VARCHAR} </foreach>
  422. </if>
  423. )
  424. and (t.ord_no like concat('%',#{param8,jdbcType=VARCHAR},'%')
  425. <if test="param10 != null and param10.size() !=0" >
  426. OR t.ord_no IN <foreach item="item" collection="param10" index="index" open="(" separator="," close=")">
  427. #{item,jdbcType=VARCHAR} </foreach>
  428. </if>
  429. )
  430. and t.belong_id = #{param12,jdbcType=VARCHAR}
  431. and t.cancel_flag = '0'
  432. and t.out_flag = '0'
  433. and t.ware_id in (
  434. select m.ware_id from t_maint_userware m where m.user_id = #{param11,jdbcType=VARCHAR}
  435. )
  436. order by b.code,t.layer desc
  437. </select>
  438. <select id="selectWareStackByDistributionStore" resultMap="StoreOfWareStack" >
  439. select distinct t.ware_id ,t.stack_id
  440. from t_ware_store t where t.id in
  441. <foreach item="item" index="index" collection="storeId"
  442. open="(" separator="," close=")">
  443. #{item}
  444. </foreach>
  445. </select>
  446. <select id="selectByWareIdStackIdInStoreId" resultMap="BaseResultMap" >
  447. select *
  448. from t_ware_store t where t.id in
  449. <foreach item="item" index="index" collection="storeId"
  450. open="(" separator="," close=")">
  451. #{item}
  452. </foreach>
  453. and t.ware_id like concat('%',#{wareId,jdbcType=VARCHAR},'%')
  454. and t.stack_id like concat('%',#{stackId,jdbcType=VARCHAR},'%')
  455. </select>
  456. <update id="updateDistributionById" >
  457. update t_ware_store t
  458. set t.lock_flag = #{lockFlag,jdbcType=VARCHAR} where t.id in
  459. <foreach item="item" index="index" collection="storeId"
  460. open="(" separator="," close=")">
  461. #{item}
  462. </foreach>
  463. </update>
  464. <select id="selectForCustomer" resultMap="BaseResultMap" >
  465. select e.name as fk_compony_id,t.*
  466. from t_ware_store t left join t_maint_customer e
  467. on t.fk_compony_id = e.id
  468. , t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d
  469. where t.ware_id = a.id
  470. and t.stack_id = b.id
  471. and t.material_id = c.id
  472. and t.customer_id = d.id
  473. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  474. and b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  475. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  476. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  477. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  478. <if test="param6 != null and param6 != ''" >
  479. and d.name = #{param6,jdbcType=VARCHAR}
  480. </if>
  481. and t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
  482. and t.cancel_flag = '0'
  483. and t.out_flag = '0'
  484. and IFNULL(t.ord_no,'*') like concat('%',#{param11,jdbcType=VARCHAR},'%')
  485. and d.name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%')
  486. </select>
  487. <select id="queryTotal" resultMap="TotalResultMap" >
  488. select sum(t.weight) as total_weight,
  489. sum(t.count) as total_amount
  490. from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d
  491. where t.ware_id = a.id
  492. and t.stack_id = b.id
  493. and t.material_id = c.id
  494. and t.customer_id = d.id
  495. and a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
  496. and b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
  497. and t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
  498. and c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
  499. and c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
  500. and d.name like concat('%',#{param6,jdbcType=VARCHAR},'%')
  501. and t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
  502. and t.cancel_flag = '0'
  503. and t.out_flag = '0'
  504. and IFNULL(t.ord_no,'*') like concat('%',#{param11,jdbcType=VARCHAR},'%')
  505. and d.name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%')
  506. </select>
  507. <select id="selEffStore" resultType="java.lang.Integer" parameterType="java.lang.String">
  508. select count(*)
  509. from t_ware_store t
  510. where t.cancel_flag = '0'
  511. and IFNULL(t.out_flag,'0') = '0'
  512. and t.plate_no = #{param1,jdbcType=VARCHAR};
  513. </select>
  514. <update id="updateFkById" parameterType="com.th.demo.model.ware.Store">
  515. update t_ware_store t set t.fk_compony_id = #{fkComponyId,jdbcType=VARCHAR}
  516. where t.id = #{id,jdbcType=VARCHAR}
  517. </update>
  518. <select id="selectByInId" resultType="java.lang.Integer" parameterType="java.lang.String">
  519. select COUNT(*)
  520. from t_ware_store t
  521. where t.cancel_flag = '0'
  522. and t.in_id = #{param1,jdbcType=VARCHAR};
  523. </select>
  524. <select id="selectByOutIdNum" resultType="java.lang.Integer" parameterType="java.lang.String">
  525. select COUNT(*)
  526. from t_ware_store t
  527. where t.cancel_flag = '0'
  528. and t.out_id = #{param1,jdbcType=VARCHAR};
  529. </select>
  530. <update id="updateInDtmByInId" >
  531. update t_ware_store
  532. set add_time = #{param2,jdbcType=TIMESTAMP}
  533. where in_id = #{param1,jdbcType=VARCHAR}
  534. </update>
  535. <update id="updateAddressById">
  536. update t_ware_store
  537. set receive_address = #{address,jdbcType=VARCHAR}
  538. where id in
  539. <foreach collection="id" item="item" index="index" open="(" separator="," close=")">
  540. #{item,jdbcType=VARCHAR}
  541. </foreach>
  542. </update>
  543. <update id="updateInAddressById">
  544. update t_ware_in_record
  545. set receive_address = #{address,jdbcType=VARCHAR}
  546. where id in
  547. <foreach collection="inId" item="item" index="index" open="(" separator="," close=")">
  548. #{item,jdbcType=VARCHAR}
  549. </foreach>
  550. </update>
  551. </mapper>