FsIntegralGoodsMapper.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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="com.fs.his.mapper.FsIntegralGoodsMapper">
  6. <resultMap type="FsIntegralGoods" id="FsIntegralGoodsResult">
  7. <result property="goodsId" column="goods_id" />
  8. <result property="imgUrl" column="img_url" />
  9. <result property="images" column="images" />
  10. <result property="goodsName" column="goods_name" />
  11. <result property="otPrice" column="ot_price" />
  12. <result property="goodsType" column="goods_type" />
  13. <result property="status" column="status" />
  14. <result property="integral" column="integral" />
  15. <result property="cash" column="cash" />
  16. <result property="sort" column="sort" />
  17. <result property="stock" column="stock" />
  18. <result property="descs" column="descs" />
  19. <result property="createTime" column="create_time" />
  20. <result property="barCode" column="bar_code" />
  21. <result property="appIds" column="app_ids" />
  22. <result property="visibleScope" column="visible_scope" />
  23. </resultMap>
  24. <sql id="selectFsIntegralGoodsVo">
  25. select goods_id, img_url, images,bar_code, goods_name, ot_price, goods_type, status, integral, cash, sort, stock, descs, create_time,app_ids,visible_scope from fs_integral_goods
  26. </sql>
  27. <select id="selectFsIntegralGoodsList" parameterType="FsIntegralGoods" resultMap="FsIntegralGoodsResult">
  28. <include refid="selectFsIntegralGoodsVo"/>
  29. <where>
  30. <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
  31. <if test="goodsType != null "> and goods_type = #{goodsType}</if>
  32. <if test="status != null "> and status = #{status}</if>
  33. <if test="integral != null "> and integral = #{integral}</if>
  34. <if test="cash != null "> and cash = #{cash}</if>
  35. <if test="createTime != null "> and create_time = #{createTime}</if>
  36. </where>
  37. </select>
  38. <select id="selectFsIntegralGoodsByGoodsId" parameterType="Long" resultMap="FsIntegralGoodsResult">
  39. <include refid="selectFsIntegralGoodsVo"/>
  40. where goods_id = #{goodsId}
  41. </select>
  42. <insert id="insertFsIntegralGoods" parameterType="FsIntegralGoods">
  43. insert into fs_integral_goods
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="goodsId != null">goods_id,</if>
  46. <if test="imgUrl != null and imgUrl != ''">img_url,</if>
  47. <if test="images != null">images,</if>
  48. <if test="goodsName != null and goodsName != ''">goods_name,</if>
  49. <if test="otPrice != null">ot_price,</if>
  50. <if test="goodsType != null">goods_type,</if>
  51. <if test="status != null">status,</if>
  52. <if test="integral != null">integral,</if>
  53. <if test="cash != null">cash,</if>
  54. <if test="sort != null">sort,</if>
  55. <if test="stock != null">stock,</if>
  56. <if test="descs != null">descs,</if>
  57. <if test="createTime != null">create_time,</if>
  58. <if test="barCode != null">bar_code,</if>
  59. <if test="appIds != null">app_ids,</if>
  60. <if test="visibleScope != null">visible_scope,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="goodsId != null">#{goodsId},</if>
  64. <if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
  65. <if test="images != null">#{images},</if>
  66. <if test="goodsName != null and goodsName != ''">#{goodsName},</if>
  67. <if test="otPrice != null">#{otPrice},</if>
  68. <if test="goodsType != null">#{goodsType},</if>
  69. <if test="status != null">#{status},</if>
  70. <if test="integral != null">#{integral},</if>
  71. <if test="cash != null">#{cash},</if>
  72. <if test="sort != null">#{sort},</if>
  73. <if test="stock != null">#{stock},</if>
  74. <if test="descs != null">#{descs},</if>
  75. <if test="createTime != null">#{createTime},</if>
  76. <if test="barCode != null">#{barCode},</if>
  77. <if test="appIds != null">#{appIds},</if>
  78. <if test="visibleScope != null">#{visibleScope},</if>
  79. </trim>
  80. </insert>
  81. <update id="updateFsIntegralGoods" parameterType="FsIntegralGoods">
  82. update fs_integral_goods
  83. <trim prefix="SET" suffixOverrides=",">
  84. <if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
  85. <if test="images != null">images = #{images},</if>
  86. <if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
  87. <if test="otPrice != null">ot_price = #{otPrice},</if>
  88. <if test="goodsType != null">goods_type = #{goodsType},</if>
  89. <if test="status != null">status = #{status},</if>
  90. <if test="integral != null">integral = #{integral},</if>
  91. <if test="cash != null">cash = #{cash},</if>
  92. <if test="sort != null">sort = #{sort},</if>
  93. <if test="stock != null">stock = #{stock},</if>
  94. <if test="descs != null">descs = #{descs},</if>
  95. <if test="createTime != null">create_time = #{createTime},</if>
  96. <if test="barCode != null">bar_code = #{barCode},</if>
  97. <if test="appIds != null">app_ids = #{appIds},</if>
  98. <if test="visibleScope != null">visible_scope = #{visibleScope},</if>
  99. </trim>
  100. where goods_id = #{goodsId}
  101. </update>
  102. <delete id="deleteFsIntegralGoodsByGoodsId" parameterType="Long">
  103. delete from fs_integral_goods where goods_id = #{goodsId}
  104. </delete>
  105. <delete id="deleteFsIntegralGoodsByGoodsIds" parameterType="String">
  106. delete from fs_integral_goods where goods_id in
  107. <foreach item="goodsId" collection="array" open="(" separator="," close=")">
  108. #{goodsId}
  109. </foreach>
  110. </delete>
  111. <!-- 查询指定积分区间的商品 -->
  112. <select id="selectFsIntegralGoodsByStage" parameterType="com.fs.his.param.FsIntegralGoodsListUParam" resultMap="FsIntegralGoodsResult">
  113. SELECT
  114. g.goods_id,
  115. g.goods_name,
  116. g.img_url ,
  117. g.integral,
  118. g.cash,
  119. g.status,
  120. g.ot_price
  121. FROM fs_integral_goods g
  122. WHERE g.status = 1
  123. <![CDATA[
  124. AND g.integral >= #{minPoints}
  125. AND g.integral <= #{maxPoints}
  126. ]]>
  127. ORDER BY RAND()
  128. </select>
  129. <select id="getChooseIntegralGoodsListByMap" resultType="com.fs.his.vo.FsIntegralGoodsChooseVO">
  130. select
  131. fig.goods_id,
  132. fig.goods_name,
  133. fig.img_url goodsImg,
  134. fig.integral,
  135. fig.cash,
  136. fig.stock,
  137. sdd.dict_label goodsTypeName
  138. from fs_integral_goods fig
  139. left join sys_dict_data sdd on sdd.dict_type = 'sys_integral_goods_type' and sdd.dict_value = fig.goods_type
  140. where fig.status = 1
  141. <if test="params.goodsName != null and params.goodsName != ''">
  142. and fig.goods_name like concat('%', #{params.goodsName}, '%')
  143. </if>
  144. <if test="params.goodsType != null">
  145. and fig.goods_type = #{params.goodsType}
  146. </if>
  147. <if test="params.goodsIds != null">
  148. and fig.goods_id in
  149. <foreach collection="params.goodsIds" item="goodsId" open="(" separator="," close=")">
  150. #{goodsId}
  151. </foreach>
  152. </if>
  153. </select>
  154. <select id="getFsGoodsVOListByIds" resultType="com.fs.his.vo.FsGoodsVO">
  155. select
  156. 2 as type,
  157. goods_id as id,
  158. goods_name as name,
  159. img_url as imgUrl,
  160. cash as price,
  161. integral as integral
  162. from fs_integral_goods
  163. where goods_id in
  164. <foreach collection="goodsIds" item="goodsId" open="(" separator="," close=")">
  165. #{goodsId}
  166. </foreach>
  167. </select>
  168. <select id="selectAllByGoodsIds" resultType="com.fs.his.vo.FsIntegralGoodsVo">
  169. select * from fs_integral_goods where goods_id in
  170. <foreach item="goodsIds" collection="goodsIds" open="(" separator="," close=")">
  171. #{goodsIds}
  172. </foreach>
  173. </select>
  174. <update id="batchUpdateIntegralGoods">
  175. update fs_integral_goods
  176. <set>
  177. <if test="integral != null">integral = #{integral},</if>
  178. <if test="cash != null">cash = #{cash},</if>
  179. </set>
  180. where goods_id in
  181. <foreach item="goodsId" collection="goodsIds" open="(" separator="," close=")">
  182. #{goodsId}
  183. </foreach>
  184. </update>
  185. </mapper>