123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <?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.kmall.api.dao.ApiOrderGoodsMapper">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.kmall.api.entity.OrderGoodsVo" id="orderGoodsMap">
- <result property="id" column="id"/>
- <result property="order_id" column="order_id"/>
- <result property="goods_id" column="goods_id"/>
- <result property="goods_name" column="goods_name"/>
- <result property="goods_sn" column="goods_sn"/>
- <result property="product_id" column="product_id"/>
- <result property="number" column="number"/>
- <result property="market_price" column="market_price"/>
- <result property="retail_price" column="retail_price"/>
- <result property="goods_specification_name_value" column="goods_specification_name_value"/>
- <result property="is_real" column="is_real"/>
- <result property="goods_specification_ids" column="goods_specification_ids"/>
- <result property="list_pic_url" column="list_pic_url"/>
- <result column="sku" property="sku" jdbcType="VARCHAR" />
- <result column="order_biz_type" property="orderBizType" jdbcType="CHAR" />
- <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
- <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
- <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
- <result property="goodsRate" column="goods_rate"/>
- <result property="settlePrice" column="settle_price"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="storeTopicId" column="store_topic_id"/>
- </resultMap>
- <select id="queryObject" resultMap="orderGoodsMap">
- select g.* from mall_order_goods gwhere g.id = #{value}
- </select>
- <select id="queryList" resultMap="orderGoodsMap">
- select g.*,o.merch_sn,m.store_topic_id 'campTopicId',t.store_topic_id 'distcountTopicId' from mall_order_goods g left join mall_order o on o.id = g.order_id
- left join mk_store_camp_minus m on g.store_topic_id = m.store_topic_id
- left join mk_store_ticket_discount t on g.store_topic_id = t.store_topic_id
- <where>
- <if test="order_id != null and order_id != ''">
- and order_id = #{order_id}
- </if>
- </where>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(*) from mall_order_goods
- </select>
- <insert id="save" parameterType="com.kmall.api.entity.OrderGoodsVo" useGeneratedKeys="true" keyProperty="id">
- insert into mall_order_goods
- (
- `order_id`,
- `goods_id`,
- `goods_name`,
- `goods_sn`,
- `product_id`,
- `number`,
- `market_price`,
- `retail_price`,
- `goods_specification_name_value`,
- `is_real`,
- `goods_specification_ids`,
- `list_pic_url`,
- is_dist_sell_scan,
- store_topic_id,
- <if test="goodsRate != null" >
- goods_rate,
- </if>
- <if test="settlePrice != null" >
- settle_price,
- </if>
- <if test="sku != null" >
- sku,
- </if>
- <if test="orderBizType != null" >
- order_biz_type,
- </if>
- <if test="createrSn != null" >
- creater_sn,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="moderSn != null" >
- moder_sn,
- </if>
- <if test="modTime != null" >
- mod_time
- </if>
- )
- values
- (
- #{order_id},
- #{goods_id},
- #{goods_name},
- #{goods_sn},
- #{product_id},
- #{number},
- #{market_price},
- #{retail_price},
- #{goods_specification_name_value},
- #{is_real},
- #{goods_specification_ids},
- #{list_pic_url},
- 0,
- #{storeTopicId},
- <if test="goodsRate != null" >
- #{goodsRate},
- </if>
- <if test="settlePrice != null" >
- #{settlePrice},
- </if>
- <if test="sku != null" >
- #{sku,jdbcType=VARCHAR},
- </if>
- <if test="orderBizType != null" >
- #{orderBizType,jdbcType=VARCHAR},
- </if>
- <if test="createrSn != null" >
- #{createrSn,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="moderSn != null" >
- #{moderSn,jdbcType=VARCHAR},
- </if>
- <if test="modTime != null" >
- #{modTime,jdbcType=TIMESTAMP}
- </if>
- )
- </insert>
- <update id="update" parameterType="com.kmall.api.entity.OrderGoodsVo">
- update mall_order_goods
- <set>
- <if test="order_id != null">`order_id` = #{order_id},</if>
- <if test="goods_id != null">`goods_id` = #{goods_id},</if>
- <if test="goods_name != null">`goods_name` = #{goods_name},</if>
- <if test="goods_sn != null">`goods_sn` = #{goods_sn},</if>
- <if test="product_id != null">`product_id` = #{product_id},</if>
- <if test="number != null">`number` = #{number},</if>
- <if test="market_price != null">`market_price` = #{market_price},</if>
- <if test="retail_price != null">`retail_price` = #{retail_price},</if>
- <if test="goods_specification_name_value != null">`goods_specification_name_value` =
- #{goods_specification_name_value},
- </if>
- <if test="is_real != null">`is_real` = #{is_real},</if>
- <if test="goods_specification_ids != null">`goods_specification_ids` = #{goods_specification_ids},</if>
- <if test="list_pic_url != null">`list_pic_url` = #{list_pic_url},</if>
- <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
- <if test="settlePrice != null">`settle_price` = #{settlePrice},</if>
- <if test="storeTopicId != null">`store_topic_id` = #{storeTopicId},</if>
- <if test="sku != null" >
- sku = #{sku,jdbcType=VARCHAR},
- </if>
- <if test="orderBizType != null" >
- order_biz_type = #{orderBizType,jdbcType=CHAR},
- </if>
- <if test="createrSn != null" >
- creater_sn = #{createrSn,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="moderSn != null" >
- moder_sn = #{moderSn,jdbcType=VARCHAR},
- </if>
- <if test="modTime != null" >
- mod_time = #{modTime,jdbcType=TIMESTAMP}
- </if>
- </set>
- where id = #{id}
- </update>
- <delete id="delete">
- delete from mall_order_goods where id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall_order_goods where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="queryListByIds" resultMap="orderGoodsMap">
- select a.*
- from mall_order_goods a
- where a.order_id in
- <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
- #{orderId}
- </foreach>
- </select>
- </mapper>
|