diff --git a/src/main/resources/mapper/artificer/OrdersDao.xml b/src/main/resources/mapper/artificer/OrdersDao.xml index 3a50cbc..932dbae 100644 --- a/src/main/resources/mapper/artificer/OrdersDao.xml +++ b/src/main/resources/mapper/artificer/OrdersDao.xml @@ -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 - - and o1.user_package_id = #{userPackageId} - - - and o1.user_id=#{userId} - - - and o1.status=#{status} - - - and o1.status in (2,9) - ) 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 - 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') <= date_format(DATE_ADD(now(), INTERVAL 8 HOUR),'%Y-%m-%d %H:%i') + and o.status in (2,3,5,6,7,8,9) 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 - - and date_format(serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and status in (2,3,5,6,7,8,9) - - - and status=2 - - and date_format(serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d') - - - and date_format(serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d') - - - - and status in (3,5) - - and date_format(serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d') - - - and date_format(serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d') - - - - and status in (2,3,4,5,6,7,8) - - and date_format(serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d') - - - and date_format(serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d') - - - - and date_format(serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and status=2 - ) 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)