ResourceStoreServiceDaoImplMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  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="resourceResourceStoreServiceDaoImpl">
  6. <!-- 保存资源信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessResourceStoreInfo" parameterType="Map">
  8. insert into business_resource_store(res_name, operate, price, res_code, description, store_id, stock,
  9. warning_stock, b_id, res_id,
  10. unit_code, remark, out_low_price, out_high_price, show_mobile, create_time,
  11. sh_id, average_price, rst_id, rss_id,
  12. mini_unit_code, mini_unit_stock, mini_stock, parent_rst_id, is_fixed)
  13. values (#{resName}, #{operate}, #{price}, #{resCode}, #{description}, #{storeId}, #{stock}, #{warningStock},
  14. #{bId}, #{resId},
  15. #{unitCode}, #{remark}, #{outLowPrice}, #{outHighPrice}, #{showMobile}, #{createTime}, #{shId},
  16. #{averagePrice}, #{rstId}, #{rssId}, #{miniUnitCode}, #{miniUnitStock}, #{miniStock}, #{parentRstId},
  17. #{isFixed})
  18. </insert>
  19. <!-- 保存物品信息-->
  20. <insert id="saveResourceStoreInfo" parameterType="Map">
  21. insert into resource_store(res_id, b_id, store_id, res_name, res_code, unit_code, remark, out_low_price,
  22. out_high_price, show_mobile, description,
  23. price, stock, create_time, sh_id, warning_stock, average_price, rss_id, rst_id,
  24. mini_unit_code, mini_unit_stock, mini_stock, parent_rst_id, is_fixed)
  25. values (#{resId}, #{bId}, #{storeId}, #{resName}, #{resCode}, #{unitCode}, #{remark}, #{outLowPrice},
  26. #{outHighPrice},
  27. #{showMobile}, #{description}, #{price}, #{stock}, #{createTime}, #{shId}, #{warningStock},
  28. #{averagePrice}, #{rssId}, #{rstId}, #{miniUnitCode}, #{miniUnitStock}, #{miniStock}, #{parentRstId},
  29. #{isFixed})
  30. </insert>
  31. <!-- 查询资源信息(Business) add by wuxw 2018-07-03 -->
  32. <select id="getBusinessResourceStoreInfo" parameterType="Map" resultType="Map">
  33. select t.res_name,t.res_name resName,t.operate,t.price,t.res_code,t.res_code
  34. resCode,t.description,t.store_id,t.store_id storeId,t.stock,t.warning_stock,t.warning_stock
  35. warningStock,t.b_id,t.b_id bId,t.res_id,t.res_id resId,t.rst_id,t.rst_id rstId,t.rss_id,t.rss_id rssId,
  36. t.unit_code,t.unit_code unitCode,t.remark,t.out_low_price,t.out_low_price outLowPrice,
  37. t.out_high_price,t.out_high_price outHighPrice,t.show_mobile,t.show_mobile showMobile,
  38. t.create_time,t.create_time createTime,t.sh_id,t.sh_id shId,t.mini_unit_code,t.mini_unit_code miniUnitCode,
  39. t.mini_unit_stock,t.mini_unit_stock miniUnitStock,t.average_price,t.average_price averagePrice,t.mini_stock,
  40. t.mini_stock miniStock,t.parent_rst_id,t.parent_rst_id parentRstId,t.is_fixed,t.is_fixed isFixed
  41. from business_resource_store t
  42. where 1 =1
  43. <if test="resName !=null and resName != ''">
  44. and t.res_name= #{resName}
  45. </if>
  46. <if test="operate !=null and operate != ''">
  47. and t.operate= #{operate}
  48. </if>
  49. <if test="price !=null and price != ''">
  50. and t.price= #{price}
  51. </if>
  52. <if test="resCode !=null and resCode != ''">
  53. and t.res_code= #{resCode}
  54. </if>
  55. <if test="rstId !=null and rstId != ''">
  56. and t.rst_id= #{rstId}
  57. </if>
  58. <if test="parentRstId !=null and parentRstId != ''">
  59. and t.parent_rst_id= #{parentRstId}
  60. </if>
  61. <if test="rssId !=null and rssId != ''">
  62. and t.rss_id= #{rssId}
  63. </if>
  64. <if test="description !=null and description != ''">
  65. and t.description= #{description}
  66. </if>
  67. <if test="storeId !=null and storeId != ''">
  68. and t.store_id= #{storeId}
  69. </if>
  70. <if test="stock !=null and stock != ''">
  71. and t.stock= #{stock}
  72. </if>
  73. <if test="warningStock !=null and warningStock != ''">
  74. and t.warning_stock= #{warningStock}
  75. </if>
  76. <if test="bId !=null and bId != ''">
  77. and t.b_id= #{bId}
  78. </if>
  79. <if test="resId !=null and resId != ''">
  80. and t.res_id= #{resId}
  81. </if>
  82. <if test="unitCode !=null and unitCode != ''">
  83. and t.unit_code= #{unitCode}
  84. </if>
  85. <if test="remark !=null and remark != ''">
  86. and t.remark= #{remark}
  87. </if>
  88. <if test="outLowPrice !=null and outLowPrice != ''">
  89. and t.out_low_price= #{outLowPrice}
  90. </if>
  91. <if test="outHighPrice !=null and outHighPrice != ''">
  92. and t.out_high_price= #{outHighPrice}
  93. </if>
  94. <if test="showMobile !=null and showMobile != ''">
  95. and t.show_mobile= #{showMobile}
  96. </if>
  97. <if test="averagePrice !=null and averagePrice != ''">
  98. and t.average_price= #{averagePrice}
  99. </if>
  100. <if test="miniUnitCode !=null and miniUnitCode != ''">
  101. and t.mini_unit_code= #{miniUnitCode}
  102. </if>
  103. <if test="miniUnitStock !=null and miniUnitStock != ''">
  104. and t.mini_unit_stock= #{miniUnitStock}
  105. </if>
  106. <if test="miniStock !=null and miniStock != ''">
  107. and t.mini_stock= #{miniStock}
  108. </if>
  109. <if test="isFixed !=null and isFixed != ''">
  110. and t.is_fixed= #{isFixed}
  111. </if>
  112. <if test="createTime !=null and createTime != ''">
  113. and t.create_time= #{createTime}
  114. </if>
  115. </select>
  116. <!-- 保存资源信息至 instance表中 add by wuxw 2018-07-03 -->
  117. <insert id="saveResourceStoreInfoInstance" parameterType="Map">
  118. insert into resource_store(
  119. res_name,price,res_code,description,status_cd,store_id,stock,warning_stock,b_id,res_id,unit_code,remark,
  120. out_low_price,out_high_price,show_mobile,create_time,sh_id,average_price,rst_id,rss_id,mini_unit_code,mini_unit_stock,
  121. mini_stock,parent_rst_id,is_fixed
  122. ) select
  123. t.res_name,t.price,t.res_code,t.description,'0',t.store_id,t.stock,t.warning_stock,t.b_id,t.res_id,
  124. t.unit_code,t.remark,t.out_low_price,t.out_high_price,t.show_mobile,t.create_time,t.sh_id,t.average_price,t.rst_id,t.rss_id,
  125. t.mini_unit_code,t.mini_unit_stock,t.mini_stock,t.parent_rst_id,t.is_fixed
  126. from business_resource_store t where 1=1
  127. <if test="resName !=null and resName != ''">
  128. and t.res_name= #{resName}
  129. </if>
  130. and t.operate= 'ADD'
  131. <if test="price !=null and price != ''">
  132. and t.price= #{price}
  133. </if>
  134. <if test="resCode !=null and resCode != ''">
  135. and t.res_code= #{resCode}
  136. </if>
  137. <if test="rstId !=null and rstId != ''">
  138. and t.rst_id= #{rstId}
  139. </if>
  140. <if test="parentRstId !=null and parentRstId != ''">
  141. and t.parent_rst_id= #{parentRstId}
  142. </if>
  143. <if test="rssId !=null and rssId != ''">
  144. and t.rss_id= #{rssId}
  145. </if>
  146. <if test="description !=null and description != ''">
  147. and t.description= #{description}
  148. </if>
  149. <if test="storeId !=null and storeId != ''">
  150. and t.store_id= #{storeId}
  151. </if>
  152. <if test="stock !=null and stock != ''">
  153. and t.stock= #{stock}
  154. </if>
  155. <if test="warningStock !=null and warningStock != ''">
  156. and t.warning_stock= #{warningStock}
  157. </if>
  158. <if test="bId !=null and bId != ''">
  159. and t.b_id= #{bId}
  160. </if>
  161. <if test="resId !=null and resId != ''">
  162. and t.res_id= #{resId}
  163. </if>
  164. <if test="unitCode !=null and unitCode != ''">
  165. and t.unit_code= #{unitCode}
  166. </if>
  167. <if test="remark !=null and remark != ''">
  168. and t.remark= #{remark}
  169. </if>
  170. <if test="outLowPrice !=null and outLowPrice != ''">
  171. and t.out_low_price= #{outLowPrice}
  172. </if>
  173. <if test="outHighPrice !=null and outHighPrice != ''">
  174. and t.out_high_price= #{outHighPrice}
  175. </if>
  176. <if test="showMobile !=null and showMobile != ''">
  177. and t.show_mobile= #{showMobile}
  178. </if>
  179. <if test="averagePrice !=null and averagePrice != ''">
  180. and t.average_price= #{averagePrice}
  181. </if>
  182. <if test="miniUnitCode !=null and miniUnitCode != ''">
  183. and t.mini_unit_code= #{miniUnitCode}
  184. </if>
  185. <if test="miniUnitStock !=null and miniUnitStock != ''">
  186. and t.mini_unit_stock= #{miniUnitStock}
  187. </if>
  188. <if test="miniStock !=null and miniStock != ''">
  189. and t.mini_stock= #{miniStock}
  190. </if>
  191. <if test="isFixed !=null and isFixed != ''">
  192. and t.is_fixed= #{isFixed}
  193. </if>
  194. <if test="createTime !=null">
  195. and t.create_time= #{createTime}
  196. </if>
  197. </insert>
  198. <!-- 查询资源信息 add by wuxw 2018-07-03 -->
  199. <select id="getResourceStoreInfo" parameterType="Map" resultType="Map">
  200. select t.res_name,t.res_name resName,t.price,t.res_code,t.res_code resCode,t.description,t.status_cd,t.status_cd
  201. statusCd,t.store_id,t.store_id storeId,t.stock,t.warning_stock,t.warning_stock warningStock,t.b_id,t.b_id
  202. bId,t.res_id,t.res_id resId,t.out_low_price,t.rss_id,t.rss_id rssId,
  203. t.out_low_price outLowPrice,t.out_high_price,t.out_high_price outHighPrice,
  204. t.unit_code,t.unit_code unitCode,t.remark,t.show_mobile,t.show_mobile showMobile,
  205. t.create_time,t.create_time createTime,t.sh_id,t.sh_id shId,sh.sh_name shName,t.average_price,t.average_price
  206. averagePrice,rss.spec_name rssName,t.mini_unit_code,t.mini_unit_code miniUnitCode,t.mini_stock,t.mini_stock
  207. miniStock,t.mini_unit_stock,t.mini_unit_stock miniUnitStock,td.name unitCodeName,td1.name
  208. miniUnitCodeName,sh.sh_type shType,t.parent_rst_id parentRstId,t.rst_id rstId,rst1.name parentRstName,rst.name
  209. rstName,
  210. t.is_fixed,t.is_fixed isFixed,td2.name isFixedName
  211. from resource_store t
  212. left join resource_store_type rst on t.rst_id = rst.rst_id and rst.status_cd = '0'
  213. left join resource_store_type rst1 on t.parent_rst_id = rst1.rst_id and rst1.status_cd = '0'
  214. left join resource_store_specification rss on t.rss_id = rss.rss_id and rss.status_cd = '0'
  215. left join storehouse sh on t.sh_id = sh.sh_id and t.store_id = sh.store_id and sh.status_cd = '0'
  216. left join t_dict td on t.unit_code = td.status_cd and td.table_name = 'resource_store' and td.table_columns =
  217. 'unit_code'
  218. left join t_dict td1 on t.mini_unit_code = td1.status_cd and td1.table_name = 'resource_store' and
  219. td1.table_columns = 'unit_code'
  220. left join t_dict td2 on t.is_fixed = td2.status_cd and td2.table_name='resource_store' and td2.table_columns =
  221. 'is_fixed'
  222. where 1 = 1
  223. <if test="resName !=null and resName != ''">
  224. and t.res_name like concat('%',#{resName},'%')
  225. </if>
  226. <if test="name != null and name != ''">
  227. and t.res_name = #{name}
  228. </if>
  229. <if test="price !=null and price != ''">
  230. and t.price= #{price}
  231. </if>
  232. <if test="rstId !=null and rstId != ''">
  233. and t.rst_id= #{rstId}
  234. </if>
  235. <if test="parentRstId !=null and parentRstId != ''">
  236. and t.parent_rst_id= #{parentRstId}
  237. </if>
  238. <if test="rssId !=null and rssId != ''">
  239. and t.rss_id= #{rssId}
  240. </if>
  241. <if test="outLowPrice !=null and outLowPrice != ''">
  242. and t.out_low_price = #{outLowPrice}
  243. </if>
  244. <if test="outHighPrice != null and outHighPrice != ''">
  245. and t.out_high_price = #{outHighPrice}
  246. </if>
  247. <if test="unitCode != null and unitCode != ''">
  248. and t.unit_code = #{unitCode}
  249. </if>
  250. <if test="remark != null and remark != ''">
  251. and t.remark = #{remark}
  252. </if>
  253. <if test="resCode !=null and resCode != ''">
  254. and t.res_code like concat('%',#{resCode},'%')
  255. </if>
  256. <if test="description !=null and description != ''">
  257. and t.description= #{description}
  258. </if>
  259. <if test="statusCd !=null and statusCd != ''">
  260. and t.status_cd= #{statusCd}
  261. </if>
  262. <if test="storeId !=null and storeId != ''">
  263. and t.store_id= #{storeId}
  264. </if>
  265. <if test="stock !=null and stock != ''">
  266. and t.stock= #{stock}
  267. </if>
  268. <if test="warningStock !=null and warningStock != ''">
  269. and t.warning_stock= #{warningStock}
  270. </if>
  271. <if test="bId !=null and bId != ''">
  272. and t.b_id= #{bId}
  273. </if>
  274. <if test="resId !=null and resId != ''">
  275. and t.res_id= #{resId}
  276. </if>
  277. <if test="shId !=null and shId != ''">
  278. and t.sh_id= #{shId}
  279. </if>
  280. <if test="shType !=null and shType != ''">
  281. and sh.sh_type= #{shType}
  282. </if>
  283. <if test="shObjId !=null and shObjId != ''">
  284. and sh.sh_obj_id= #{shObjId}
  285. </if>
  286. <if test="shObjIds !=null">
  287. and sh.sh_obj_id in
  288. <foreach collection="shObjIds" item="item" index="index" open="(" close=")" separator=",">
  289. #{item}
  290. </foreach>
  291. </if>
  292. <if test="showMobile != null and showMobile != ''">
  293. and t.show_mobile = #{showMobile}
  294. </if>
  295. <if test="averagePrice != null and averagePrice != ''">
  296. and t.average_price = #{averagePrice}
  297. </if>
  298. <if test="miniUnitCode !=null and miniUnitCode != ''">
  299. and t.mini_unit_code= #{miniUnitCode}
  300. </if>
  301. <if test="miniUnitStock !=null and miniUnitStock != ''">
  302. and t.mini_unit_stock= #{miniUnitStock}
  303. </if>
  304. <if test="miniStock !=null and miniStock != ''">
  305. and t.mini_stock= #{miniStock}
  306. </if>
  307. <if test="isShow !=null and isShow != ''">
  308. and sh.is_show= #{isShow}
  309. </if>
  310. <if test="isFixed !=null and isFixed != ''">
  311. and t.is_fixed= #{isFixed}
  312. </if>
  313. <if test="resOrderType == '20000'">
  314. and t.stock > 0
  315. </if>
  316. order by t.create_time desc,t.res_id DESC
  317. <if test="page != -1 and page != null ">
  318. limit #{page}, #{row}
  319. </if>
  320. </select>
  321. <!-- 修改资源信息 add by wuxw 2018-07-03 -->
  322. <update id="updateResourceStoreInfoInstance" parameterType="Map">
  323. update resource_store t set t.status_cd = #{statusCd}
  324. <if test="newBId != null and newBId != ''">
  325. ,t.b_id = #{newBId}
  326. </if>
  327. <if test="resName !=null and resName != ''">
  328. , t.res_name= #{resName}
  329. </if>
  330. <if test="price !=null and price != ''">
  331. , t.price= #{price}
  332. </if>
  333. <if test="rstId !=null and rstId != ''">
  334. , t.rst_id= #{rstId}
  335. </if>
  336. <if test="parentRstId !=null and parentRstId != ''">
  337. , t.parent_rst_id= #{parentRstId}
  338. </if>
  339. <if test="rssId !=null and rssId != ''">
  340. , t.rss_id= #{rssId}
  341. </if>
  342. <if test="outLowPrice !=null and outLowPrice != ''">
  343. , t.out_low_price= #{outLowPrice}
  344. </if>
  345. <if test="outHighPrice !=null and outHighPrice != ''">
  346. , t.out_high_price= #{outHighPrice}
  347. </if>
  348. <if test="unitCode !=null and unitCode != ''">
  349. , t.unit_code= #{unitCode}
  350. </if>
  351. <if test="showMobile !=null and showMobile != ''">
  352. , t.show_mobile= #{showMobile}
  353. </if>
  354. <if test="remark !=null and remark != ''">
  355. , t.remark= #{remark}
  356. </if>
  357. <if test="resCode !=null and resCode != ''">
  358. , t.res_code= #{resCode}
  359. </if>
  360. <if test="description !=null and description != ''">
  361. , t.description= #{description}
  362. </if>
  363. <if test="storeId !=null and storeId != ''">
  364. , t.store_id= #{storeId}
  365. </if>
  366. , t.stock= #{stock}
  367. <if test="warningStock !=null and warningStock != ''">
  368. , t.warning_stock= #{warningStock}
  369. </if>
  370. <if test="shId !=null and shId != ''">
  371. , t.sh_id= #{shId}
  372. </if>
  373. <if test="averagePrice !=null and averagePrice != ''">
  374. , t.average_price= #{averagePrice}
  375. </if>
  376. <if test="miniUnitCode !=null and miniUnitCode != ''">
  377. , t.mini_unit_code= #{miniUnitCode}
  378. </if>
  379. <if test="miniUnitStock !=null and miniUnitStock != ''">
  380. , t.mini_unit_stock= #{miniUnitStock}
  381. </if>
  382. <if test="miniStock !=null and miniStock != ''">
  383. , t.mini_stock= #{miniStock}
  384. </if>
  385. <if test="isFixed !=null and isFixed != ''">
  386. , t.is_fixed= #{isFixed}
  387. </if>
  388. where 1=1
  389. <if test="bId !=null and bId != ''">
  390. and t.b_id= #{bId}
  391. </if>
  392. <if test="resId !=null and resId != ''">
  393. and t.res_id= #{resId}
  394. </if>
  395. </update>
  396. <!-- 查询资源数量 add by wuxw 2018-07-03 -->
  397. <select id="queryResourceStoresCount" parameterType="Map" resultType="Map">
  398. select count(1) count
  399. from resource_store t
  400. left join storehouse sh on t.sh_id = sh.sh_id and t.store_id = sh.store_id and sh.status_cd = '0'
  401. where 1 =1
  402. <if test="resName !=null and resName != ''">
  403. and t.res_name like concat('%',#{resName},'%')
  404. </if>
  405. <if test="name != null and name != ''">
  406. and t.res_name = #{name}
  407. </if>
  408. <if test="rstId !=null and rstId != ''">
  409. and t.rst_id= #{rstId}
  410. </if>
  411. <if test="parentRstId !=null and parentRstId != ''">
  412. and t.parent_rst_id= #{parentRstId}
  413. </if>
  414. <if test="rssId !=null and rssId != ''">
  415. and t.rss_id= #{rssId}
  416. </if>
  417. <if test="price !=null and price != ''">
  418. and t.price= #{price}
  419. </if>
  420. <if test="resCode !=null and resCode != ''">
  421. and t.res_code like concat('%',#{resCode},'%')
  422. </if>
  423. <if test="description !=null and description != ''">
  424. and t.description= #{description}
  425. </if>
  426. <if test="statusCd !=null and statusCd != ''">
  427. and t.status_cd= #{statusCd}
  428. </if>
  429. <if test="storeId !=null and storeId != ''">
  430. and t.store_id= #{storeId}
  431. </if>
  432. <if test="stock !=null and stock != ''">
  433. and t.stock= #{stock}
  434. </if>
  435. <if test="warningStock !=null and warningStock != ''">
  436. and t.warning_stock= #{warningStock}
  437. </if>
  438. <if test="bId !=null and bId != ''">
  439. and t.b_id= #{bId}
  440. </if>
  441. <if test="resId !=null and resId != ''">
  442. and t.res_id= #{resId}
  443. </if>
  444. <if test="unitCode !=null and unitCode != ''">
  445. and t.unit_code= #{unitCode}
  446. </if>
  447. <if test="remark !=null and remark != ''">
  448. and t.remark= #{remark}
  449. </if>
  450. <if test="outLowPrice !=null and outLowPrice != ''">
  451. and t.out_low_price= #{outLowPrice}
  452. </if>
  453. <if test="outHighPrice !=null and outHighPrice != ''">
  454. and t.out_high_price= #{outHighPrice}
  455. </if>
  456. <if test="showMobile !=null and showMobile != ''">
  457. and t.show_mobile= #{showMobile}
  458. </if>
  459. <if test="shId !=null and shId != ''">
  460. and t.sh_id= #{shId}
  461. </if>
  462. <if test="shObjId !=null and shObjId != ''">
  463. and sh.sh_obj_id= #{shObjId}
  464. </if>
  465. <if test="shObjIds !=null">
  466. and sh.sh_obj_id in
  467. <foreach collection="shObjIds" item="item" index="index" open="(" close=")" separator=",">
  468. #{item}
  469. </foreach>
  470. </if>
  471. <if test="shType !=null and shType != ''">
  472. and sh.sh_type= #{shType}
  473. </if>
  474. <if test="averagePrice != null and averagePrice != ''">
  475. and t.average_price = #{averagePrice}
  476. </if>
  477. <if test="miniUnitCode !=null and miniUnitCode != ''">
  478. and t.mini_unit_code= #{miniUnitCode}
  479. </if>
  480. <if test="miniUnitStock !=null and miniUnitStock != ''">
  481. and t.mini_unit_stock= #{miniUnitStock}
  482. </if>
  483. <if test="miniStock !=null and miniStock != ''">
  484. and t.mini_stock= #{miniStock}
  485. </if>
  486. <if test="isShow !=null and isShow != ''">
  487. and sh.is_show= #{isShow}
  488. </if>
  489. <if test="isFixed !=null and isFixed != ''">
  490. and t.is_fixed= #{isFixed}
  491. </if>
  492. <if test="resOrderType == '20000'">
  493. and t.stock > 0
  494. </if>
  495. </select>
  496. <!-- 查询资源信息 add by wuxw 2018-07-03 -->
  497. <select id="queryResourceStoresTotalPrice" parameterType="Map" resultType="Map">
  498. select IFNULL(sum(total_price),0) as totalPrice from(
  499. select rsts.times_id,rsts.res_code,rsts.stock,rsts.price,rsts.stock*rsts.price total_price
  500. from resource_store t
  501. inner join resource_store_times rsts on t.res_code = rsts.res_code and rsts.status_cd = '0'
  502. left join resource_store_type rst on t.rst_id = rst.rst_id and rst.status_cd = '0'
  503. left join resource_store_type rst1 on t.parent_rst_id = rst1.rst_id and rst1.status_cd = '0'
  504. left join resource_store_specification rss on t.rss_id = rss.rss_id and rss.status_cd = '0'
  505. left join storehouse sh on t.sh_id = sh.sh_id and t.store_id = sh.store_id and sh.status_cd = '0'
  506. left join t_dict td on t.unit_code = td.status_cd and td.table_name = 'resource_store' and td.table_columns =
  507. 'unit_code'
  508. left join t_dict td1 on t.mini_unit_code = td1.status_cd and td1.table_name = 'resource_store' and
  509. td1.table_columns = 'unit_code'
  510. left join t_dict td2 on t.is_fixed = td2.status_cd and td2.table_name='resource_store' and td2.table_columns =
  511. 'is_fixed'
  512. where 1 = 1
  513. <if test="resName !=null and resName != ''">
  514. and t.res_name like concat('%',#{resName},'%')
  515. </if>
  516. <if test="name != null and name != ''">
  517. and t.res_name = #{name}
  518. </if>
  519. <if test="price !=null and price != ''">
  520. and t.price= #{price}
  521. </if>
  522. <if test="rstId !=null and rstId != ''">
  523. and t.rst_id= #{rstId}
  524. </if>
  525. <if test="parentRstId !=null and parentRstId != ''">
  526. and t.parent_rst_id= #{parentRstId}
  527. </if>
  528. <if test="rssId !=null and rssId != ''">
  529. and t.rss_id= #{rssId}
  530. </if>
  531. <if test="outLowPrice !=null and outLowPrice != ''">
  532. and t.out_low_price = #{outLowPrice}
  533. </if>
  534. <if test="outHighPrice != null and outHighPrice != ''">
  535. and t.out_high_price = #{outHighPrice}
  536. </if>
  537. <if test="unitCode != null and unitCode != ''">
  538. and t.unit_code = #{unitCode}
  539. </if>
  540. <if test="remark != null and remark != ''">
  541. and t.remark = #{remark}
  542. </if>
  543. <if test="resCode !=null and resCode != ''">
  544. and t.res_code like concat('%',#{resCode},'%')
  545. </if>
  546. <if test="description !=null and description != ''">
  547. and t.description= #{description}
  548. </if>
  549. <if test="statusCd !=null and statusCd != ''">
  550. and t.status_cd= #{statusCd}
  551. </if>
  552. <if test="storeId !=null and storeId != ''">
  553. and t.store_id= #{storeId}
  554. </if>
  555. <if test="stock !=null and stock != ''">
  556. and t.stock= #{stock}
  557. </if>
  558. <if test="warningStock !=null and warningStock != ''">
  559. and t.warning_stock= #{warningStock}
  560. </if>
  561. <if test="bId !=null and bId != ''">
  562. and t.b_id= #{bId}
  563. </if>
  564. <if test="resId !=null and resId != ''">
  565. and t.res_id= #{resId}
  566. </if>
  567. <if test="shId !=null and shId != ''">
  568. and t.sh_id= #{shId}
  569. </if>
  570. <if test="shType !=null and shType != ''">
  571. and sh.sh_type= #{shType}
  572. </if>
  573. <if test="shObjId !=null and shObjId != ''">
  574. and sh.sh_obj_id= #{shObjId}
  575. </if>
  576. <if test="shObjIds !=null">
  577. and sh.sh_obj_id in
  578. <foreach collection="shObjIds" item="item" index="index" open="(" close=")" separator=",">
  579. #{item}
  580. </foreach>
  581. </if>
  582. <if test="showMobile != null and showMobile != ''">
  583. and t.show_mobile = #{showMobile}
  584. </if>
  585. <if test="averagePrice != null and averagePrice != ''">
  586. and t.average_price = #{averagePrice}
  587. </if>
  588. <if test="miniUnitCode !=null and miniUnitCode != ''">
  589. and t.mini_unit_code= #{miniUnitCode}
  590. </if>
  591. <if test="miniUnitStock !=null and miniUnitStock != ''">
  592. and t.mini_unit_stock= #{miniUnitStock}
  593. </if>
  594. <if test="miniStock !=null and miniStock != ''">
  595. and t.mini_stock= #{miniStock}
  596. </if>
  597. <if test="isShow !=null and isShow != ''">
  598. and sh.is_show= #{isShow}
  599. </if>
  600. <if test="isFixed !=null and isFixed != ''">
  601. and t.is_fixed= #{isFixed}
  602. </if>
  603. <if test="resOrderType == '20000'">
  604. and t.stock > 0
  605. </if>
  606. group by rsts.times_id,rsts.res_code,rsts.stock,rsts.price
  607. <if test="page != -1 and page != null ">
  608. limit #{page}, #{row}
  609. </if>
  610. )w
  611. </select>
  612. </mapper>