| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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.live.mapper.LiveGoodsMapper">
-
- <resultMap type="LiveGoods" id="LiveGoodsResult">
- <result property="goodsId" column="goods_id" />
- <result property="liveId" column="live_id" />
- <result property="goodsName" column="goods_name" />
- <result property="goodsDesc" column="goods_desc" />
- <result property="imgUrl" column="img_url" />
- <result property="images" column="images" />
- <result property="price" column="price" />
- <result property="opPrice" column="op_price" />
- <result property="status" column="status" />
- <result property="stock" column="stock" />
- <result property="sort" column="sort" />
- <result property="createTime" column="create_time" />
- <result property="createBy" column="create_by" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- </resultMap>
- <sql id="selectLiveGoodsVo">
- select goods_id, live_id, goods_name, goods_desc, img_url, images, price, op_price, status, stock, sort, create_time, create_by, update_by, update_time, remark from live_goods
- </sql>
- <select id="selectLiveGoodsList" parameterType="LiveGoods" resultMap="LiveGoodsResult">
- <include refid="selectLiveGoodsVo"/>
- <where>
- <if test="liveId != null "> and live_id = #{liveId}</if>
- <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
- <if test="goodsDesc != null and goodsDesc != ''"> and goods_desc = #{goodsDesc}</if>
- <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
- <if test="images != null and images != ''"> and images = #{images}</if>
- <if test="price != null "> and price = #{price}</if>
- <if test="opPrice != null "> and op_price = #{opPrice}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="stock != null "> and stock = #{stock}</if>
- <if test="sort != null "> and sort = #{sort}</if>
- </where>
- </select>
-
- <select id="selectLiveGoodsByGoodsId" parameterType="Long" resultMap="LiveGoodsResult">
- <include refid="selectLiveGoodsVo"/>
- where goods_id = #{goodsId}
- </select>
-
- <insert id="insertLiveGoods" parameterType="LiveGoods" useGeneratedKeys="true" keyProperty="goodsId">
- insert into live_goods
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="liveId != null">live_id,</if>
- <if test="goodsName != null">goods_name,</if>
- <if test="goodsDesc != null">goods_desc,</if>
- <if test="imgUrl != null">img_url,</if>
- <if test="images != null">images,</if>
- <if test="price != null">price,</if>
- <if test="opPrice != null">op_price,</if>
- <if test="status != null">status,</if>
- <if test="stock != null">stock,</if>
- <if test="sort != null">sort,</if>
- <if test="createTime != null">create_time,</if>
- <if test="createBy != null">create_by,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="liveId != null">#{liveId},</if>
- <if test="goodsName != null">#{goodsName},</if>
- <if test="goodsDesc != null">#{goodsDesc},</if>
- <if test="imgUrl != null">#{imgUrl},</if>
- <if test="images != null">#{images},</if>
- <if test="price != null">#{price},</if>
- <if test="opPrice != null">#{opPrice},</if>
- <if test="status != null">#{status},</if>
- <if test="stock != null">#{stock},</if>
- <if test="sort != null">#{sort},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateLiveGoods" parameterType="LiveGoods">
- update live_goods
- <trim prefix="SET" suffixOverrides=",">
- <if test="liveId != null">live_id = #{liveId},</if>
- <if test="goodsName != null">goods_name = #{goodsName},</if>
- <if test="goodsDesc != null">goods_desc = #{goodsDesc},</if>
- <if test="imgUrl != null">img_url = #{imgUrl},</if>
- <if test="images != null">images = #{images},</if>
- <if test="price != null">price = #{price},</if>
- <if test="opPrice != null">op_price = #{opPrice},</if>
- <if test="status != null">status = #{status},</if>
- <if test="stock != null">stock = #{stock},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where goods_id = #{goodsId}
- </update>
- <delete id="deleteLiveGoodsByGoodsId" parameterType="Long">
- delete from live_goods where goods_id = #{goodsId}
- </delete>
- <delete id="deleteLiveGoodsByGoodsIds" parameterType="String">
- delete from live_goods where goods_id in
- <foreach item="goodsId" collection="array" open="(" separator="," close=")">
- #{goodsId}
- </foreach>
- </delete>
- </mapper>
|