FsIntegralGoodsMapper.xml 7.8 KB

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