AllocationUserStorehouseServiceDaoImplMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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="allocationUserStorehouseServiceDaoImpl">
  6. <!-- 保存物品供应商信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessAllocationUserStorehouseInfo" parameterType="Map">
  8. insert into business_allocation_user_storehouse(
  9. accept_user_id,accept_user_name,remark,store_id,res_id,res_name,start_user_id,operate,start_user_name,aus_id,b_id,stock,give_quantity
  10. ) values (
  11. #{acceptUserId},#{acceptUserName},#{remark},#{storeId},#{resId},#{resName},#{startUserId},#{operate},#{startUserName},#{ausId},#{bId},
  12. #{stock},#{giveQuantity}
  13. )
  14. </insert>
  15. <!-- 查询物品供应商信息(Business) add by wuxw 2018-07-03 -->
  16. <select id="getBusinessAllocationUserStorehouseInfo" parameterType="Map" resultType="Map">
  17. select t.accept_user_id,t.accept_user_id acceptUserId,t.accept_user_name,t.accept_user_name
  18. acceptUserName,t.remark,t.store_id,t.store_id storeId,t.res_id,t.res_id resId,t.res_name,t.res_name
  19. resName,t.start_user_id,t.start_user_id startUserId,t.operate,t.start_user_name,t.start_user_name
  20. startUserName,t.aus_id,t.aus_id ausId,t.b_id,t.b_id bId,t.stock,t.give_quantity,t.give_quantity giveQuantity
  21. from business_allocation_user_storehouse t
  22. where 1 = 1
  23. <if test="acceptUserId !=null and acceptUserId != ''">
  24. and t.accept_user_id= #{acceptUserId}
  25. </if>
  26. <if test="acceptUserName !=null and acceptUserName != ''">
  27. and t.accept_user_name= #{acceptUserName}
  28. </if>
  29. <if test="remark !=null and remark != ''">
  30. and t.remark= #{remark}
  31. </if>
  32. <if test="storeId !=null and storeId != ''">
  33. and t.store_id= #{storeId}
  34. </if>
  35. <if test="resId !=null and resId != ''">
  36. and t.res_id= #{resId}
  37. </if>
  38. <if test="resName !=null and resName != ''">
  39. and t.res_name= #{resName}
  40. </if>
  41. <if test="startUserId !=null and startUserId != ''">
  42. and t.start_user_id= #{startUserId}
  43. </if>
  44. <if test="operate !=null and operate != ''">
  45. and t.operate= #{operate}
  46. </if>
  47. <if test="startUserName !=null and startUserName != ''">
  48. and t.start_user_name= #{startUserName}
  49. </if>
  50. <if test="ausId !=null and ausId != ''">
  51. and t.aus_id= #{ausId}
  52. </if>
  53. <if test="bId !=null and bId != ''">
  54. and t.b_id= #{bId}
  55. </if>
  56. <if test="stock !=null and stock != ''">
  57. and t.stock= #{stock}
  58. </if>
  59. <if test="giveQuantity !=null and giveQuantity != ''">
  60. and t.give_quantity= #{giveQuantity}
  61. </if>
  62. </select>
  63. <!-- 保存物品供应商信息至 instance表中 add by wuxw 2018-07-03 -->
  64. <insert id="saveAllocationUserStorehouseInfoInstance" parameterType="Map">
  65. insert into allocation_user_storehouse(
  66. accept_user_id,accept_user_name,status_cd,remark,store_id,res_id,res_name,start_user_id,start_user_name,aus_id,b_id,stock,give_quantity
  67. ) select
  68. t.accept_user_id,t.accept_user_name,'0',t.remark,t.store_id,t.res_id,t.res_name,t.start_user_id,t.start_user_name,t.aus_id,t.b_id,t.stock,
  69. t.give_quantity
  70. from business_allocation_user_storehouse t where 1=1
  71. <if test="acceptUserId !=null and acceptUserId != ''">
  72. and t.accept_user_id= #{acceptUserId}
  73. </if>
  74. <if test="acceptUserName !=null and acceptUserName != ''">
  75. and t.accept_user_name= #{acceptUserName}
  76. </if>
  77. <if test="remark !=null and remark != ''">
  78. and t.remark= #{remark}
  79. </if>
  80. <if test="storeId !=null and storeId != ''">
  81. and t.store_id= #{storeId}
  82. </if>
  83. <if test="resId !=null and resId != ''">
  84. and t.res_id= #{resId}
  85. </if>
  86. <if test="resName !=null and resName != ''">
  87. and t.res_name= #{resName}
  88. </if>
  89. <if test="startUserId !=null and startUserId != ''">
  90. and t.start_user_id= #{startUserId}
  91. </if>
  92. and t.operate= 'ADD'
  93. <if test="startUserName !=null and startUserName != ''">
  94. and t.start_user_name= #{startUserName}
  95. </if>
  96. <if test="ausId !=null and ausId != ''">
  97. and t.aus_id= #{ausId}
  98. </if>
  99. <if test="bId !=null and bId != ''">
  100. and t.b_id= #{bId}
  101. </if>
  102. <if test="stock !=null and stock != ''">
  103. and t.stock= #{stock}
  104. </if>
  105. <if test="giveQuantity !=null and giveQuantity != ''">
  106. and t.give_quantity= #{giveQuantity}
  107. </if>
  108. </insert>
  109. <!-- 查询物品供应商信息 add by wuxw 2018-07-03 -->
  110. <select id="getAllocationUserStorehouseInfo" parameterType="Map" resultType="Map">
  111. select t.accept_user_id,t.accept_user_id acceptUserId,t.accept_user_name,t.accept_user_name
  112. acceptUserName,t.status_cd,t.status_cd statusCd,t.remark,t.store_id,t.store_id storeId,t.res_id,t.res_id
  113. resId,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id startUserId,t.start_user_name,
  114. t.start_user_name startUserName,t.aus_id,t.aus_id ausId,t.b_id,t.b_id
  115. bId,t.stock,t.give_quantity,t.give_quantity giveQuantity,t.create_time createTime,rst.name rstName,rss.spec_name
  116. specName,td1.name unitCodeName,td2.name miniUnitCodeName,rst1.name parentRstName,rs.is_fixed isFixed,rs.res_code resCode,td3.name isFixedName
  117. from allocation_user_storehouse t
  118. left join resource_store rs on t.res_id = rs.res_id and rs.status_cd = '0'
  119. left join resource_store_type rst on rs.rst_id = rst.rst_id and rst.status_cd = '0'
  120. left join resource_store_type rst1 on rs.parent_rst_id = rst1.rst_id and rst1.status_cd = '0'
  121. left join resource_store_specification rss on rs.rss_id=rss.rss_id and rss.status_cd = '0'
  122. left join t_dict td1 on rs.unit_code = td1.status_cd and td1.table_name = 'resource_store' and td1.table_columns = 'unit_code'
  123. left join t_dict td2 on rs.mini_unit_code = td2.status_cd and td2.table_name = 'resource_store' and td2.table_columns = 'unit_code'
  124. left join t_dict td3 on rs.is_fixed = td3.status_cd and td3.table_name = 'resource_store' and td3.table_columns = 'is_fixed'
  125. where 1 = 1
  126. <if test="acceptUserId !=null and acceptUserId != ''">
  127. and t.accept_user_id= #{acceptUserId}
  128. </if>
  129. <if test="acceptUserName !=null and acceptUserName != ''">
  130. and t.accept_user_name like '%${acceptUserName}%'
  131. </if>
  132. <if test="statusCd !=null and statusCd != ''">
  133. and t.status_cd= #{statusCd}
  134. </if>
  135. <if test="remark !=null and remark != ''">
  136. and t.remark= #{remark}
  137. </if>
  138. <if test="storeId !=null and storeId != ''">
  139. and t.store_id= #{storeId}
  140. </if>
  141. <if test="resId !=null and resId != ''">
  142. and t.res_id= #{resId}
  143. </if>
  144. <if test="resName !=null and resName != ''">
  145. and t.res_name like '%${resName}%'
  146. </if>
  147. <if test="startUserId !=null and startUserId != ''">
  148. and t.start_user_id= #{startUserId}
  149. </if>
  150. <if test="startUserName !=null and startUserName != ''">
  151. and t.start_user_name like '%${startUserName}%'
  152. </if>
  153. <if test="ausId !=null and ausId != ''">
  154. and t.aus_id= #{ausId}
  155. </if>
  156. <if test="bId !=null and bId != ''">
  157. and t.b_id= #{bId}
  158. </if>
  159. <if test="stock !=null and stock != ''">
  160. and t.stock= #{stock}
  161. </if>
  162. <if test="giveQuantity !=null and giveQuantity != ''">
  163. and t.give_quantity= #{giveQuantity}
  164. </if>
  165. <if test="rstId !=null and rstId != ''">
  166. and rs.rst_id= #{rstId}
  167. </if>
  168. <if test="parentRstId !=null and parentRstId != ''">
  169. and rs.parent_rst_id= #{parentRstId}
  170. </if>
  171. <if test="rssId !=null and rssId != ''">
  172. and rs.rss_id= #{rssId}
  173. </if>
  174. <if test="isFixed !=null and isFixed != ''">
  175. and rs.is_fixed= #{isFixed}
  176. </if>
  177. order by t.create_time desc
  178. <if test="page != -1 and page != null ">
  179. limit #{page}, #{row}
  180. </if>
  181. </select>
  182. <!-- 修改物品供应商信息 add by wuxw 2018-07-03 -->
  183. <update id="updateAllocationUserStorehouseInfoInstance" parameterType="Map">
  184. update allocation_user_storehouse t set t.status_cd = #{statusCd}
  185. <if test="newBId != null and newBId != ''">
  186. ,t.b_id = #{newBId}
  187. </if>
  188. <if test="acceptUserId !=null and acceptUserId != ''">
  189. , t.accept_user_id= #{acceptUserId}
  190. </if>
  191. <if test="acceptUserName !=null and acceptUserName != ''">
  192. , t.accept_user_name= #{acceptUserName}
  193. </if>
  194. <if test="remark !=null and remark != ''">
  195. , t.remark= #{remark}
  196. </if>
  197. <if test="storeId !=null and storeId != ''">
  198. , t.store_id= #{storeId}
  199. </if>
  200. <if test="resId !=null and resId != ''">
  201. , t.res_id= #{resId}
  202. </if>
  203. <if test="resName !=null and resName != ''">
  204. , t.res_name= #{resName}
  205. </if>
  206. <if test="startUserId !=null and startUserId != ''">
  207. , t.start_user_id= #{startUserId}
  208. </if>
  209. <if test="startUserName !=null and startUserName != ''">
  210. , t.start_user_name= #{startUserName}
  211. </if>
  212. <if test="stock !=null and stock != ''">
  213. , t.stock= #{stock}
  214. </if>
  215. <if test="giveQuantity !=null and giveQuantity != ''">
  216. , t.give_quantity= #{giveQuantity}
  217. </if>
  218. where 1=1
  219. <if test="ausId !=null and ausId != ''">
  220. and t.aus_id= #{ausId}
  221. </if>
  222. <if test="bId !=null and bId != ''">
  223. and t.b_id= #{bId}
  224. </if>
  225. </update>
  226. <!-- 查询物品供应商数量 add by wuxw 2018-07-03 -->
  227. <select id="queryAllocationUserStorehousesCount" parameterType="Map" resultType="Map">
  228. select count(1) count
  229. from allocation_user_storehouse t
  230. left join resource_store rs on t.res_id = rs.res_id and rs.status_cd = '0'
  231. left join resource_store_type rst on rs.rst_id = rst.rst_id and rst.status_cd = '0'
  232. left join resource_store_specification rss on rs.rss_id=rss.rss_id and rss.status_cd = '0'
  233. left join t_dict td1 on rs.unit_code = td1.status_cd and td1.table_name = 'resource_store' and td1.table_columns = 'unit_code'
  234. left join t_dict td2 on rs.mini_unit_code = td2.status_cd and td2.table_name = 'resource_store' and td2.table_columns = 'unit_code'
  235. where 1 =1
  236. <if test="acceptUserId !=null and acceptUserId != ''">
  237. and t.accept_user_id= #{acceptUserId}
  238. </if>
  239. <if test="acceptUserName !=null and acceptUserName != ''">
  240. and t.accept_user_name like '%${acceptUserName}%'
  241. </if>
  242. <if test="statusCd !=null and statusCd != ''">
  243. and t.status_cd= #{statusCd}
  244. </if>
  245. <if test="remark !=null and remark != ''">
  246. and t.remark= #{remark}
  247. </if>
  248. <if test="storeId !=null and storeId != ''">
  249. and t.store_id= #{storeId}
  250. </if>
  251. <if test="resId !=null and resId != ''">
  252. and t.res_id= #{resId}
  253. </if>
  254. <if test="resName !=null and resName != ''">
  255. and t.res_name like '%${resName}%'
  256. </if>
  257. <if test="startUserId !=null and startUserId != ''">
  258. and t.start_user_id= #{startUserId}
  259. </if>
  260. <if test="startUserName !=null and startUserName != ''">
  261. and t.start_user_name like '%${startUserName}%'
  262. </if>
  263. <if test="ausId !=null and ausId != ''">
  264. and t.aus_id= #{ausId}
  265. </if>
  266. <if test="bId !=null and bId != ''">
  267. and t.b_id= #{bId}
  268. </if>
  269. <if test="stock !=null and stock != ''">
  270. and t.stock= #{stock}
  271. </if>
  272. <if test="giveQuantity !=null and giveQuantity != ''">
  273. and t.give_quantity= #{giveQuantity}
  274. </if>
  275. <if test="rstId !=null and rstId != ''">
  276. and rs.rst_id= #{rstId}
  277. </if>
  278. <if test="isFixed !=null and isFixed != ''">
  279. and rs.is_fixed= #{isFixed}
  280. </if>
  281. <if test="parentRstId !=null and parentRstId != ''">
  282. and rs.parent_rst_id= #{parentRstId}
  283. </if>
  284. <if test="rssId !=null and rssId != ''">
  285. and rs.rss_id= #{rssId}
  286. </if>
  287. </select>
  288. </mapper>