javacodeadmin/ruoyi-system/src/main/resources/mapper/system/OrderMapper.xml

690 lines
22 KiB
XML

<?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.ruoyi.system.mapper.OrderMapper">
<resultMap type="Order" id="OrderResult">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="fileData" column="file_data"/>
<result property="mainOrderId" column="main_order_id"/>
<result property="orderId" column="order_id"/>
<result property="transactionId" column="transaction_id"/>
<result property="createType" column="create_type"/>
<result property="createPhone" column="create_phone"/>
<result property="uid" column="uid"/>
<result property="productId" column="product_id"/>
<result property="name" column="name"/>
<result property="phone" column="phone"/>
<result property="address" column="address"/>
<result property="makeTime" column="make_time"/>
<result property="makeHour" column="make_hour"/>
<result property="num" column="num"/>
<result property="cartid" column="cartid"/>
<result property="totalPrice" column="total_price"/>
<result property="goodPrice" column="good_price"/>
<result property="servicePrice" column="service_price"/>
<result property="payPrice" column="pay_price"/>
<result property="couponId" column="coupon_id"/>
<result property="deduction" column="deduction"/>
<result property="payTime" column="pay_time"/>
<result property="status" column="status"/>
<result property="isPause" column="is_pause"/>
<result property="mark" column="mark"/>
<result property="addressId" column="address_id"/>
<result property="sku" column="sku"/>
<result property="workerId" column="worker_id"/>
<result property="firstWorkerId" column="first_worker_id"/>
<result property="receiveTime" column="receive_time"/>
<result property="isComment" column="is_comment"/>
<result property="receiveType" column="receive_type"/>
<result property="isAccept" column="is_accept"/>
<result property="middlePhone" column="middle_phone"/>
<result property="userPhone" column="user_phone"/>
<result property="workerPhone" column="worker_phone"/>
<result property="addressEn" column="address_en"/>
<result property="uidAdmin" column="uid_admin"/>
<result property="addressAdmin" column="address_admin"/>
<result property="logStatus" column="log_status"/>
<result property="logJson" column="log_json"/>
<result property="jsonStatus" column="json_status"/>
<result property="logImages" column="log_images"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
<result property="deletedAt" column="deleted_at"/>
<result property="odertype" column="odertype"/>
<result property="reamk" column="reamk"/>
</resultMap>
<resultMap type="OrderApple" id="OrderAppleResult">
<result property="created_at" column="deleted_at"/>
<result property="reamk" column="reamk"/>
<result property="id" column="id"/>
<result property="odertype" column="odertype"/>
<result property="is_comment" column="is_comment"/>
<result property="make_hour" column="make_hour"/>
<result property="make_time" column="make_time"/>
<result property="name" column="name"/>
<result property="fileData" column="file_data"/>
<result property="num" column="num"/>
<result property="order_id" column="order_id"/>
<result property="product_id" column="product_id"/>
<result property="sku" column="sku"/>
<result property="cartid" column="cartid"/>
<result property="status" column="status"/>
<result property="total_price" column="total_price"/>
<result property="type" column="type"/>
<result property="uid" column="uid"/>
</resultMap>
<sql id="selectOrderVo">
select id,
type,
main_order_id,
order_id,
transaction_id,
create_type,
create_phone,
uid,
cartid,
odertype,
product_id,
name,
phone,
address,
make_time,
make_hour,
reamk,
num,
total_price,
good_price,
service_price,
pay_price,
coupon_id,
deduction,
pay_time,
status,
is_pause,
mark,
address_id,
sku,
worker_id,
first_worker_id,
receive_time,
is_comment,
receive_type,
is_accept,
middle_phone,
user_phone,
worker_phone,
address_en,
uid_admin,
address_admin,
log_status,
log_json,
json_status,
log_images,
file_data,
created_at,
updated_at,
deleted_at
from order_data
</sql>
<select id="selectOrderAppleList" parameterType="OrderApple" resultMap="OrderAppleResult">
<include refid="selectOrderVo"/>
<where>
<if test="uid != null">
and uid = #{uid}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="type != null">
and type = #{type}
</if>
</where>
order by id desc
</select>
<select id="selectOrderList" parameterType="Order" resultMap="OrderResult">
<include refid="selectOrderVo"/>
<where>
<if test="totalPriceMin != null and totalPriceMax != null">
and total_price BETWEEN #{totalPriceMin} AND #{totalPriceMax}
</if>
<if test="payPriceMin != null and payPriceMax != null">
and pay_price BETWEEN #{payPriceMin} AND #{payPriceMax}
</if>
<if test="paystartdate != null and payenddate != null">
and pay_time BETWEEN #{paystartdate} AND #{payenddate}
</if>
<if test="startdate != null and enddate != null">
and created_at BETWEEN #{startdate} AND #{enddate}
</if>
<if test="orderId != null and orderId != ''">
and order_id like concat('%', #{orderId}, '%')
</if>
<if test="transactionId != null and transactionId != ''">
and transaction_id like concat('%', #{transactionId}, '%')
</if>
<if test="createPhone != null and createPhone != ''">
and create_phone like concat('%', #{createPhone}, '%')
</if>
<if test="uid != null">
and uid = #{uid}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="productId != null">
and product_id = #{productId}
</if>
<if test="workerId != null">
and worker_id = #{workerId}
</if>
<if test="cartid != null">
and cartid = #{cartid}
</if>
</where>
order by id desc
</select>
<select id="selectOrderById" parameterType="Long" resultMap="OrderResult">
<include refid="selectOrderVo"/>
where id = #{id}
</select>
<select id="selectCountOrderByUid" resultType="Integer">
select count(1) from order_data where uid = #{uid} and status=#{status}
</select>
<select id="selectAllCountOrderByUid" resultType="Integer">
select count(1) from order_data where uid = #{uid}
</select>
<select id="selectOrderByOrderId" parameterType="String" resultMap="OrderResult">
<include refid="selectOrderVo"/>
where order_id = #{orderId}
</select>
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into order_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">
type,
</if>
<if test="mainOrderId != null">
main_order_id,
</if>
<if test="orderId != null and orderId != ''">
order_id,
</if>
<if test="transactionId != null">
transaction_id,
</if>
<if test="createType != null">
create_type,
</if>
<if test="createPhone != null">
create_phone,
</if>
<if test="uid != null">
uid,
</if>
<if test="productId != null">
product_id,
</if>
<if test="name != null and name != ''">
name,
</if>
<if test="phone != null and phone != ''">
phone,
</if>
<if test="address != null and address != ''">
address,
</if>
<if test="makeTime != null">
make_time,
</if>
<if test="makeHour != null">
make_hour,
</if>
<if test="num != null">
num,
</if>
<if test="totalPrice != null">
total_price,
</if>
<if test="goodPrice != null">
good_price,
</if>
<if test="servicePrice != null">
service_price,
</if>
<if test="payPrice != null">
pay_price,
</if>
<if test="couponId != null">
coupon_id,
</if>
<if test="deduction != null">
deduction,
</if>
<if test="payTime != null">
pay_time,
</if>
<if test="status != null">
status,
</if>
<if test="isPause != null">
is_pause,
</if>
<if test="mark != null">
mark,
</if>
<if test="addressId != null">
address_id,
</if>
<if test="sku != null">
sku,
</if>
<if test="workerId != null">
worker_id,
</if>
<if test="firstWorkerId != null">
first_worker_id,
</if>
<if test="receiveTime != null">
receive_time,
</if>
<if test="isComment != null">
is_comment,
</if>
<if test="receiveType != null">
receive_type,
</if>
<if test="isAccept != null">
is_accept,
</if>
<if test="middlePhone != null">
middle_phone,
</if>
<if test="userPhone != null">
user_phone,
</if>
<if test="workerPhone != null">
worker_phone,
</if>
<if test="addressEn != null">
address_en,
</if>
<if test="uidAdmin != null">
uid_admin,
</if>
<if test="addressAdmin != null">
address_admin,
</if>
<if test="logStatus != null">
log_status,
</if>
<if test="logJson != null">
log_json,
</if>
<if test="jsonStatus != null">
json_status,
</if>
<if test="logImages != null">
log_images,
</if>
<if test="deletedAt != null">
deleted_at,
</if>
<if test="fileData != null">
file_data,
</if>
<if test="odertype != null">
odertype,
</if>
<if test="reamk != null">
reamk,
</if>
<if test="cartid != null">
cartid,
</if>
created_at,
updated_at
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">
#{type},
</if>
<if test="mainOrderId != null">
#{mainOrderId},
</if>
<if test="orderId != null and orderId != ''">
#{orderId},
</if>
<if test="transactionId != null">
#{transactionId},
</if>
<if test="createType != null">
#{createType},
</if>
<if test="createPhone != null">
#{createPhone},
</if>
<if test="uid != null">
#{uid},
</if>
<if test="productId != null">
#{productId},
</if>
<if test="name != null and name != ''">
#{name},
</if>
<if test="phone != null and phone != ''">
#{phone},
</if>
<if test="address != null and address != ''">
#{address},
</if>
<if test="makeTime != null">
#{makeTime},
</if>
<if test="makeHour != null">
#{makeHour},
</if>
<if test="num != null">
#{num},
</if>
<if test="totalPrice != null">
#{totalPrice},
</if>
<if test="goodPrice != null">
#{goodPrice},
</if>
<if test="servicePrice != null">
#{servicePrice},
</if>
<if test="payPrice != null">
#{payPrice},
</if>
<if test="couponId != null">
#{couponId},
</if>
<if test="deduction != null">
#{deduction},
</if>
<if test="payTime != null">
#{payTime},
</if>
<if test="status != null">
#{status},
</if>
<if test="isPause != null">
#{isPause},
</if>
<if test="mark != null">
#{mark},
</if>
<if test="addressId != null">
#{addressId},
</if>
<if test="sku != null">
#{sku},
</if>
<if test="workerId != null">
#{workerId},
</if>
<if test="firstWorkerId != null">
#{firstWorkerId},
</if>
<if test="receiveTime != null">
#{receiveTime},
</if>
<if test="isComment != null">
#{isComment},
</if>
<if test="receiveType != null">
#{receiveType},
</if>
<if test="isAccept != null">
#{isAccept},
</if>
<if test="middlePhone != null">
#{middlePhone},
</if>
<if test="userPhone != null">
#{userPhone},
</if>
<if test="workerPhone != null">
#{workerPhone},
</if>
<if test="addressEn != null">
#{addressEn},
</if>
<if test="uidAdmin != null">
#{uidAdmin},
</if>
<if test="addressAdmin != null">
#{addressAdmin},
</if>
<if test="logStatus != null">
#{logStatus},
</if>
<if test="logJson != null">
#{logJson},
</if>
<if test="jsonStatus != null">
#{jsonStatus},
</if>
<if test="logImages != null">
#{logImages},
</if>
<if test="deletedAt != null">
#{deletedAt},
</if>
<if test="fileData != null">
#{fileData},
</if>
<if test="odertype != null">
#{odertype},
</if>
<if test="reamk != null">
#{reamk},
</if>
<if test="cartid != null">
#{cartid},
</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateOrder" parameterType="Order">
update order_data
<trim prefix="SET" suffixOverrides=",">
<if test="type != null">
type = #{type},
</if>
<if test="mainOrderId != null">
main_order_id = #{mainOrderId},
</if>
<if test="fileData != null">
file_data = #{fileData},
</if>
<if test="orderId != null and orderId != ''">
order_id = #{orderId},
</if>
<if test="transactionId != null">
transaction_id = #{transactionId},
</if>
<if test="createType != null">
create_type = #{createType},
</if>
<if test="createPhone != null">
create_phone = #{createPhone},
</if>
<if test="uid != null">
uid = #{uid},
</if>
<if test="productId != null">
product_id = #{productId},
</if>
<if test="odertype != null">
odertype = #{odertype},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="makeTime != null">
make_time = #{makeTime},
</if>
<if test="makeHour != null">
make_hour = #{makeHour},
</if>
<if test="num != null">
num = #{num},
</if>
<if test="totalPrice != null">
total_price = #{totalPrice},
</if>
<if test="goodPrice != null">
good_price = #{goodPrice},
</if>
<if test="servicePrice != null">
service_price = #{servicePrice},
</if>
<if test="payPrice != null">
pay_price = #{payPrice},
</if>
<if test="couponId != null">
coupon_id = #{couponId},
</if>
<if test="deduction != null">
deduction = #{deduction},
</if>
<if test="payTime != null">
pay_time = #{payTime},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="isPause != null">
is_pause = #{isPause},
</if>
<if test="mark != null">
mark = #{mark},
</if>
<if test="addressId != null">
address_id = #{addressId},
</if>
<if test="sku != null">
sku = #{sku},
</if>
<if test="workerId != null">
worker_id = #{workerId},
</if>
<if test="firstWorkerId != null">
first_worker_id = #{firstWorkerId},
</if>
<if test="receiveTime != null">
receive_time = #{receiveTime},
</if>
<if test="isComment != null">
is_comment = #{isComment},
</if>
<if test="receiveType != null">
receive_type = #{receiveType},
</if>
<if test="isAccept != null">
is_accept = #{isAccept},
</if>
<if test="middlePhone != null">
middle_phone = #{middlePhone},
</if>
<if test="userPhone != null">
user_phone = #{userPhone},
</if>
<if test="workerPhone != null">
worker_phone = #{workerPhone},
</if>
<if test="addressEn != null">
address_en = #{addressEn},
</if>
<if test="uidAdmin != null">
uid_admin = #{uidAdmin},
</if>
<if test="addressAdmin != null">
address_admin = #{addressAdmin},
</if>
<if test="logStatus != null">
log_status = #{logStatus},
</if>
<if test="logJson != null">
log_json = #{logJson},
</if>
<if test="jsonStatus != null">
json_status = #{jsonStatus},
</if>
<if test="logImages != null">
log_images = #{logImages},
</if>
<if test="deletedAt != null">
deleted_at = #{deletedAt},
</if>
<if test="reamk != null">
reamk = #{reamk},
</if>
<if test="cartid != null">
cartid = #{cartid},
</if>
updated_at = NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteOrderById" parameterType="Long">
delete
from order_data
where id = #{id}
</delete>
<delete id="deleteOrderByIds" parameterType="String">
delete
from order_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>