| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fs.his.mapper.FsIntegralGoodsMapper">
- <resultMap type="FsIntegralGoods" id="FsIntegralGoodsResult">
- <result property="goodsId" column="goods_id" />
- <result property="imgUrl" column="img_url" />
- <result property="images" column="images" />
- <result property="goodsName" column="goods_name" />
- <result property="otPrice" column="ot_price" />
- <result property="goodsType" column="goods_type" />
- <result property="status" column="status" />
- <result property="integral" column="integral" />
- <result property="sort" column="sort" />
- <result property="stock" column="stock" />
- <result property="descs" column="descs" />
- <result property="createTime" column="create_time" />
- <result property="barCode" column="bar_code" />
- </resultMap>
- <sql id="selectFsIntegralGoodsVo">
- 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
- </sql>
- <select id="selectFsIntegralGoodsList" parameterType="FsIntegralGoods" resultMap="FsIntegralGoodsResult">
- <include refid="selectFsIntegralGoodsVo"/>
- <where>
- <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
- <if test="goodsType != null "> and goods_type = #{goodsType}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="integral != null "> and integral = #{integral}</if>
- <if test="createTime != null "> and create_time = #{createTime}</if>
- </where>
- </select>
- <select id="selectFsIntegralGoodsByGoodsId" parameterType="Long" resultMap="FsIntegralGoodsResult">
- <include refid="selectFsIntegralGoodsVo"/>
- where goods_id = #{goodsId}
- </select>
- <insert id="insertFsIntegralGoods" parameterType="FsIntegralGoods">
- insert into fs_integral_goods
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="goodsId != null">goods_id,</if>
- <if test="imgUrl != null and imgUrl != ''">img_url,</if>
- <if test="images != null">images,</if>
- <if test="goodsName != null and goodsName != ''">goods_name,</if>
- <if test="otPrice != null">ot_price,</if>
- <if test="goodsType != null">goods_type,</if>
- <if test="status != null">status,</if>
- <if test="integral != null">integral,</if>
- <if test="sort != null">sort,</if>
- <if test="stock != null">stock,</if>
- <if test="descs != null">descs,</if>
- <if test="createTime != null">create_time,</if>
- <if test="barCode != null">bar_code,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="goodsId != null">#{goodsId},</if>
- <if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
- <if test="images != null">#{images},</if>
- <if test="goodsName != null and goodsName != ''">#{goodsName},</if>
- <if test="otPrice != null">#{otPrice},</if>
- <if test="goodsType != null">#{goodsType},</if>
- <if test="status != null">#{status},</if>
- <if test="integral != null">#{integral},</if>
- <if test="sort != null">#{sort},</if>
- <if test="stock != null">#{stock},</if>
- <if test="descs != null">#{descs},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="barCode != null">#{barCode},</if>
- </trim>
- </insert>
- <update id="updateFsIntegralGoods" parameterType="FsIntegralGoods">
- update fs_integral_goods
- <trim prefix="SET" suffixOverrides=",">
- <if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
- <if test="images != null">images = #{images},</if>
- <if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
- <if test="otPrice != null">ot_price = #{otPrice},</if>
- <if test="goodsType != null">goods_type = #{goodsType},</if>
- <if test="status != null">status = #{status},</if>
- <if test="integral != null">integral = #{integral},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="stock != null">stock = #{stock},</if>
- <if test="descs != null">descs = #{descs},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="barCode != null">bar_code = #{barCode},</if>
- </trim>
- where goods_id = #{goodsId}
- </update>
- <delete id="deleteFsIntegralGoodsByGoodsId" parameterType="Long">
- delete from fs_integral_goods where goods_id = #{goodsId}
- </delete>
- <delete id="deleteFsIntegralGoodsByGoodsIds" parameterType="String">
- delete from fs_integral_goods where goods_id in
- <foreach item="goodsId" collection="array" open="(" separator="," close=")">
- #{goodsId}
- </foreach>
- </delete>
- <!-- 查询指定积分区间的商品 -->
- <select id="selectFsIntegralGoodsByStage" parameterType="com.fs.his.param.FsIntegralGoodsListUParam" resultMap="FsIntegralGoodsResult">
- SELECT
- g.goods_id,
- g.goods_name,
- g.img_url ,
- g.integral,
- g.status,
- g.ot_price
- FROM fs_integral_goods g
- WHERE g.status = 1
- <![CDATA[
- AND g.integral >= #{minPoints}
- AND g.integral <= #{maxPoints}
- ]]>
- ORDER BY RAND()
- </select>
- </mapper>
|