123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <?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.admin.dao.OrderGoodsDao">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.kmall.admin.entity.OrderGoodsEntity" id="orderGoodsMap">
- <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="marketPrice" column="market_price"/>
- <result property="retailPrice" column="retail_price"/>
- <result property="taxPrice" column="tax_price"/>
- <result property="goodsSpecificationNameValue" column="goods_specification_name_value"/>
- <result property="isReal" column="is_real"/>
- <result property="goodsSpecificationIds" column="goods_specification_ids"/>
- <result property="listPicUrl" column="list_pic_url"/>
- <result property="sku" column="sku"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.OrderGoodsEntity">
- select * from mall_order_goods where id = #{value}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.OrderGoodsEntity">
- select * from mall_order_goods
- WHERE 1=1
- <if test="orderId != null">
- AND order_id = #{orderId}
- </if>
- <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 WHERE 1=1
- <if test="orderId != null">
- AND order_id = #{orderId}
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.OrderGoodsEntity" 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`
- )
- values
- (
- #{orderId},
- #{goodsId},
- #{goodsName},
- #{goodsSn},
- #{productId},
- #{number},
- #{marketPrice},
- #{retailPrice},
- #{goodsSpecificationNameValue},
- #{isReal},
- #{goodsSpecificationIds},
- #{listPicUrl}
- )
- </insert>
- <insert id="saveOrderGoodsVo" 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`,
- `discounted_price`,
- `actual_payment_amount`,
- `goods_specification_name_value`,
- `is_real`,
- `goods_specification_ids`,
- `list_pic_url`,
- is_dist_sell_scan,
- tax_price,
- 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="activity != null">
- activity,
- </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},
- #{discountedPrice},
- #{actualPaymentAmount},
- #{goods_specification_name_value},
- #{is_real},
- #{goods_specification_ids},
- #{list_pic_url},
- 0,
- #{taxPrice},
- #{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="activity != null">
- #{activity},
- </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.admin.entity.OrderGoodsEntity">
- update mall_order_goods
- <set>
- <if test="orderId != null">`order_id` = #{orderId},</if>
- <if test="goodsId != null">`goods_id` = #{goodsId},</if>
- <if test="goodsName != null">`goods_name` = #{goodsName},</if>
- <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
- <if test="productId != null">`product_id` = #{productId},</if>
- <if test="number != null">`number` = #{number},</if>
- <if test="marketPrice != null">`market_price` = #{marketPrice},</if>
- <if test="retailPrice != null">`retail_price` = #{retailPrice},</if>
- <if test="goodsSpecificationNameValue != null">`goods_specification_name_value` =
- #{goodsSpecificationNameValue},
- </if>
- <if test="isReal != null">`is_real` = #{isReal},</if>
- <if test="goodsSpecificationIds != null">`goods_specification_ids` = #{goodsSpecificationIds},</if>
- <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl}</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="queryListByOrderId" resultType="com.kmall.admin.entity.OrderGoodsEntity">
- SELECT
- g.goods_name,
- g.number,
- g.sku,
- g.retail_price,
- r.order_id isPromGoods,
- r.prom_id promId,
- g.activity
- FROM
- mall_order_goods g
- LEFT JOIN mk_store_prom_order_real r ON g.id = r.order_goods_id
- WHERE 1=1
- <if test="orderId != null">
- AND g.order_id = #{orderId}
- </if>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryHistoryPrice" resultType="com.kmall.admin.entity.OrderGoodsEntity">
- SELECT
- g.order_id,
- g.sku,
- g.retail_price,
- g.create_time ,
- r.plu
- FROM
- mall_order_goods g
- LEFT JOIN mall_goods r ON g.sku = r.sku
- WHERE 1=1
- <if test="plu != null and plu.trim() != ''">
- AND r.plu = #{plu}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND g.sku = #{sku}
- </if>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryHistoryPriceTotal" resultType="int">
- select count(*)
- FROM
- mall_order_goods g
- LEFT JOIN mall_goods r ON g.sku = r.sku
- WHERE 1=1
- <if test="plu != null and plu.trim() != ''">
- AND r.plu = #{plu}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND g.sku = #{sku}
- </if>
- </select>
- <select id="queryYesterdayTax" resultType="com.kmall.admin.dto.OrderGoodsDto">
- SELECT
- o.order_sn as orderSn,
- sum( tax_price ) as tax
- FROM
- mall_order_goods g,
- mall_order o
- WHERE
- g.order_id = o.id
- AND o.order_status = 300
- AND DATE_FORMAT( g.create_time, '%Y-%m-%d' ) = #{date}
- GROUP BY
- order_id
- </select>
- <select id="queryListByOrderIds" resultType="com.kmall.api.entity.OrderGoodsRestoreVo">
- select
- mog.sku as sku,
- mog.number as number,
- mo.id as orderId,
- mo.store_id as storeId,
- mo.order_sn as orderSn,
- mo.merch_sn as merchSn,
- mo.address as shopName
- from mall_order_goods mog
- left join mall_order mo on mog.order_id=mo.id
- where
- 1=1
- <if test="list != null">
- and mo.id in
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- </mapper>
|