ResourceStoreServiceDaoImplMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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(
  9. res_name,operate,price,res_code,description,store_id,stock,b_id,res_id
  10. ) values (
  11. #{resName},#{operate},#{price},#{resCode},#{description},#{storeId},#{stock},#{bId},#{resId}
  12. )
  13. </insert>
  14. <!-- 查询资源信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessResourceStoreInfo" parameterType="Map" resultType="Map">
  16. select t.res_name,t.res_name resName,t.operate,t.price,t.res_code,t.res_code
  17. resCode,t.description,t.store_id,t.store_id storeId,t.stock,t.b_id,t.b_id bId,t.res_id,t.res_id resId
  18. from business_resource_store t
  19. where 1 =1
  20. <if test="resName !=null and resName != ''">
  21. and t.res_name= #{resName}
  22. </if>
  23. <if test="operate !=null and operate != ''">
  24. and t.operate= #{operate}
  25. </if>
  26. <if test="price !=null and price != ''">
  27. and t.price= #{price}
  28. </if>
  29. <if test="resCode !=null and resCode != ''">
  30. and t.res_code= #{resCode}
  31. </if>
  32. <if test="description !=null and description != ''">
  33. and t.description= #{description}
  34. </if>
  35. <if test="storeId !=null and storeId != ''">
  36. and t.store_id= #{storeId}
  37. </if>
  38. <if test="stock !=null and stock != ''">
  39. and t.stock= #{stock}
  40. </if>
  41. <if test="bId !=null and bId != ''">
  42. and t.b_id= #{bId}
  43. </if>
  44. <if test="resId !=null and resId != ''">
  45. and t.res_id= #{resId}
  46. </if>
  47. </select>
  48. <!-- 保存资源信息至 instance表中 add by wuxw 2018-07-03 -->
  49. <insert id="saveResourceStoreInfoInstance" parameterType="Map">
  50. insert into resource_store(
  51. res_name,price,res_code,description,status_cd,store_id,stock,b_id,res_id
  52. ) select t.res_name,t.price,t.res_code,t.description,'0',t.store_id,t.stock,t.b_id,t.res_id from
  53. business_resource_store t where 1=1
  54. <if test="resName !=null and resName != ''">
  55. and t.res_name= #{resName}
  56. </if>
  57. and t.operate= 'ADD'
  58. <if test="price !=null and price != ''">
  59. and t.price= #{price}
  60. </if>
  61. <if test="resCode !=null and resCode != ''">
  62. and t.res_code= #{resCode}
  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="bId !=null and bId != ''">
  74. and t.b_id= #{bId}
  75. </if>
  76. <if test="resId !=null and resId != ''">
  77. and t.res_id= #{resId}
  78. </if>
  79. </insert>
  80. <!-- 查询资源信息 add by wuxw 2018-07-03 -->
  81. <select id="getResourceStoreInfo" parameterType="Map" resultType="Map">
  82. 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
  83. statusCd,t.store_id,t.store_id storeId,t.stock,t.b_id,t.b_id bId,t.res_id,t.res_id resId
  84. from resource_store t
  85. where 1 =1
  86. <if test="resName !=null and resName != ''">
  87. and t.res_name like concat('%',#{resName},'%')
  88. </if>
  89. <if test="price !=null and price != ''">
  90. and t.price= #{price}
  91. </if>
  92. <if test="resCode !=null and resCode != ''">
  93. and t.res_code= #{resCode}
  94. </if>
  95. <if test="description !=null and description != ''">
  96. and t.description= #{description}
  97. </if>
  98. <if test="statusCd !=null and statusCd != ''">
  99. and t.status_cd= #{statusCd}
  100. </if>
  101. <if test="storeId !=null and storeId != ''">
  102. and t.store_id= #{storeId}
  103. </if>
  104. <if test="stock !=null and stock != ''">
  105. and t.stock= #{stock}
  106. </if>
  107. <if test="bId !=null and bId != ''">
  108. and t.b_id= #{bId}
  109. </if>
  110. <if test="resId !=null and resId != ''">
  111. and t.res_id= #{resId}
  112. </if>
  113. <if test="resOrderType == '20000'">
  114. and t.stock > 0
  115. </if>
  116. <if test="page != -1 and page != null ">
  117. limit #{page}, #{row}
  118. </if>
  119. </select>
  120. <!-- 修改资源信息 add by wuxw 2018-07-03 -->
  121. <update id="updateResourceStoreInfoInstance" parameterType="Map">
  122. update resource_store t set t.status_cd = #{statusCd}
  123. <if test="newBId != null and newBId != ''">
  124. ,t.b_id = #{newBId}
  125. </if>
  126. <if test="resName !=null and resName != ''">
  127. , t.res_name= #{resName}
  128. </if>
  129. <if test="price !=null and price != ''">
  130. , t.price= #{price}
  131. </if>
  132. <if test="resCode !=null and resCode != ''">
  133. , t.res_code= #{resCode}
  134. </if>
  135. <if test="description !=null and description != ''">
  136. , t.description= #{description}
  137. </if>
  138. <if test="storeId !=null and storeId != ''">
  139. , t.store_id= #{storeId}
  140. </if>
  141. <if test="stock !=null and stock != ''">
  142. , t.stock= #{stock}
  143. </if>
  144. where 1=1
  145. <if test="bId !=null and bId != ''">
  146. and t.b_id= #{bId}
  147. </if>
  148. <if test="resId !=null and resId != ''">
  149. and t.res_id= #{resId}
  150. </if>
  151. </update>
  152. <!-- 查询资源数量 add by wuxw 2018-07-03 -->
  153. <select id="queryResourceStoresCount" parameterType="Map" resultType="Map">
  154. select count(1) count
  155. from resource_store t
  156. where 1 =1
  157. <if test="resName !=null and resName != ''">
  158. and t.res_name like concat('%',#{resName},'%')
  159. </if>
  160. <if test="price !=null and price != ''">
  161. and t.price= #{price}
  162. </if>
  163. <if test="resCode !=null and resCode != ''">
  164. and t.res_code= #{resCode}
  165. </if>
  166. <if test="description !=null and description != ''">
  167. and t.description= #{description}
  168. </if>
  169. <if test="statusCd !=null and statusCd != ''">
  170. and t.status_cd= #{statusCd}
  171. </if>
  172. <if test="storeId !=null and storeId != ''">
  173. and t.store_id= #{storeId}
  174. </if>
  175. <if test="stock !=null and stock != ''">
  176. and t.stock= #{stock}
  177. </if>
  178. <if test="bId !=null and bId != ''">
  179. and t.b_id= #{bId}
  180. </if>
  181. <if test="resId !=null and resId != ''">
  182. and t.res_id= #{resId}
  183. </if>
  184. <if test="resOrderType == '20000'">
  185. and t.stock > 0
  186. </if>
  187. </select>
  188. </mapper>