From 0481353111afb43a2322e18530dde26f1d841ead Mon Sep 17 00:00:00 2001 From: yanghb <yanghb> Date: 星期五, 21 四月 2023 11:15:34 +0800 Subject: [PATCH] 代码调整 --- ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTaxiMapper.xml | 341 -------------------------------------------------------- 1 files changed, 0 insertions(+), 341 deletions(-) diff --git a/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTaxiMapper.xml b/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTaxiMapper.xml index a71bb9f..47a81a8 100644 --- a/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTaxiMapper.xml +++ b/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTaxiMapper.xml @@ -257,348 +257,7 @@ AND (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) </if> </select> - <select id="getOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> - SELECT o.*,IFNULL(d.`name`,'') driverName,IFNULL(d.phone,'') driverPhone,u.nickName userName,u.phone userPhone, - (SELECT IFNULL(SUM(money),0) FROM t_income WHERE incomeId=o.id AND orderType=o.type) totalMoney, - (SELECT IFNULL(SUM(money),0) FROM t_income WHERE incomeId=o.id AND orderType=o.type AND userType=2 AND objectId=o.driverId) driverMoney, - (SELECT IFNULL(SUM(money),0) FROM t_order_cancel WHERE orderId=o.id AND orderType=o.type) cancleMoney, - (SELECT IFNULL(SUM(money),0) FROM t_reassign WHERE orderId=o.id AND orderType=o.type) reassignMoney, - CASE WHEN o.type>3 THEN (SELECT IFNULL(SUM(payMoney),0) FROM t_order_logistics_spread WHERE orderLogisticsId=o.id) ELSE 0 END spreadMoney, - (SELECT IFNULL(SUM(amount),0) FROM t_order_additional_fee WHERE orderId=o.id AND orderType=o.type) additionalMoney - - FROM ( - SELECT id,insertTime,orderNum,2 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,travelMoney orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_taxi WHERE state>=7 AND 10>=state AND (payManner is NULL or payManner!=2) - UNION ALL - SELECT id,insertTime,orderNum,1 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,startMoney+mileageMoney+durationMoney+waitMoney+longDistanceMoney orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_private_car WHERE state>=7 AND 10>=state AND (payManner is NULL or payManner!=2) - UNION ALL - SELECT id,insertTime,orderNum,3 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_cross_city WHERE state>=7 AND 10>=state AND (payManner is NULL or payManner!=2) - UNION ALL - SELECT id,insertTime,orderNum,type type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,travelMoney orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_logistics WHERE state=6 AND (payManner is NULL or payManner!=2) - ) o - LEFT JOIN t_driver d ON d.id=o.driverId - LEFT JOIN t_user u ON o.userId=u.id - <where> - 1=1 and o.orderMoney>=0 and d.companyId=#{companyId} - <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> - AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="userId != null and userId != ''"> - and find_in_set(o.driverId, #{userId}) - </if> - <if test="type != null and type != ''"> - and o.type=#{type} - </if> - <if test="payType != null and payType != ''"> - and o.payType=#{payType} - </if> - </where> - order by o.insertTime desc - </select> - <select id="getOrderListEx" resultType="map"> - SELECT o.*,IFNULL(d.`name`,'') driverName,IFNULL(d.phone,'') driverPhone,IFNULL(u.nickName,'') userName,IFNULL(u.phone,'') userPhone, - (SELECT IFNULL(SUM(money),0) FROM t_income WHERE incomeId=o.id AND orderType=o.type) totalMoney, - (SELECT IFNULL(SUM(money),0) FROM t_income WHERE incomeId=o.id AND orderType=o.type AND userType=2 AND objectId=o.driverId) driverMoney, - (SELECT IFNULL(SUM(money),0) FROM t_order_cancel WHERE orderId=o.id AND orderType=o.type) cancleMoney, - (SELECT IFNULL(SUM(money),0) FROM t_reassign WHERE orderId=o.id AND orderType=o.type) reassignMoney, - CASE WHEN o.type>3 THEN (SELECT IFNULL(SUM(payMoney),0) FROM t_order_logistics_spread WHERE orderLogisticsId=o.id) ELSE 0 END spreadMoney, - (SELECT IFNULL(SUM(amount),0) FROM t_order_additional_fee WHERE orderId=o.id AND orderType=o.type) additionalMoney - - FROM ( - SELECT id,insertTime,orderNum,2 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,travelMoney orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_taxi WHERE state>=7 AND 10>=state AND (payManner is NULL or payManner!=2) - UNION ALL - SELECT id,insertTime,orderNum,1 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,startMoney+mileageMoney+durationMoney+waitMoney+longDistanceMoney orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_private_car WHERE state>=7 AND 10>=state AND (payManner is NULL or payManner!=2) - UNION ALL - SELECT id,insertTime,orderNum,3 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_cross_city WHERE state>=7 AND 10>=state AND (payManner is NULL or payManner!=2) - UNION ALL - SELECT id,insertTime,orderNum,type type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,travelMoney orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,timeOutMoney,IFNULL(redPacketMoney,0)+IFNULL(couponMoney,0)+IFNULL(discountMoney,0)+IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_logistics WHERE state=6 AND (payManner is NULL or payManner!=2) - ) o - LEFT JOIN t_driver d ON d.id=o.driverId - LEFT JOIN t_user u ON o.userId=u.id - <where> - 1=1 and o.orderMoney>=0 and d.companyId=#{companyId} - <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> - AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="userId != null and userId != ''"> - and find_in_set(o.driverId, #{userId}) - </if> - <if test="type != null and type != ''"> - and o.type=#{type} - </if> - <if test="payType != null and payType != ''"> - and o.payType=#{payType} - </if> - </where> - order by o.insertTime desc - </select> - <select id="getIncomeOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> - SELECT o.*,IFNULL(d.`name`,'') driverName,IFNULL(d.phone,'') driverPhone,IFNULL(u.nickName,'') userName,IFNULL(u.phone,'') userPhone,i.insertTime, - i.money money, - i.type incomeType, - (SELECT SUM(amount) FROM t_order_additional_fee WHERE orderType = o.type and orderId = o.id) as additionalFee - FROM t_income i LEFT JOIN ( - SELECT id,orderNum,2 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_taxi WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,orderNum,1 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_private_car WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,orderNum,3 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_cross_city WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,orderNum,type type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_logistics WHERE state=6 - ) o ON i.incomeId=o.id AND i.orderType=o.type - LEFT JOIN t_driver d ON d.id=o.driverId - LEFT JOIN t_user u ON o.userId=u.id - - <where> - 1=1 and i.userType=1 and i.objectId=#{companyId} AND i.type!=5 - <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> - AND (i.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="phone != null and phone != ''"> - and d.phone LIKE CONCAT('%',#{phone},'%') - </if> - <if test="name != null and name != ''"> - and d.name LIKE CONCAT('%',#{name},'%') - </if> - <if test="type != null and type != ''"> - and o.type=#{type} - </if> - <if test="state!=null and state!='' and state==1"> - and payState='未支付' - </if> - - <if test="state!=null and state!='' and state==2"> - and payState='已支付' - </if> - <if test="null != income"> - and i.type = #{income} - </if> - </where> - order by i.insertTime desc - </select> - <select id="getIncomeOrderListEx" resultType="map"> - SELECT o.*,IFNULL(d.`name`,'') driverName,IFNULL(d.phone,'') driverPhone,IFNULL(u.nickName,'') userName,IFNULL(u.phone,'') userPhone,i.insertTime, - i.money money, - i.type incomeType - FROM t_income i LEFT JOIN ( - SELECT id,orderNum,2 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_taxi WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,orderNum,1 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_private_car WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,orderNum,3 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_cross_city WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,orderNum,type type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_logistics WHERE state=6 - ) o ON i.incomeId=o.id AND i.orderType=o.type - LEFT JOIN t_driver d ON d.id=o.driverId - LEFT JOIN t_user u ON o.userId=u.id - - <where> - 1=1 and i.userType=1 and i.objectId=#{companyId} AND i.type!=5 - <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> - AND (i.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="phone != null and phone != ''"> - and d.phone LIKE CONCAT('%',#{phone},'%') - </if> - <if test="name != null and name != ''"> - and d.name LIKE CONCAT('%',#{name},'%') - </if> - <if test="type != null and type != ''"> - and o.type=#{type} - </if> - <if test="state!=null and state!='' and state==1"> - and payState='未支付' - </if> - - <if test="state!=null and state!='' and state==2"> - and payState='已支付' - </if> - <if test="null != income"> - and i.type = #{income} - </if> - </where> - - order by i.insertTime desc - </select> - - <select id="getIncomeOrderSumMoney" resultType="map"> - SELECT sum(o.orderMoney) orderMoney,sum(i.money) money,sum(o.payMoney) payMoney,sum(o.couponMoney) couponMoney,sum(o.discountAmount) discountAmount,sum(o.redPacketMoney) redPacketMoney, - (SELECT SUM(amount) FROM t_order_additional_fee WHERE orderType = o.type and orderId = o.id) as additionalFee - FROM t_income i LEFT JOIN ( - SELECT id,insertTime,orderNum,2 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_taxi WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,insertTime,orderNum,1 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_private_car WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,insertTime,orderNum,3 type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,0 tipMoney,IFNULL(holidayFee,0) holidayFee,0 timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_cross_city WHERE state>=7 AND 10>=state - UNION ALL - SELECT id,insertTime,orderNum,type type,payType,CASE WHEN payType=1 THEN '微信' WHEN payType=2 THEN '支付宝' WHEN payType=3 THEN '其他' ELSE '' END payTypeName,driverId,userId,orderMoney,tipMoney,IFNULL(holidayFee,0) holidayFee,timeOutMoney,IFNULL(couponMoney,0)+IFNULL(discountMoney,0) as couponMoney, IFNULL(discountAmount,0) discountAmount,IFNULL(thankYouFee,0) thankYouFee, IFNULL(redPacketMoney,0) as redPacketMoney, IFNULL(payMoney, 0) AS payMoney,CASE WHEN state=7 THEN '未支付' ELSE '已支付' END payState FROM t_order_logistics WHERE state=6 - ) o ON i.incomeId=o.id AND i.orderType=o.type - LEFT JOIN t_driver d ON d.id=o.driverId - LEFT JOIN t_user u ON o.userId=u.id - - <where> - 1=1 and i.userType=1 and i.objectId=#{companyId} AND i.type!=5 - <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> - AND (i.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="phone != null and phone != ''"> - and d.phone LIKE CONCAT('%',#{phone},'%') - </if> - <if test="name != null and name != ''"> - and d.name LIKE CONCAT('%',#{name},'%') - </if> - <if test="type != null and type != ''"> - and o.type=#{type} - </if> - <if test="state!=null and state!='' and state==1"> - and payState='未支付' - </if> - - <if test="state!=null and state!='' and state==2"> - and payState='已支付' - </if> - <if test="null != income"> - and i.type = #{income} - </if> - </where> - - order by i.insertTime desc - </select> - <select id="queryOtherIncomeDetail" resultType="map"> - select * from ( - select - a.id, - 1 as orderType, - a.orderNum, - b.nickName, - b.phone, - (select sum(amount) from t_order_additional_fee where orderType = 1 and orderId = a.id) as additionalFee, - a.thankYouFee, - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime - from t_order_private_car a - left join t_user b on (a.userId = b.id) - where a.state in (8, 9) and a.isDelete = 1 and a.pid is not null - <if test="null != beginTime and '' != beginTime and null != endTime and '' != endTime"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{beginTime} and #{endTime} - </if> - <if test="null != orderNo and '' != orderNo"> - and a.orderNum like CONCAT('%', #{orderNo}, '%') - </if> - <if test="null != name and '' != name"> - and b.nickName like CONCAT('%', #{name}, '%') - </if> - <if test="null != phone and '' != phone"> - and b.phone like CONCAT('%', #{phone}, '%') - </if> - union all - - select - a.id, - 2 as orderType, - a.orderNum, - b.nickName, - b.phone, - (select sum(amount) from t_order_additional_fee where orderType = 2 and orderId = a.id) as additionalFee, - a.thankYouFee, - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime - from t_order_taxi a - left join t_user b on (a.userId = b.id) - where a.state in (8, 9) and a.isDelete = 1 - <if test="null != beginTime and '' != beginTime and null != endTime and '' != endTime"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{beginTime} and #{endTime} - </if> - <if test="null != orderNo and '' != orderNo"> - and a.orderNum like CONCAT('%', #{orderNo}, '%') - </if> - <if test="null != name and '' != name"> - and b.nickName like CONCAT('%', #{name}, '%') - </if> - <if test="null != phone and '' != phone"> - and b.phone like CONCAT('%', #{phone}, '%') - </if> - - union all - - select - a.id, - 3 as orderType, - a.orderNum, - b.nickName, - b.phone, - (select sum(amount) from t_order_additional_fee where orderType = 2 and orderId = a.id) as additionalFee, - a.thankYouFee, - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime - from t_order_cross_city a - left join t_user b on (a.userId = b.id) - where a.state in (8, 9) and a.isDelete = 1 - <if test="null != beginTime and '' != beginTime and null != endTime and '' != endTime"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{beginTime} and #{endTime} - </if> - <if test="null != orderNo and '' != orderNo"> - and a.orderNum like CONCAT('%', #{orderNo}, '%') - </if> - <if test="null != name and '' != name"> - and b.nickName like CONCAT('%', #{name}, '%') - </if> - <if test="null != phone and '' != phone"> - and b.phone like CONCAT('%', #{phone}, '%') - </if> - - union all - - select - a.id, - type as orderType, - a.orderNum, - b.nickName, - b.phone, - (select sum(amount) from t_order_additional_fee where orderType = a.type and orderId = a.id) as additionalFee, - a.thankYouFee, - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime - from t_order_logistics a - left join t_user b on (a.userId = b.id) - where a.state in (6, 9) and a.isDelete = 1 - <if test="null != beginTime and '' != beginTime and null != endTime and '' != endTime"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{beginTime} and #{endTime} - </if> - <if test="null != orderNo and '' != orderNo"> - and a.orderNum like CONCAT('%', #{orderNo}, '%') - </if> - <if test="null != name and '' != name"> - and b.nickName like CONCAT('%', #{name}, '%') - </if> - <if test="null != phone and '' != phone"> - and b.phone like CONCAT('%', #{phone}, '%') - </if> - - union all - - select - a.id, - 7 as orderType, - a.orderNum, - b.nickName, - b.phone, - (select sum(amount) from t_order_additional_fee where orderType = 7 and orderId = a.id) as additionalFee, - a.thankYouFee, - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime - from t_order_call a - left join t_user b on (a.userId = b.id) - where a.state in (8, 9) and a.isDelete = 1 - <if test="null != beginTime and '' != beginTime and null != endTime and '' != endTime"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{beginTime} and #{endTime} - </if> - <if test="null != orderNo and '' != orderNo"> - and a.orderNum like CONCAT('%', #{orderNo}, '%') - </if> - <if test="null != name and '' != name"> - and b.nickName like CONCAT('%', #{name}, '%') - </if> - <if test="null != phone and '' != phone"> - and b.phone like CONCAT('%', #{phone}, '%') - </if> - ) as aa where (aa.additionalFee != 0 or aa.thankYouFee != 0) order by aa.insertTime desc - </select> </mapper> -- Gitblit v1.7.1