技师订单 正负8小时

This commit is contained in:
曹磊 2024-07-03 23:47:29 +08:00
parent 034a993b23
commit 85bcee0ebf
1 changed files with 8 additions and 49 deletions

View File

@ -377,17 +377,18 @@
select o1.*,
(case when o1.status = 4
then o1.pay_money + ifnull(o1.add_money,0)
else o1.pay_money + ifnull(o1.add_money,0) + ifnull(o2.pay_money,0) + ifnull(o2.add_money,0)
else o1.pay_money + ifnull(o1.add_money,0) + ifnull(o2.pay_money,0) + ifnull(o2.add_money,0) + ifnull(o3.pay_money,0) + ifnull(o3.add_money,0)
end) as pay_money_total,
(case when o1.status = 4
then o1.artificer_money + ifnull(o1.add_artificer_money,0)
else o1.artificer_money + ifnull(o1.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0)
else o1.artificer_money + ifnull(o1.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
end) as artificer_money_total,
a.artificer_name as artificerName,a.artificer_img as artificerImg,
a.user_id as artificerUserId,c.consortia_name as shopName,c.address as shopAddress,
c.phone as shopPhone
from orders o1
left join orders o2 on o1.old_orders_id = o2.orders_id and o2.status != 4
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
left join artificer a on a.artificer_id=o1.artificer_id
left join tb_user u on u.user_id=o1.user_id
left join consortia c on c.consortia_id=o1.consortia_id
@ -421,18 +422,6 @@
and o1.orders_id not in (
select orders_id from orders
where old_orders_id is not null
<if test="userPackageId!=null">
and o1.user_package_id = #{userPackageId}
</if>
<if test="userId!=null">
and o1.user_id=#{userId}
</if>
<if test="status!=null and status!=0 and status!=-1 and status!=2">
and o1.status=#{status}
</if>
<if test="status!=null and status==2">
and o1.status in (2,9)
</if>
)
<if test="userPackageId!=null">
and o1.user_package_id = #{userPackageId}
@ -662,10 +651,11 @@
now() > DATE_ADD(STR_TO_DATE(o.serve_time, '%Y-%m-%d %H:%i'), INTERVAL #{minutes} MINUTE) as is_can_supplement,
(case when o.status = 4
then o.artificer_money + ifnull(o.add_artificer_money,0)
else o.artificer_money + ifnull(o.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0)
else o.artificer_money + ifnull(o.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
end) as artificer_money_total
from orders o
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
left join orders_massage om on om.orders_id=o.orders_id
left join massage_type m on m.massage_type_id=om.massage_id
LEFT JOIN bl_user_package_detail bl ON bl.id = om.massage_id
@ -673,7 +663,9 @@
and o.old_orders_id is not null
and o.status != 11
<if test="type==1">
and date_format(o.serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and o.status in (2,3,5,6,7,8,9)
and date_format(o.serve_time,'%Y-%m-%d %H:%i') >= date_format(DATE_ADD(now(), INTERVAL -8 HOUR),'%Y-%m-%d %H:%i')
and date_format(o.serve_time,'%Y-%m-%d %H:%i') &lt;= date_format(DATE_ADD(now(), INTERVAL 8 HOUR),'%Y-%m-%d %H:%i')
and o.status in (2,3,5,6,7,8,9)
</if>
<if test="type==2">
and o.status=2
@ -721,39 +713,6 @@
and o.orders_id not in (
select orders_id from orders
where old_orders_id is not null
<if test="type==1">
and date_format(serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and status in (2,3,5,6,7,8,9)
</if>
<if test="type==2">
and status=2
<if test="startTime!=null and startTime!=''">
and date_format(serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(serve_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
</if>
<if test="type==3">
and status in (3,5)
<if test="startTime!=null and startTime!=''">
and date_format(serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(serve_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
</if>
<if test="type==4">
and status in (2,3,4,5,6,7,8)
<if test="startTime!=null and startTime!=''">
and date_format(serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(serve_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
</if>
<if test="type==5">
and date_format(serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and status=2
</if>
)
<if test="type==1">
and date_format(o.serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and o.status in (2,3,5,6,7,8,9)