FsIntegralGoodsMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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="sort" column="sort" />
  16. <result property="stock" column="stock" />
  17. <result property="descs" column="descs" />
  18. <result property="createTime" column="create_time" />
  19. <result property="barCode" column="bar_code" />
  20. </resultMap>
  21. <sql id="selectFsIntegralGoodsVo">
  22. select goods_id, img_url, images,bar_code, goods_name, ot_price, goods_type, status, integral, sort, stock, descs, create_time from fs_integral_goods
  23. </sql>
  24. <select id="selectFsIntegralGoodsList" parameterType="FsIntegralGoods" resultMap="FsIntegralGoodsResult">
  25. <include refid="selectFsIntegralGoodsVo"/>
  26. <where>
  27. <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
  28. <if test="goodsType != null "> and goods_type = #{goodsType}</if>
  29. <if test="status != null "> and status = #{status}</if>
  30. <if test="integral != null "> and integral = #{integral}</if>
  31. <if test="createTime != null "> and create_time = #{createTime}</if>
  32. </where>
  33. </select>
  34. <select id="selectFsIntegralGoodsByGoodsId" parameterType="Long" resultMap="FsIntegralGoodsResult">
  35. <include refid="selectFsIntegralGoodsVo"/>
  36. where goods_id = #{goodsId}
  37. </select>
  38. <insert id="insertFsIntegralGoods" parameterType="FsIntegralGoods">
  39. insert into fs_integral_goods
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="goodsId != null">goods_id,</if>
  42. <if test="imgUrl != null and imgUrl != ''">img_url,</if>
  43. <if test="images != null">images,</if>
  44. <if test="goodsName != null and goodsName != ''">goods_name,</if>
  45. <if test="otPrice != null">ot_price,</if>
  46. <if test="goodsType != null">goods_type,</if>
  47. <if test="status != null">status,</if>
  48. <if test="integral != null">integral,</if>
  49. <if test="sort != null">sort,</if>
  50. <if test="stock != null">stock,</if>
  51. <if test="descs != null">descs,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="barCode != null">bar_code,</if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="goodsId != null">#{goodsId},</if>
  57. <if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
  58. <if test="images != null">#{images},</if>
  59. <if test="goodsName != null and goodsName != ''">#{goodsName},</if>
  60. <if test="otPrice != null">#{otPrice},</if>
  61. <if test="goodsType != null">#{goodsType},</if>
  62. <if test="status != null">#{status},</if>
  63. <if test="integral != null">#{integral},</if>
  64. <if test="sort != null">#{sort},</if>
  65. <if test="stock != null">#{stock},</if>
  66. <if test="descs != null">#{descs},</if>
  67. <if test="createTime != null">#{createTime},</if>
  68. <if test="barCode != null">#{barCode},</if>
  69. </trim>
  70. </insert>
  71. <update id="updateFsIntegralGoods" parameterType="FsIntegralGoods">
  72. update fs_integral_goods
  73. <trim prefix="SET" suffixOverrides=",">
  74. <if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
  75. <if test="images != null">images = #{images},</if>
  76. <if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
  77. <if test="otPrice != null">ot_price = #{otPrice},</if>
  78. <if test="goodsType != null">goods_type = #{goodsType},</if>
  79. <if test="status != null">status = #{status},</if>
  80. <if test="integral != null">integral = #{integral},</if>
  81. <if test="sort != null">sort = #{sort},</if>
  82. <if test="stock != null">stock = #{stock},</if>
  83. <if test="descs != null">descs = #{descs},</if>
  84. <if test="createTime != null">create_time = #{createTime},</if>
  85. <if test="barCode != null">bar_code = #{barCode},</if>
  86. </trim>
  87. where goods_id = #{goodsId}
  88. </update>
  89. <delete id="deleteFsIntegralGoodsByGoodsId" parameterType="Long">
  90. delete from fs_integral_goods where goods_id = #{goodsId}
  91. </delete>
  92. <delete id="deleteFsIntegralGoodsByGoodsIds" parameterType="String">
  93. delete from fs_integral_goods where goods_id in
  94. <foreach item="goodsId" collection="array" open="(" separator="," close=")">
  95. #{goodsId}
  96. </foreach>
  97. </delete>
  98. <!-- 查询指定积分区间的商品 -->
  99. <select id="selectFsIntegralGoodsByStage" parameterType="com.fs.his.param.FsIntegralGoodsListUParam" resultMap="FsIntegralGoodsResult">
  100. SELECT
  101. g.goods_id,
  102. g.goods_name,
  103. g.img_url ,
  104. g.integral,
  105. g.status,
  106. g.ot_price
  107. FROM fs_integral_goods g
  108. WHERE g.status = 1
  109. <![CDATA[
  110. AND g.integral >= #{minPoints}
  111. AND g.integral <= #{maxPoints}
  112. ]]>
  113. ORDER BY RAND()
  114. </select>
  115. </mapper>