AllocationStorehouseServiceDaoImplMapper.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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="allocationStorehouseServiceDaoImpl">
  6. <!-- 保存仓库调拨信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessAllocationStorehouseInfo" parameterType="Map">
  8. insert into business_allocation_storehouse(
  9. as_id,store_id,res_id,sh_id_z,res_name,start_user_id,operate,sh_id_a,start_user_name,state,b_id,stock,remark
  10. ) values (
  11. #{asId},#{storeId},#{resId},#{shIdz},#{resName},#{startUserId},#{operate},#{shIda},#{startUserName},#{state},#{bId},#{stock},#{remark}
  12. )
  13. </insert>
  14. <!-- 查询仓库调拨信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessAllocationStorehouseInfo" parameterType="Map" resultType="Map">
  16. select t.as_id,t.as_id asId,t.store_id,t.store_id storeId,t.res_id,t.res_id resId,t.sh_id_z,t.sh_id_z
  17. shIdz,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id startUserId,t.operate,t.sh_id_a,t.sh_id_a
  18. shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id bId,t.stock,t.remark
  19. from business_allocation_storehouse t
  20. where 1 =1
  21. <if test="asId !=null and asId != ''">
  22. and t.as_id= #{asId}
  23. </if>
  24. <if test="storeId !=null and storeId != ''">
  25. and t.store_id= #{storeId}
  26. </if>
  27. <if test="resId !=null and resId != ''">
  28. and t.res_id= #{resId}
  29. </if>
  30. <if test="shIdz !=null and shIdz != ''">
  31. and t.sh_id_z= #{shIdz}
  32. </if>
  33. <if test="resName !=null and resName != ''">
  34. and t.res_name= #{resName}
  35. </if>
  36. <if test="startUserId !=null and startUserId != ''">
  37. and t.start_user_id= #{startUserId}
  38. </if>
  39. <if test="operate !=null and operate != ''">
  40. and t.operate= #{operate}
  41. </if>
  42. <if test="shIda !=null and shIda != ''">
  43. and t.sh_id_a= #{shIda}
  44. </if>
  45. <if test="startUserName !=null and startUserName != ''">
  46. and t.start_user_name= #{startUserName}
  47. </if>
  48. <if test="state !=null and state != ''">
  49. and t.state= #{state}
  50. </if>
  51. <if test="bId !=null and bId != ''">
  52. and t.b_id= #{bId}
  53. </if>
  54. <if test="stock !=null and stock != ''">
  55. and t.stock= #{stock}
  56. </if>
  57. </select>
  58. <!-- 保存仓库调拨信息至 instance表中 add by wuxw 2018-07-03 -->
  59. <insert id="saveAllocationStorehouseInfoInstance" parameterType="Map">
  60. insert into allocation_storehouse(
  61. as_id,status_cd,store_id,res_id,sh_id_z,res_name,start_user_id,sh_id_a,start_user_name,state,b_id,stock,remark
  62. ) select
  63. t.as_id,'0',t.store_id,t.res_id,t.sh_id_z,t.res_name,t.start_user_id,t.sh_id_a,t.start_user_name,t.state,t.b_id,t.stock,t.remark
  64. from business_allocation_storehouse t where 1=1
  65. <if test="asId !=null and asId != ''">
  66. and t.as_id= #{asId}
  67. </if>
  68. <if test="storeId !=null and storeId != ''">
  69. and t.store_id= #{storeId}
  70. </if>
  71. <if test="resId !=null and resId != ''">
  72. and t.res_id= #{resId}
  73. </if>
  74. <if test="shIdz !=null and shIdz != ''">
  75. and t.sh_id_z= #{shIdz}
  76. </if>
  77. <if test="resName !=null and resName != ''">
  78. and t.res_name= #{resName}
  79. </if>
  80. <if test="startUserId !=null and startUserId != ''">
  81. and t.start_user_id= #{startUserId}
  82. </if>
  83. and t.operate= 'ADD'
  84. <if test="shIda !=null and shIda != ''">
  85. and t.sh_id_a= #{shIda}
  86. </if>
  87. <if test="startUserName !=null and startUserName != ''">
  88. and t.start_user_name= #{startUserName}
  89. </if>
  90. <if test="state !=null and state != ''">
  91. and t.state= #{state}
  92. </if>
  93. <if test="bId !=null and bId != ''">
  94. and t.b_id= #{bId}
  95. </if>
  96. <if test="stock !=null and stock != ''">
  97. and t.stock= #{stock}
  98. </if>
  99. </insert>
  100. <!-- 查询仓库调拨信息 add by wuxw 2018-07-03 -->
  101. <select id="getAllocationStorehouseInfo" parameterType="Map" resultType="Map">
  102. select t.as_id,t.as_id asId,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id storeId,t.res_id,t.res_id
  103. resId,t.sh_id_z,t.sh_id_z shIdz,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id
  104. startUserId,t.sh_id_a,t.sh_id_a shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id
  105. bId,t.stock,t.remark
  106. from allocation_storehouse t
  107. where 1 =1
  108. <if test="asId !=null and asId != ''">
  109. and t.as_id= #{asId}
  110. </if>
  111. <if test="statusCd !=null and statusCd != ''">
  112. and t.status_cd= #{statusCd}
  113. </if>
  114. <if test="storeId !=null and storeId != ''">
  115. and t.store_id= #{storeId}
  116. </if>
  117. <if test="resId !=null and resId != ''">
  118. and t.res_id= #{resId}
  119. </if>
  120. <if test="shIdz !=null and shIdz != ''">
  121. and t.sh_id_z= #{shIdz}
  122. </if>
  123. <if test="resName !=null and resName != ''">
  124. and t.res_name= #{resName}
  125. </if>
  126. <if test="startUserId !=null and startUserId != ''">
  127. and t.start_user_id= #{startUserId}
  128. </if>
  129. <if test="shIda !=null and shIda != ''">
  130. and t.sh_id_a= #{shIda}
  131. </if>
  132. <if test="startUserName !=null and startUserName != ''">
  133. and t.start_user_name= #{startUserName}
  134. </if>
  135. <if test="state !=null and state != ''">
  136. and t.state= #{state}
  137. </if>
  138. <if test="bId !=null and bId != ''">
  139. and t.b_id= #{bId}
  140. </if>
  141. <if test="stock !=null and stock != ''">
  142. and t.stock= #{stock}
  143. </if>
  144. order by t.create_time desc
  145. <if test="page != -1 and page != null ">
  146. limit #{page}, #{row}
  147. </if>
  148. </select>
  149. <!-- 修改仓库调拨信息 add by wuxw 2018-07-03 -->
  150. <update id="updateAllocationStorehouseInfoInstance" parameterType="Map">
  151. update allocation_storehouse t set t.status_cd = #{statusCd}
  152. <if test="newBId != null and newBId != ''">
  153. ,t.b_id = #{newBId}
  154. </if>
  155. <if test="storeId !=null and storeId != ''">
  156. , t.store_id= #{storeId}
  157. </if>
  158. <if test="resId !=null and resId != ''">
  159. , t.res_id= #{resId}
  160. </if>
  161. <if test="shIdz !=null and shIdz != ''">
  162. , t.sh_id_z= #{shIdz}
  163. </if>
  164. <if test="resName !=null and resName != ''">
  165. , t.res_name= #{resName}
  166. </if>
  167. <if test="startUserId !=null and startUserId != ''">
  168. , t.start_user_id= #{startUserId}
  169. </if>
  170. <if test="shIda !=null and shIda != ''">
  171. , t.sh_id_a= #{shIda}
  172. </if>
  173. <if test="startUserName !=null and startUserName != ''">
  174. , t.start_user_name= #{startUserName}
  175. </if>
  176. <if test="state !=null and state != ''">
  177. , t.state= #{state}
  178. </if>
  179. <if test="stock !=null and stock != ''">
  180. , t.stock= #{stock}
  181. </if>
  182. where 1=1
  183. <if test="asId !=null and asId != ''">
  184. and t.as_id= #{asId}
  185. </if>
  186. <if test="bId !=null and bId != ''">
  187. and t.b_id= #{bId}
  188. </if>
  189. </update>
  190. <!-- 查询仓库调拨数量 add by wuxw 2018-07-03 -->
  191. <select id="queryAllocationStorehousesCount" parameterType="Map" resultType="Map">
  192. select count(1) count
  193. from allocation_storehouse t
  194. where 1 =1
  195. <if test="asId !=null and asId != ''">
  196. and t.as_id= #{asId}
  197. </if>
  198. <if test="statusCd !=null and statusCd != ''">
  199. and t.status_cd= #{statusCd}
  200. </if>
  201. <if test="storeId !=null and storeId != ''">
  202. and t.store_id= #{storeId}
  203. </if>
  204. <if test="resId !=null and resId != ''">
  205. and t.res_id= #{resId}
  206. </if>
  207. <if test="shIdz !=null and shIdz != ''">
  208. and t.sh_id_z= #{shIdz}
  209. </if>
  210. <if test="resName !=null and resName != ''">
  211. and t.res_name= #{resName}
  212. </if>
  213. <if test="startUserId !=null and startUserId != ''">
  214. and t.start_user_id= #{startUserId}
  215. </if>
  216. <if test="shIda !=null and shIda != ''">
  217. and t.sh_id_a= #{shIda}
  218. </if>
  219. <if test="startUserName !=null and startUserName != ''">
  220. and t.start_user_name= #{startUserName}
  221. </if>
  222. <if test="state !=null and state != ''">
  223. and t.state= #{state}
  224. </if>
  225. <if test="bId !=null and bId != ''">
  226. and t.b_id= #{bId}
  227. </if>
  228. <if test="stock !=null and stock != ''">
  229. and t.stock= #{stock}
  230. </if>
  231. </select>
  232. </mapper>