<?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.MallOrderMapper">
|
|
<resultMap type="MallOrder" id="MallOrderResult">
|
<result property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="orderSn" column="order_sn"/>
|
<result property="orderStatus" column="order_status"/>
|
<result property="aftersaleStatus" column="aftersale_status"/>
|
<result property="consignee" column="consignee"/>
|
<result property="mobile" column="mobile"/>
|
<result property="address" column="address"/>
|
<result property="message" column="message"/>
|
<result property="goodsPrice" column="goods_price"/>
|
<result property="freightPrice" column="freight_price"/>
|
<result property="couponPrice" column="coupon_price"/>
|
<result property="integralPrice" column="integral_price"/>
|
<result property="grouponPrice" column="groupon_price"/>
|
<result property="orderPrice" column="order_price"/>
|
<result property="actualPrice" column="actual_price"/>
|
<result property="payId" column="pay_id"/>
|
<result property="payTime" column="pay_time"/>
|
<result property="shipSn" column="ship_sn"/>
|
<result property="shipChannel" column="ship_channel"/>
|
<result property="shipTime" column="ship_time"/>
|
<result property="refundAmount" column="refund_amount"/>
|
<result property="refundType" column="refund_type"/>
|
<result property="refundContent" column="refund_content"/>
|
<result property="refundTime" column="refund_time"/>
|
<result property="confirmTime" column="confirm_time"/>
|
<result property="comments" column="comments"/>
|
<result property="closeTime" column="close_time"/>
|
<result property="settlementMoney" column="settlement_money"/>
|
<result property="settlementStatus" column="settlement_status"/>
|
<result property="freightType" column="freight_type"/>
|
<result property="shareUserId" column="share_user_id"/>
|
<result property="fetchCode" column="fetch_code"/>
|
<result property="createUserId" column="create_user_id"/>
|
<result property="giftSendTime" column="gift_send_time"/>
|
<result property="giftReceiveTime" column="gift_receive_time"/>
|
<result property="deptId" column="dept_id"/>
|
<result property="isSz" column="is_sz"/>
|
<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"/>
|
<result property="idCard" column="id_card"/>
|
</resultMap>
|
|
<resultMap id="MallOrderMallOrderGoodsResult" type="MallOrder" extends="MallOrderResult">
|
<collection property="mallOrderGoodsList" notNullColumn="sub_id"
|
javaType="java.util.List" resultMap="MallOrderGoodsResult"/>
|
</resultMap>
|
|
<resultMap type="MallOrderGoods" id="MallOrderGoodsResult">
|
<result property="id" column="sub_id"/>
|
<result property="orderId" column="sub_order_id"/>
|
<result property="goodsId" column="sub_goods_id"/>
|
<result property="goodsName" column="sub_goods_name"/>
|
<result property="goodsSn" column="sub_goods_sn"/>
|
<result property="productId" column="sub_product_id"/>
|
<result property="number" column="sub_number"/>
|
<result property="price" column="sub_price"/>
|
<result property="specifications" column="sub_specifications"/>
|
<result property="picUrl" column="sub_pic_url"/>
|
<result property="comment" column="sub_comment"/>
|
<result property="purchasePrice" column="sub_purchase_price"/>
|
<result property="counterPrice" column="sub_counter_price"/>
|
<result property="createTime" column="sub_create_time"/>
|
<result property="createBy" column="sub_create_by"/>
|
<result property="updateTime" column="sub_update_time"/>
|
<result property="updateBy" column="sub_update_by"/>
|
<result property="deleted" column="sub_deleted"/>
|
</resultMap>
|
|
<sql id="selectMallOrderVo">
|
select id,
|
user_id,
|
order_sn,
|
order_status,
|
aftersale_status,
|
consignee,
|
mobile,
|
address,
|
message,
|
goods_price,
|
freight_price,
|
coupon_price,
|
integral_price,
|
groupon_price,
|
order_price,
|
actual_price,
|
pay_id,
|
pay_time,
|
ship_sn,
|
ship_channel,
|
ship_time,
|
refund_amount,
|
refund_type,
|
refund_content,
|
refund_time,
|
confirm_time,
|
comments,
|
close_time,
|
settlement_money,
|
settlement_status,
|
freight_type,
|
share_user_id,
|
fetch_code,
|
create_user_id,
|
gift_send_time,
|
gift_receive_time,
|
dept_id,
|
is_sz,
|
create_time,
|
create_by,
|
update_time,
|
update_by,
|
deleted,
|
id_card
|
from mall_order
|
</sql>
|
|
<select id="selectMallOrderList" parameterType="MallOrder" resultMap="MallOrderResult">
|
<include refid="selectMallOrderVo"/>
|
<where>
|
<if test="userId != null ">
|
and user_id = #{userId}
|
</if>
|
<if test="orderSn != null and orderSn != ''">
|
and order_sn = #{orderSn}
|
</if>
|
<if test="orderStatus != null ">
|
and order_status = #{orderStatus}
|
</if>
|
<if test="aftersaleStatus != null ">
|
and aftersale_status = #{aftersaleStatus}
|
</if>
|
<if test="consignee != null and consignee != ''">
|
and consignee = #{consignee}
|
</if>
|
<if test="mobile != null and mobile != ''">
|
and mobile = #{mobile}
|
</if>
|
<if test="address != null and address != ''">
|
and address = #{address}
|
</if>
|
<if test="message != null and message != ''">
|
and message = #{message}
|
</if>
|
<if test="goodsPrice != null ">
|
and goods_price = #{goodsPrice}
|
</if>
|
<if test="freightPrice != null ">
|
and freight_price = #{freightPrice}
|
</if>
|
<if test="couponPrice != null ">
|
and coupon_price = #{couponPrice}
|
</if>
|
<if test="integralPrice != null ">
|
and integral_price = #{integralPrice}
|
</if>
|
<if test="grouponPrice != null ">
|
and groupon_price = #{grouponPrice}
|
</if>
|
<if test="orderPrice != null ">
|
and order_price = #{orderPrice}
|
</if>
|
<if test="actualPrice != null ">
|
and actual_price = #{actualPrice}
|
</if>
|
<if test="payId != null and payId != ''">
|
and pay_id = #{payId}
|
</if>
|
<if test="payTime != null ">
|
and pay_time = #{payTime}
|
</if>
|
<if test="shipSn != null and shipSn != ''">
|
and ship_sn = #{shipSn}
|
</if>
|
<if test="shipChannel != null and shipChannel != ''">
|
and ship_channel = #{shipChannel}
|
</if>
|
<if test="shipTime != null ">
|
and ship_time = #{shipTime}
|
</if>
|
<if test="refundAmount != null ">
|
and refund_amount = #{refundAmount}
|
</if>
|
<if test="refundType != null ">
|
and refund_type = #{refundType}
|
</if>
|
<if test="refundContent != null and refundContent != ''">
|
and refund_content = #{refundContent}
|
</if>
|
<if test="refundTime != null ">
|
and refund_time = #{refundTime}
|
</if>
|
<if test="confirmTime != null ">
|
and confirm_time = #{confirmTime}
|
</if>
|
<if test="comments != null ">
|
and comments = #{comments}
|
</if>
|
<if test="closeTime != null ">
|
and close_time = #{closeTime}
|
</if>
|
<if test="settlementMoney != null ">
|
and settlement_money = #{settlementMoney}
|
</if>
|
<if test="settlementStatus != null ">
|
and settlement_status = #{settlementStatus}
|
</if>
|
<if test="freightType != null ">
|
and freight_type = #{freightType}
|
</if>
|
<if test="shareUserId != null ">
|
and share_user_id = #{shareUserId}
|
</if>
|
<if test="fetchCode != null and fetchCode != ''">
|
and fetch_code = #{fetchCode}
|
</if>
|
<if test="createUserId != null ">
|
and create_user_id = #{createUserId}
|
</if>
|
<if test="giftSendTime != null ">
|
and gift_send_time = #{giftSendTime}
|
</if>
|
<if test="giftReceiveTime != null ">
|
and gift_receive_time = #{giftReceiveTime}
|
</if>
|
<if test="startTime != null and endTime !=null ">
|
and create_time between #{startTime} and #{endTime}
|
</if>
|
</where>
|
order by update_time desc
|
</select>
|
|
<select id="selectMallOrderById" parameterType="Long"
|
resultMap="MallOrderMallOrderGoodsResult">
|
select a.id,
|
a.user_id,
|
a.order_sn,
|
a.order_status,
|
a.aftersale_status,
|
a.consignee,
|
a.mobile,
|
a.address,
|
a.message,
|
a.goods_price,
|
a.freight_price,
|
a.coupon_price,
|
a.integral_price,
|
a.groupon_price,
|
a.order_price,
|
a.actual_price,
|
a.pay_id,
|
a.pay_time,
|
a.ship_sn,
|
a.ship_channel,
|
a.ship_time,
|
a.refund_amount,
|
a.refund_type,
|
a.refund_content,
|
a.refund_time,
|
a.confirm_time,
|
a.comments,
|
a.close_time,
|
a.settlement_money,
|
a.settlement_status,
|
a.freight_type,
|
a.share_user_id,
|
a.fetch_code,
|
a.create_user_id,
|
a.gift_send_time,
|
a.gift_receive_time,
|
a.dept_id,
|
a.is_sz,
|
a.create_time,
|
a.create_by,
|
a.update_time,
|
a.update_by,
|
a.deleted,
|
b.id as
|
sub_id,
|
b.order_id as
|
sub_order_id,
|
b.goods_id as
|
sub_goods_id,
|
b.goods_name as
|
sub_goods_name,
|
b.goods_sn as
|
sub_goods_sn,
|
b.product_id as
|
sub_product_id,
|
b.number as
|
sub_number,
|
b.price as
|
sub_price,
|
b.specifications as
|
sub_specifications,
|
b.pic_url as
|
sub_pic_url,
|
b.comment as
|
sub_comment,
|
b.purchase_price as
|
sub_purchase_price,
|
b.counter_price as
|
sub_counter_price,
|
b.create_time as
|
sub_create_time,
|
b.create_by as
|
sub_create_by,
|
b.update_time as
|
sub_update_time,
|
b.update_by as
|
sub_update_by,
|
b.deleted as
|
sub_deleted
|
from mall_order a
|
left join mall_order_goods b on b.order_id = a.id
|
where a.id = #{id}
|
</select>
|
|
<insert id="insertMallOrder" parameterType="MallOrder" useGeneratedKeys="true"
|
keyProperty="id">
|
insert into mall_order
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="userId != null">user_id,
|
</if>
|
<if test="orderSn != null and orderSn != ''">order_sn,
|
</if>
|
<if test="orderStatus != null">order_status,
|
</if>
|
<if test="aftersaleStatus != null">aftersale_status,
|
</if>
|
<if test="consignee != null and consignee != ''">consignee,
|
</if>
|
<if test="mobile != null and mobile != ''">mobile,
|
</if>
|
<if test="address != null and address != ''">address,
|
</if>
|
<if test="message != null and message != ''">message,
|
</if>
|
<if test="goodsPrice != null">goods_price,
|
</if>
|
<if test="freightPrice != null">freight_price,
|
</if>
|
<if test="couponPrice != null">coupon_price,
|
</if>
|
<if test="integralPrice != null">integral_price,
|
</if>
|
<if test="grouponPrice != null">groupon_price,
|
</if>
|
<if test="orderPrice != null">order_price,
|
</if>
|
<if test="actualPrice != null">actual_price,
|
</if>
|
<if test="payId != null">pay_id,
|
</if>
|
<if test="payTime != null">pay_time,
|
</if>
|
<if test="shipSn != null">ship_sn,
|
</if>
|
<if test="shipChannel != null">ship_channel,
|
</if>
|
<if test="shipTime != null">ship_time,
|
</if>
|
<if test="refundAmount != null">refund_amount,
|
</if>
|
<if test="refundType != null">refund_type,
|
</if>
|
<if test="refundContent != null">refund_content,
|
</if>
|
<if test="refundTime != null">refund_time,
|
</if>
|
<if test="confirmTime != null">confirm_time,
|
</if>
|
<if test="comments != null">comments,
|
</if>
|
<if test="closeTime != null">close_time,
|
</if>
|
<if test="settlementMoney != null">settlement_money,
|
</if>
|
<if test="settlementStatus != null">settlement_status,
|
</if>
|
<if test="freightType != null">freight_type,
|
</if>
|
<if test="shareUserId != null">share_user_id,
|
</if>
|
<if test="fetchCode != null">fetch_code,
|
</if>
|
<if test="createUserId != null">create_user_id,
|
</if>
|
<if test="giftSendTime != null">gift_send_time,
|
</if>
|
<if test="giftReceiveTime != null">gift_receive_time,
|
</if>
|
<if test="deptId != null">dept_id,
|
</if>
|
<if test="isSz != null">is_sz,
|
</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="userId != null">#{userId},
|
</if>
|
<if test="orderSn != null and orderSn != ''">#{orderSn},
|
</if>
|
<if test="orderStatus != null">#{orderStatus},
|
</if>
|
<if test="aftersaleStatus != null">#{aftersaleStatus},
|
</if>
|
<if test="consignee != null and consignee != ''">#{consignee},
|
</if>
|
<if test="mobile != null and mobile != ''">#{mobile},
|
</if>
|
<if test="address != null and address != ''">#{address},
|
</if>
|
<if test="message != null and message != ''">#{message},
|
</if>
|
<if test="goodsPrice != null">#{goodsPrice},
|
</if>
|
<if test="freightPrice != null">#{freightPrice},
|
</if>
|
<if test="couponPrice != null">#{couponPrice},
|
</if>
|
<if test="integralPrice != null">#{integralPrice},
|
</if>
|
<if test="grouponPrice != null">#{grouponPrice},
|
</if>
|
<if test="orderPrice != null">#{orderPrice},
|
</if>
|
<if test="actualPrice != null">#{actualPrice},
|
</if>
|
<if test="payId != null">#{payId},
|
</if>
|
<if test="payTime != null">#{payTime},
|
</if>
|
<if test="shipSn != null">#{shipSn},
|
</if>
|
<if test="shipChannel != null">#{shipChannel},
|
</if>
|
<if test="shipTime != null">#{shipTime},
|
</if>
|
<if test="refundAmount != null">#{refundAmount},
|
</if>
|
<if test="refundType != null">#{refundType},
|
</if>
|
<if test="refundContent != null">#{refundContent},
|
</if>
|
<if test="refundTime != null">#{refundTime},
|
</if>
|
<if test="confirmTime != null">#{confirmTime},
|
</if>
|
<if test="comments != null">#{comments},
|
</if>
|
<if test="closeTime != null">#{closeTime},
|
</if>
|
<if test="settlementMoney != null">#{settlementMoney},
|
</if>
|
<if test="settlementStatus != null">#{settlementStatus},
|
</if>
|
<if test="freightType != null">#{freightType},
|
</if>
|
<if test="shareUserId != null">#{shareUserId},
|
</if>
|
<if test="fetchCode != null">#{fetchCode},
|
</if>
|
<if test="createUserId != null">#{createUserId},
|
</if>
|
<if test="giftSendTime != null">#{giftSendTime},
|
</if>
|
<if test="giftReceiveTime != null">#{giftReceiveTime},
|
</if>
|
<if test="deptId != null">#{deptId},
|
</if>
|
<if test="isSz != null">#{isSz},
|
</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="updateMallOrder" parameterType="MallOrder">
|
update mall_order
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="userId != null">user_id =
|
#{userId},
|
</if>
|
<if test="orderSn != null and orderSn != ''">order_sn =
|
#{orderSn},
|
</if>
|
<if test="orderStatus != null">order_status =
|
#{orderStatus},
|
</if>
|
<if test="aftersaleStatus != null">aftersale_status =
|
#{aftersaleStatus},
|
</if>
|
<if test="consignee != null and consignee != ''">consignee =
|
#{consignee},
|
</if>
|
<if test="mobile != null and mobile != ''">mobile =
|
#{mobile},
|
</if>
|
<if test="address != null and address != ''">address =
|
#{address},
|
</if>
|
<if test="message != null and message != ''">message =
|
#{message},
|
</if>
|
<if test="goodsPrice != null">goods_price =
|
#{goodsPrice},
|
</if>
|
<if test="freightPrice != null">freight_price =
|
#{freightPrice},
|
</if>
|
<if test="couponPrice != null">coupon_price =
|
#{couponPrice},
|
</if>
|
<if test="integralPrice != null">integral_price =
|
#{integralPrice},
|
</if>
|
<if test="grouponPrice != null">groupon_price =
|
#{grouponPrice},
|
</if>
|
<if test="orderPrice != null">order_price =
|
#{orderPrice},
|
</if>
|
<if test="actualPrice != null">actual_price =
|
#{actualPrice},
|
</if>
|
<if test="payId != null">pay_id =
|
#{payId},
|
</if>
|
<if test="payTime != null">pay_time =
|
#{payTime},
|
</if>
|
<if test="shipSn != null">ship_sn =
|
#{shipSn},
|
</if>
|
<if test="shipChannel != null">ship_channel =
|
#{shipChannel},
|
</if>
|
<if test="shipTime != null">ship_time =
|
#{shipTime},
|
</if>
|
<if test="refundAmount != null">refund_amount =
|
#{refundAmount},
|
</if>
|
<if test="refundType != null">refund_type =
|
#{refundType},
|
</if>
|
<if test="refundContent != null">refund_content =
|
#{refundContent},
|
</if>
|
<if test="refundTime != null">refund_time =
|
#{refundTime},
|
</if>
|
<if test="confirmTime != null">confirm_time =
|
#{confirmTime},
|
</if>
|
<if test="comments != null">comments =
|
#{comments},
|
</if>
|
<if test="closeTime != null">close_time =
|
#{closeTime},
|
</if>
|
<if test="settlementMoney != null">settlement_money =
|
#{settlementMoney},
|
</if>
|
<if test="settlementStatus != null">settlement_status =
|
#{settlementStatus},
|
</if>
|
<if test="freightType != null">freight_type =
|
#{freightType},
|
</if>
|
<if test="shareUserId != null">share_user_id =
|
#{shareUserId},
|
</if>
|
<if test="fetchCode != null">fetch_code =
|
#{fetchCode},
|
</if>
|
<if test="createUserId != null">create_user_id =
|
#{createUserId},
|
</if>
|
<if test="giftSendTime != null">gift_send_time =
|
#{giftSendTime},
|
</if>
|
<if test="giftReceiveTime != null">gift_receive_time =
|
#{giftReceiveTime},
|
</if>
|
<if test="deptId != null">dept_id =
|
#{deptId},
|
</if>
|
<if test="isSz != null">is_sz =
|
#{isSz},
|
</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="deleteMallOrderById" parameterType="Long">
|
delete
|
from mall_order
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteMallOrderByIds" parameterType="String">
|
delete from mall_order where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<delete id="deleteMallOrderGoodsByOrderIds" parameterType="String">
|
delete from mall_order_goods where order_id in
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
#{orderId}
|
</foreach>
|
</delete>
|
|
<delete id="deleteMallOrderGoodsByOrderId" parameterType="Long">
|
delete
|
from mall_order_goods
|
where order_id = #{orderId}
|
</delete>
|
|
<insert id="batchMallOrderGoods">
|
insert into mall_order_goods
|
( 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) values
|
<foreach item="item" index="index" collection="list" separator=",">
|
( #{item.id
|
}, #{item.orderId
|
}, #{item.goodsId
|
}, #{item.goodsName
|
}, #{item.goodsSn
|
}, #{item.productId
|
}, #{item.number
|
}, #{item.price
|
}, #{item.specifications
|
}, #{item.picUrl
|
}, #{item.comment
|
}, #{item.purchasePrice
|
}, #{item.counterPrice
|
}, #{item.createTime
|
}, #{item.createBy
|
}, #{item.updateTime
|
}, #{item.updateBy
|
}, #{item.deleted
|
})
|
</foreach>
|
</insert>
|
</mapper>
|