883 lines
29 KiB
XML
883 lines
29 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="bigtype" column="bigtype"/>
|
||
|
||
|
||
<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="bigtype" column="bigtype"/>
|
||
|
||
<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,
|
||
bigtype,
|
||
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="bigtype != null and bigtype != null">
|
||
and bigtype = #{bigtype}
|
||
</if>
|
||
<if test="qiangdan != null and qiangdan != null">
|
||
AND (worker_id IS NULL OR worker_id = '')
|
||
</if>
|
||
<if test="makeTimeStart != null and makeTimeEnd != null">
|
||
and make_time >= #{makeTimeStart} and make_time < #{makeTimeEnd}
|
||
</if>
|
||
<if test="dayDate != null and dayDate != ''">
|
||
AND FROM_UNIXTIME(make_time, '%Y-%m-%d') = #{dayDate}
|
||
</if>
|
||
|
||
<if test="baojiasf != null and baojiasf != null">
|
||
and id in (select oid from user_demand_quotation b where b.workerid=#{baojiasf} and b.status=1)
|
||
</if>
|
||
<if test="baojiayh != null and baojiayh != null">
|
||
and id in ( select b.oid from user_demand_quotation b where b.status=1)
|
||
</if>
|
||
|
||
<if test="isComment != null">
|
||
and is_comment =#{isComment}
|
||
</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>
|
||
<!-- 新增:优先用ids in (...),否则用status= -->
|
||
<if test="ids != null and ids.size > 0">
|
||
and status in
|
||
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
<if test="(ids == null or ids.size == 0) and 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>
|
||
<!-- 新增:ispay逻辑,存在users_pay_befor表status=1的lastorderid则排除 -->
|
||
<!-- <if test="ispay != null and ispay != ''">-->
|
||
<!-- AND (SELECT COUNT(1) FROM users_pay_befor upb WHERE upb.lastorderid = order_id AND upb.STATUS = 1)=0-->
|
||
<!-- -->
|
||
<!-- </if>-->
|
||
|
||
<if test="receiveTimeStart != null and receiveTimeEnd != null">
|
||
and receive_time BETWEEN #{receiveTimeStart} AND #{receiveTimeEnd}
|
||
</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 !=4
|
||
</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>
|
||
|
||
<select id="selectOrderCountByBigtype" resultType="Integer" parameterType="map">
|
||
select count(1)
|
||
from order_data
|
||
where bigtype = #{type}
|
||
and status != 4
|
||
and uid = #{uid}
|
||
</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>
|
||
<if test="bigtype != null">
|
||
bigtype,
|
||
</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>
|
||
<if test="bigtype != null">
|
||
#{bigtype},
|
||
</if>
|
||
NOW(),
|
||
NOW()
|
||
</trim>
|
||
</insert>
|
||
|
||
|
||
|
||
<update id="updateOrderPhone" parameterType="Long">
|
||
UPDATE order_data SET user_phone=null,worker_phone=null,middle_phone=null WHERE id=#{id}
|
||
</update>
|
||
<update id="updateOrderCika" parameterType="Long">
|
||
UPDATE order_data SET cartid=null WHERE id=#{id}
|
||
</update>
|
||
<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="bigtype != null">
|
||
bigtype = #{bigtype},
|
||
</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>
|
||
|
||
<!-- 根据预约日期和时间段查询预约数量 -->
|
||
<select id="selectOrderCountByMakeTimeAndHour" parameterType="map" resultType="Integer">
|
||
select count(1)
|
||
from order_data
|
||
where make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status != 4
|
||
and deleted_at is null
|
||
</select>
|
||
|
||
<!-- 根据预约日期查询所有预约订单 -->
|
||
<select id="selectOrderListByMakeTime" parameterType="map" resultMap="OrderResult">
|
||
<include refid="selectOrderVo"/>
|
||
where make_time = #{makeTime}
|
||
and status != 4
|
||
and deleted_at is null
|
||
order by id desc
|
||
</select>
|
||
|
||
<!-- 根据预约日期和时间段查询预约订单列表 -->
|
||
<select id="selectOrderListByMakeTimeAndHour" parameterType="map" resultMap="OrderResult">
|
||
<include refid="selectOrderVo"/>
|
||
where make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status != 4
|
||
and deleted_at is null
|
||
order by id desc
|
||
</select>
|
||
|
||
<!-- 查询指定日期范围内的预约统计 -->
|
||
<select id="selectOrderCountByDateRange" parameterType="map" resultType="map">
|
||
select
|
||
make_hour as timeSlot,
|
||
count(1) as orderCount
|
||
from order_data
|
||
where make_time between #{startTime} and #{endTime}
|
||
and status != 4
|
||
and deleted_at is null
|
||
group by make_hour
|
||
order by make_hour
|
||
</select>
|
||
|
||
<!-- 查询指定日期和时间段的预约详情 -->
|
||
<select id="selectOrderDetailByMakeTimeAndHour" parameterType="map" resultMap="OrderResult">
|
||
<include refid="selectOrderVo"/>
|
||
where make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status != 4
|
||
and deleted_at is null
|
||
order by created_at desc
|
||
</select>
|
||
|
||
<!-- 查询用户指定日期的预约数量 -->
|
||
<select id="selectUserOrderCountByMakeTime" parameterType="map" resultType="Integer">
|
||
select count(1)
|
||
from order_data
|
||
where uid = #{uid}
|
||
and make_time = #{makeTime}
|
||
and status != 4
|
||
and deleted_at is null
|
||
</select>
|
||
|
||
<!-- 查询指定日期和时间段的用户预约 -->
|
||
<select id="selectUserOrderByMakeTimeAndHour" parameterType="map" resultMap="OrderResult">
|
||
<include refid="selectOrderVo"/>
|
||
where uid = #{uid}
|
||
and make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status != 4
|
||
and deleted_at is null
|
||
order by created_at desc
|
||
</select>
|
||
|
||
<!-- 查询预约时间冲突的订单 -->
|
||
<select id="selectConflictingOrders" parameterType="map" resultMap="OrderResult">
|
||
<include refid="selectOrderVo"/>
|
||
where make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status != 4
|
||
and deleted_at is null
|
||
and id != #{excludeOrderId}
|
||
order by created_at desc
|
||
</select>
|
||
|
||
<!-- 查询指定日期所有时间段的预约统计 -->
|
||
<select id="selectOrderCountByDate" parameterType="map" resultType="map">
|
||
select
|
||
make_hour as timeSlot,
|
||
count(1) as orderCount,
|
||
sum(case when status = 1 then 1 else 0 end) as pendingCount,
|
||
sum(case when status = 2 then 1 else 0 end) as confirmedCount,
|
||
sum(case when status = 3 then 1 else 0 end) as inProgressCount,
|
||
sum(case when status = 6 then 1 else 0 end) as completedCount
|
||
from order_data
|
||
where make_time = #{makeTime}
|
||
and status != 4
|
||
and deleted_at is null
|
||
group by make_hour
|
||
order by make_hour
|
||
</select>
|
||
|
||
<!-- 查询指定日期和时间段的可用预约数量 -->
|
||
<select id="selectAvailableOrderCount" parameterType="map" resultType="Integer">
|
||
select count(1)
|
||
from order_data
|
||
where make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status in (1, 2, 3) -- 只统计有效状态的订单
|
||
and deleted_at is null
|
||
</select>
|
||
|
||
<!-- 查询指定日期和时间段的预约用户列表 -->
|
||
<select id="selectOrderUsersByMakeTimeAndHour" parameterType="map" resultType="map">
|
||
select
|
||
id,
|
||
uid,
|
||
name,
|
||
phone,
|
||
status,
|
||
created_at
|
||
from order_data
|
||
where make_time = #{makeTime}
|
||
and make_hour = #{makeHour}
|
||
and status != 4
|
||
and deleted_at is null
|
||
order by created_at asc
|
||
</select>
|
||
</mapper> |