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/IncomeMapper.xml | 354 ----------------------------------------------------------- 1 files changed, 0 insertions(+), 354 deletions(-) diff --git a/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IncomeMapper.xml b/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IncomeMapper.xml index 11c2ffd..c672369 100644 --- a/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IncomeMapper.xml +++ b/ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IncomeMapper.xml @@ -13,358 +13,4 @@ <result column="money" property="money"/> <result column="insertTime" property="insertTime"/> </resultMap> - - - <select id="summaryOfIncomeDetailsList" resultType="map"> - select * from ( - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime - from t_income where userType = 1 and money > 0 - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - group by DATE_FORMAT(insertTime, '%Y/%m/%d') - ) as aa order by aa.insertTime desc - <if test="null != offset and null != limit"> - limit #{offset}, #{limit} - </if> - </select> - - - <select id="summaryOfIncomeDetailsListCount" resultType="int"> - select count(1) from ( - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime - from t_income where userType = 1 and money > 0 - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - group by DATE_FORMAT(insertTime, '%Y/%m/%d') - ) as aa - </select> - - - <select id="summaryOfIncomeDetailsListSum" resultType="map"> - select - ifnull(ROUND(sum(aa.orderRevenue), 2), 0) as orderRevenue, - ifnull(ROUND(sum(aa.taxiCardRevenue), 2), 0) as taxiCardRevenue, - ifnull(ROUND(sum(aa.overtimeDeduction), 2), 0) as overtimeDeduction, - ifnull(ROUND(sum(aa.complaintDeductionProceeds), 2), 0) as complaintDeductionProceeds, - ifnull(ROUND(sum(aa.other), 2), 0) as other - from ( - select sum(money) as orderRevenue, 0 as taxiCardRevenue, 0 as overtimeDeduction, 0 as complaintDeductionProceeds, 0 as other from t_income where userType = 1 and money > 0 and type = 2 - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - union all - - select 0 as orderRevenue, sum(money) as taxiCardRevenue, 0 as overtimeDeduction, 0 as complaintDeductionProceeds, 0 as other from t_income where userType = 1 and money > 0 and type = 5 - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - union all - - select 0 as orderRevenue, 0 as taxiCardRevenue, sum(money) as overtimeDeduction, 0 as complaintDeductionProceeds, 0 as other from t_income where userType = 1 and money > 0 and type in (7, 9) - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - union all - - select 0 as orderRevenue, 0 as taxiCardRevenue, 0 as overtimeDeduction, sum(money) as complaintDeductionProceeds, 0 as other from t_income where userType = 1 and money > 0 and type = 8 - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - union all - - select 0 as orderRevenue, 0 as taxiCardRevenue, 0 as overtimeDeduction, 0 as complaintDeductionProceeds, sum(money) as other from t_income where userType = 1 and money > 0 and type in (1, 3, 4, 6) - <if test="null != companyId"> - and objectId = #{companyId} - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - ) as aa - - </select> - - - - <select id="summaryOfIncomeDetailsListGroupSum" resultType="map"> - select * from ( - select - aa.userType, - aa.objectId, - aa.type, - aa.orderType, - aa.insertTime, - ifnull(sum(aa.payMoney), 0) as payMoney, - aa.nickName, - aa.phone, - ifnull(sum(aa.overtimeDeduction), 0) as overtimeDeduction, - ifnull(sum(aa.money), 0) as money, - ifnull(sum(aa.complaint), 0) as complaint - from ( - select - a.userType, - a.objectId, - a.type, - a.orderType, - DATE_FORMAT(a.insertTime, '%Y/%m/%d') as insertTime, - if(a.orderType = 1, b.payMoney, if(a.orderType = 2, c.payMoney, if(a.orderType = 3, d.payMoney, if(a.orderType = 4, e.payMoney, if(a.orderType = 5, f.payMoney, if(a.orderType = 6, 0, if(a.orderType = 7, h.payMoney, 0))))))) as payMoney, - if(a.orderType = 1, u1.nickName, if(a.orderType = 2, u2.nickName, if(a.orderType = 3, u3.nickName, if(a.orderType = 4, u4.nickName, if(a.orderType = 5, u5.nickName, if(a.orderType = 6, u6.nickName, if(a.orderType = 2, u7.nickName, ''))))))) as nickName, - if(a.orderType = 1, u1.phone, if(a.orderType = 2, u2.phone, if(a.orderType = 3, u3.phone, if(a.orderType = 4, u4.phone, if(a.orderType = 5, u5.phone, if(a.orderType = 6, u6.phone, if(a.orderType = 2, u7.phone, ''))))))) as phone, - 0 as overtimeDeduction, - if(a.orderType = 1 and a.incomeId = b.id, a.money, if(a.orderType = 2 and a.incomeId = c.id, a.money, if(a.orderType = 3 and a.incomeId = d.id, a.money, if(a.orderType = 4 and a.incomeId = e.id, a.money, if(a.orderType = 5 and a.incomeId = f.id, a.money, if(a.orderType = 6 and a.incomeId = g.id, a.money, if(a.orderType = 7 and a.incomeId = h.id, a.money, 0))))))) as money, - 0 as complaint - from t_income a - left join t_order_private_car b on (a.orderType = 1 and a.incomeId = b.id) - left join t_order_taxi c on (a.orderType = 2 and a.incomeId = c.id) - left join t_order_cross_city d on (a.orderType = 3 and a.incomeId = d.id) - left join t_order_logistics e on (a.orderType = 4 and a.incomeId = e.id) - left join t_order_logistics f on (a.orderType = 5 and a.incomeId = f.id) - left join t_order_chartered_car g on (a.orderType = 6 and a.incomeId = g.id) - left join t_order_call h on (a.orderType = 7 and a.incomeId = h.id) - left join t_user u1 on (b.userId = u1.id) - left join t_user u2 on (c.userId = u2.id) - left join t_user u3 on (d.userId = u3.id) - left join t_user u4 on (e.userId = u4.id) - left join t_user u5 on (f.userId = u5.id) - left join t_user u6 on (g.userId = u6.id) - left join t_user u7 on (h.userId = u7.id) - where a.type = 2 - - union all - - select - a.userType, - a.objectId, - a.type, - a.orderType, - DATE_FORMAT(a.insertTime, '%Y/%m/%d') as insertTime, - 0 as payMoney, - if(a.orderType = 1, u1.nickName, if(a.orderType = 2, u2.nickName, if(a.orderType = 3, u3.nickName, if(a.orderType = 4, u4.nickName, if(a.orderType = 5, u5.nickName, if(a.orderType = 6, u6.nickName, if(a.orderType = 2, u7.nickName, ''))))))) as nickName, - if(a.orderType = 1, u1.phone, if(a.orderType = 2, u2.phone, if(a.orderType = 3, u3.phone, if(a.orderType = 4, u4.phone, if(a.orderType = 5, u5.phone, if(a.orderType = 6, u6.phone, if(a.orderType = 2, u7.phone, ''))))))) as phone, - if(a.orderType = 1 and a.incomeId = b.id, a.money, if(a.orderType = 2 and a.incomeId = c.id, a.money, if(a.orderType = 3 and a.incomeId = d.id, a.money, if(a.orderType = 4 and a.incomeId = e.id, a.money, if(a.orderType = 5 and a.incomeId = f.id, a.money, if(a.orderType = 6 and a.incomeId = g.id, a.money, if(a.orderType = 7 and a.incomeId = h.id, a.money, 0))))))) as overtimeDeduction, - 0 as money, - 0 as complaint - from t_income a - left join t_order_private_car b on (a.orderType = 1 and a.incomeId = b.id) - left join t_order_taxi c on (a.orderType = 2 and a.incomeId = c.id) - left join t_order_cross_city d on (a.orderType = 3 and a.incomeId = d.id) - left join t_order_logistics e on (a.orderType = 4 and a.incomeId = e.id) - left join t_order_logistics f on (a.orderType = 5 and a.incomeId = f.id) - left join t_order_chartered_car g on (a.orderType = 6 and a.incomeId = g.id) - left join t_order_call h on (a.orderType = 7 and a.incomeId = h.id) - left join t_user u1 on (b.userId = u1.id) - left join t_user u2 on (c.userId = u2.id) - left join t_user u3 on (d.userId = u3.id) - left join t_user u4 on (e.userId = u4.id) - left join t_user u5 on (f.userId = u5.id) - left join t_user u6 on (g.userId = u6.id) - left join t_user u7 on (h.userId = u7.id) - where a.type = 7 - - union all - - select - a.userType, - a.objectId, - a.type, - a.orderType, - DATE_FORMAT(a.insertTime, '%Y/%m/%d') as insertTime, - 0 as payMoney, - '' as nickName, - '' as phone, - 0 as overtimeDeduction, - 0 as money, - a.money as complaint - from t_income a - where a.type = 8 - ) as aa group by aa.userType, aa.objectId, aa.type, aa.orderType, aa.insertTime, aa.nickName, aa.phone - ) as datas where 1 = 1 - <if test="null != userType"> - and datas.userType = #{userType} - </if> - <if test="null != objectId"> - and datas.objectId = #{objectId} - </if> - <if test="null != insertTime"> - and datas.insertTime = #{insertTime} - </if> - order by datas.phone - </select> - - - <select id="getSumData" resultType="double"> - select - ifnull(sum(aa.money), 0) as money - from ( - select money,userType,objectId,DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime - from t_income where 1 = 1 - <if test="null != userType"> - and userType = #{userType} - </if> - <if test="null != objectId"> - and objectId = #{objectId} - </if> - <if test="null != insertTime"> - and DATE_FORMAT(insertTime, '%Y/%m/%d') = #{insertTime} - </if> - <if test="null != types"> - and type in - <foreach collection="types" item="item" index="index" open="(" separator="," close=")"> - #{item} - </foreach> - </if> - ) as aa group by aa.userType,aa.objectId,aa.insertTime - </select> - - - <select id="summaryOfSpendingDetailsList" resultType="map"> - select * from ( - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime - from t_income where userType = 2 and money > 0 - <if test="null != companyId"> - and objectId in (select id from t_driver where authState = 2 and flag != 3 and companyId = #{companyId}) - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - group by DATE_FORMAT(insertTime, '%Y/%m/%d') - ) as aa order by aa.insertTime desc - <if test="null != offset and null != limit"> - limit #{offset}, #{limit} - </if> - </select> - - - <select id="summaryOfSpendingDetailsListCount" resultType="int"> - select count(1) from ( - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime - from t_income where userType = 1 and money > 0 - <if test="null != companyId"> - and objectId in (select id from t_driver where authState = 2 and flag != 3 and companyId = #{companyId}) - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - group by DATE_FORMAT(insertTime, '%Y/%m/%d') - ) as aa - </select> - - <select id="summaryOfSpendingDetailsListSum" resultType="map"> - select - ifnull(ROUND(sum(aa.orderRevenue), 2), 0) as orderRevenue, - ifnull(ROUND(sum(aa.activityAward), 2), 0) as activityAward, - ifnull(ROUND(sum(aa.other), 2), 0) as other, - ROUND(ifnull(sum(aa.orderRevenue), 0) + ifnull(sum(aa.activityAward), 0) + ifnull(sum(aa.other), 0), 2) as `all` - from ( - select sum(money) as orderRevenue, 0 as activityAward, 0 as other from t_income where userType = 2 and money > 0 and type = 2 - <if test="null != companyId"> - and objectId in (select id from t_driver where authState = 2 and flag != 3 and companyId = #{companyId}) - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - union all - - select 0 as orderRevenue, sum(money) as activityAward, 0 as other from t_income where userType = 2 and money > 0 and type = 1 - <if test="null != companyId"> - and objectId in (select id from t_driver where authState = 2 and flag != 3 and companyId = #{companyId}) - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - union all - - select 0 as orderRevenue, 0 as activityAward, sum(money) as other from t_income where userType = 2 and money > 0 and type in (3, 4, 5, 6, 7, 8, 9) - <if test="null != companyId"> - and objectId in (select id from t_driver where authState = 2 and flag != 3 and companyId = #{companyId}) - </if> - <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> - and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{startTime} and #{endTime} - </if> - - ) as aa - - </select> - - - <select id="summaryOfSpendingDetailsList1" resultType="map"> - select - aa.insertTime, - aa.orderType, - aa.type, - bb.`name`, - bb.phone, - aa.objectId, - ROUND(sum(aa.orderRevenue), 2) as orderRevenue, - ROUND(sum(aa.activityAward), 2) as activityAward, - ROUND(sum(aa.other), 2) as other, - ROUND((sum(aa.orderRevenue) + sum(aa.activityAward) + sum(aa.other)), 2) as `all` - from ( - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime, - orderType, - '跑单收入' as type, - objectId, - sum(money) as orderRevenue, - 0 as activityAward, - 0 as other - from t_income where userType = 2 and type = 2 and DATE_FORMAT(insertTime, '%Y/%m/%d') = #{insertTime} group by DATE_FORMAT(insertTime, '%Y/%m/%d'), orderType, objectId - - union all - - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime, - orderType, - '活动收入' as type, - objectId, - 0 as orderRevenue, - sum(money) as activityAward, - 0 as other - from t_income where userType = 2 and type = 1 and DATE_FORMAT(insertTime, '%Y/%m/%d') = #{insertTime} group by DATE_FORMAT(insertTime, '%Y/%m/%d'), orderType, objectId - - union all - - select - DATE_FORMAT(insertTime, '%Y/%m/%d') as insertTime, - orderType, - '其他' as type, - objectId, - 0 as orderRevenue, - 0 as activityAward, - sum(money) as other - from t_income where userType = 2 and type in (6, 9) and DATE_FORMAT(insertTime, '%Y/%m/%d') = #{insertTime} group by DATE_FORMAT(insertTime, '%Y/%m/%d'), orderType, objectId - ) as aa - left join t_driver bb on (aa.objectId = bb.id) - group by aa.insertTime, aa.orderType, aa.type, aa.objectId - </select> </mapper> \ No newline at end of file -- Gitblit v1.7.1