Pu Zhibing
2025-03-28 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IncomeMapper.xml
@@ -15,55 +15,45 @@
    </resultMap>
    <select  id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT
            date_format(insertTime, '%Y-%m-%d') times,
            SUM(
                CASE
                WHEN type = 1 THEN
                    money
                ELSE
                    0
                END
            ) activityMoney,
            SUM(
                CASE
                WHEN type = 1 THEN
                    0
                ELSE
                    money
                END
            ) orderMoney
        FROM
            t_income
        WHERE userType=2 AND objectId=#{id}
        GROUP BY
            date_format(insertTime, '%Y-%m-%d')
        ORDER BY date_format(insertTime, '%Y-%m-%d')  DESC
            aa.times,
            ROUND(sum(aa.activityMoney), 2) as activityMoney,
            ROUND(sum(aa.onlineMoney), 2) as onlineMoney,
            ROUND(sum(aa.cashMoney), 2) as cashMoney
        FROM (
          SELECT
             date_format(insertTime, '%Y-%m-%d') times,
             SUM(CASE WHEN type = 1 THEN money ELSE 0 END) activityMoney,
              SUM(CASE WHEN type = 1 THEN 0 ELSE money END) onlineMoney,
             0 cashMoney
           FROM
             t_income
           WHERE userType=2 AND objectId=#{id} GROUP BY date_format(insertTime, '%Y-%m-%d')
           union all
           select date_format(travelTime, '%Y-%m-%d') times, 0, 0, ROUND(sum(payMoney), 2) from t_order_private_car where driverId = #{id} and payType = 4 and state in (8, 9) and isDelete = 1 GROUP BY date_format(travelTime, '%Y-%m-%d')
           union all
           select date_format(travelTime, '%Y-%m-%d') times, 0, 0, ROUND(sum(payMoney), 2) from t_order_logistics where driverId = #{id} and payType = 4 and state in (8, 9) and isDelete = 1 GROUP BY date_format(travelTime, '%Y-%m-%d')
        ) AS aa GROUP BY aa.times ORDER BY aa.times DESC
    </select>
    <select  id="getExcelList" resultType="map">
        SELECT
            date_format(insertTime, '%Y-%m-%d') times,
            SUM(
                CASE
                WHEN type = 1 THEN
                    money
                ELSE
                    0
                END
            ) activityMoney,
            SUM(
                CASE
                WHEN type = 1 THEN
                    0
                ELSE
                    money
                END
            ) orderMoney
        FROM
            t_income
        WHERE userType=2 AND objectId=#{id}
        GROUP BY
            date_format(insertTime, '%Y-%m-%d')
        ORDER BY date_format(insertTime, '%Y-%m-%d')  DESC
       SELECT
          aa.times,
          ROUND(sum(aa.activityMoney), 2) as activityMoney,
          ROUND(sum(aa.onlineMoney), 2) as onlineMoney,
          ROUND(sum(aa.cashMoney), 2) as cashMoney
       FROM (
            SELECT
               date_format(insertTime, '%Y-%m-%d') times,
               SUM(CASE WHEN type = 1 THEN money ELSE 0 END) activityMoney,
               SUM(CASE WHEN type = 1 THEN 0 ELSE money END) onlineMoney,
               0 cashMoney
            FROM
               t_income
            WHERE userType=2 AND objectId=#{id} GROUP BY date_format(insertTime, '%Y-%m-%d')
            union all
            select date_format(travelTime, '%Y-%m-%d') times, 0, 0, ROUND(sum(payMoney), 2) from t_order_private_car where driverId = #{id} and payType = 4 and state in (8, 9) and isDelete = 1 GROUP BY date_format(travelTime, '%Y-%m-%d')
            union all
            select date_format(travelTime, '%Y-%m-%d') times, 0, 0, ROUND(sum(payMoney), 2) from t_order_logistics where driverId = #{id} and payType = 4 and state in (8, 9) and isDelete = 1 GROUP BY date_format(travelTime, '%Y-%m-%d')
       ) AS aa GROUP BY aa.times ORDER BY aa.times DESC
    </select>
    <select  id="getList1" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
          select aa.startTime as times, aa.driverNum, bb.duration as timeNumber from (