<?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.ltkj.mall.mapper.MallOrderGoodsMapper">
|
|
<resultMap type="MallOrderGoods" id="MallOrderGoodsResult">
|
<result property="id" column="id"/>
|
<result property="orderId" column="order_id"/>
|
<result property="goodsId" column="goods_id"/>
|
<result property="goodsName" column="goods_name"/>
|
<result property="goodsSn" column="goods_sn"/>
|
<result property="productId" column="product_id"/>
|
<result property="number" column="number"/>
|
<result property="price" column="price"/>
|
<result property="specifications" column="specifications"/>
|
<result property="picUrl" column="pic_url"/>
|
<result property="comment" column="comment"/>
|
<result property="purchasePrice" column="purchase_price"/>
|
<result property="counterPrice" column="counter_price"/>
|
<result property="createTime" column="create_time"/>
|
<result property="createBy" column="create_by"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="deleted" column="deleted"/>
|
</resultMap>
|
|
<sql id="selectMallOrderGoodsVo">
|
select id, order_id, goods_id, goods_name, goods_sn, product_id, number, price, specifications, pic_url, comment, purchase_price, counter_price, create_time, create_by, update_time, update_by, deleted
|
from mall_order_goods
|
</sql>
|
|
<select id="selectMallOrderGoodsList" parameterType="MallOrderGoods" resultMap="MallOrderGoodsResult">
|
<include refid="selectMallOrderGoodsVo"/>
|
<where>
|
<if test="orderId != null ">
|
and order_id = #{orderId}
|
</if>
|
<if test="goodsId != null ">
|
and goods_id = #{goodsId}
|
</if>
|
<if test="goodsName != null and goodsName != ''">
|
and goods_name like concat('%', #{goodsName}, '%')
|
</if>
|
<if test="goodsSn != null and goodsSn != ''">
|
and goods_sn = #{goodsSn}
|
</if>
|
<if test="productId != null ">
|
and product_id = #{productId}
|
</if>
|
<if test="number != null ">
|
and number = #{number}
|
</if>
|
<if test="price != null ">
|
and price = #{price}
|
</if>
|
<if test="specifications != null and specifications != ''">
|
and specifications = #{specifications}
|
</if>
|
<if test="picUrl != null and picUrl != ''">
|
and pic_url = #{picUrl}
|
</if>
|
<if test="comment != null ">
|
and comment = #{comment}
|
</if>
|
<if test="purchasePrice != null ">
|
and purchase_price = #{purchasePrice}
|
</if>
|
<if test="counterPrice != null ">
|
and counter_price = #{counterPrice}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectMallOrderGoodsById" parameterType="Long"
|
resultMap="MallOrderGoodsResult">
|
<include refid="selectMallOrderGoodsVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertMallOrderGoods" parameterType="MallOrderGoods" useGeneratedKeys="true"
|
keyProperty="id">
|
insert into mall_order_goods
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="orderId != null">order_id,
|
</if>
|
<if test="goodsId != null">goods_id,
|
</if>
|
<if test="goodsName != null and goodsName != ''">goods_name,
|
</if>
|
<if test="goodsSn != null and goodsSn != ''">goods_sn,
|
</if>
|
<if test="productId != null">product_id,
|
</if>
|
<if test="number != null">number,
|
</if>
|
<if test="price != null">price,
|
</if>
|
<if test="specifications != null and specifications != ''">specifications,
|
</if>
|
<if test="picUrl != null and picUrl != ''">pic_url,
|
</if>
|
<if test="comment != null">comment,
|
</if>
|
<if test="purchasePrice != null">purchase_price,
|
</if>
|
<if test="counterPrice != null">counter_price,
|
</if>
|
<if test="createTime != null">create_time,
|
</if>
|
<if test="createBy != null">create_by,
|
</if>
|
<if test="updateTime != null">update_time,
|
</if>
|
<if test="updateBy != null">update_by,
|
</if>
|
<if test="deleted != null">deleted,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="orderId != null">#{orderId},
|
</if>
|
<if test="goodsId != null">#{goodsId},
|
</if>
|
<if test="goodsName != null and goodsName != ''">#{goodsName},
|
</if>
|
<if test="goodsSn != null and goodsSn != ''">#{goodsSn},
|
</if>
|
<if test="productId != null">#{productId},
|
</if>
|
<if test="number != null">#{number},
|
</if>
|
<if test="price != null">#{price},
|
</if>
|
<if test="specifications != null and specifications != ''">#{specifications},
|
</if>
|
<if test="picUrl != null and picUrl != ''">#{picUrl},
|
</if>
|
<if test="comment != null">#{comment},
|
</if>
|
<if test="purchasePrice != null">#{purchasePrice},
|
</if>
|
<if test="counterPrice != null">#{counterPrice},
|
</if>
|
<if test="createTime != null">#{createTime},
|
</if>
|
<if test="createBy != null">#{createBy},
|
</if>
|
<if test="updateTime != null">#{updateTime},
|
</if>
|
<if test="updateBy != null">#{updateBy},
|
</if>
|
<if test="deleted != null">#{deleted},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="updateMallOrderGoods" parameterType="MallOrderGoods">
|
update mall_order_goods
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="orderId != null">order_id =
|
#{orderId},
|
</if>
|
<if test="goodsId != null">goods_id =
|
#{goodsId},
|
</if>
|
<if test="goodsName != null and goodsName != ''">goods_name =
|
#{goodsName},
|
</if>
|
<if test="goodsSn != null and goodsSn != ''">goods_sn =
|
#{goodsSn},
|
</if>
|
<if test="productId != null">product_id =
|
#{productId},
|
</if>
|
<if test="number != null">number =
|
#{number},
|
</if>
|
<if test="price != null">price =
|
#{price},
|
</if>
|
<if test="specifications != null and specifications != ''">specifications =
|
#{specifications},
|
</if>
|
<if test="picUrl != null and picUrl != ''">pic_url =
|
#{picUrl},
|
</if>
|
<if test="comment != null">comment =
|
#{comment},
|
</if>
|
<if test="purchasePrice != null">purchase_price =
|
#{purchasePrice},
|
</if>
|
<if test="counterPrice != null">counter_price =
|
#{counterPrice},
|
</if>
|
<if test="createTime != null">create_time =
|
#{createTime},
|
</if>
|
<if test="createBy != null">create_by =
|
#{createBy},
|
</if>
|
<if test="updateTime != null">update_time =
|
#{updateTime},
|
</if>
|
<if test="updateBy != null">update_by =
|
#{updateBy},
|
</if>
|
<if test="deleted != null">deleted =
|
#{deleted},
|
</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteMallOrderGoodsById" parameterType="Long">
|
delete
|
from mall_order_goods where id = #{id}
|
</delete>
|
|
<delete id="deleteMallOrderGoodsByIds" parameterType="String">
|
delete from mall_order_goods where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|