zhibing.pu
2024-08-31 5f25c762e2853e87fc4b86b157ba87cf1322df2f
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -96,70 +96,83 @@
            and t1.charging_gun_id = #{req.gunId}
        </if>
        <if test="startTime1 != null and startTime1!=''">
            and (t1.start_time between #{startTime1} and #{startTime2}
            and (t1.start_time between #{startTime1} and #{startTime2})
        </if>
        <if test="endTime1 != null and endTime1!=''">
            and (t1.end_time between #{endTime1} and #{endTime2}
            and (t1.end_time between #{endTime1} and #{endTime2})
        </if>
    </select>
    <select id="payOrderQuery" resultType="com.ruoyi.order.dto.PayOrderDto">
        SELECT * FROM (SELECT
                           id,
                           `code`,
                           1 as type,
                           title,
                           phone,
                           `status`,
                           order_amount,
                           payment_amount ,
                           create_time,
                           end_time,
                           pay_time
                       FROM
                           charging_pile_order.t_charging_order UNION ALL
                       SELECT
                           id,
                           `code`,
                           2 as type,
                           title,
                           phone,
                           `status`,
                           order_amount,
                           payment_amount ,
                           create_time,
                           receiving_time as end_time,
                           pay_time
                       FROM
                           charging_pile_order.t_shopping_order UNION ALL
                       SELECT
                           id,
                           `code`,
                           3 as type,
                           title,
                           phone,
                           payment_status AS `status`,
                           order_amount,
                           payment_amount ,
                           create_time,
                           create_time as end_time,
                           pay_time
                       FROM
                           charging_pile_order.t_vip_order UNION ALL
                       SELECT
                           id,
                           `code`,
                           4 as type,
                           title,
                           phone,
                           `status`,
                           order_amount ,
                           order_amount as payment_amount,
                           create_time,
                           out_parking_time as end_time,
                           out_parking_time as pay_time
                       FROM
                           charging_pile_service.t_parking_record ) o
        id,
        `code`,
        1 as type,
        title,
        phone,
        `status`,
        order_amount,
        payment_amount ,
        create_time,
        end_time,
        pay_time,
        refund_status,
        (payment_amount-refund_amount) as final_amount,
        del_flag
        FROM
        charging_pile_order.t_charging_order UNION ALL
        SELECT
        id,
        `code`,
        2 as type,
        title,
        phone,
        `status`,
        order_amount,
        payment_amount ,
        create_time,
        receiving_time as end_time,
        pay_time,
        refund_status,
        (payment_amount-refund_amount) as final_amount,
        del_flag
        FROM
        charging_pile_order.t_shopping_order UNION ALL
        SELECT
        id,
        `code`,
        3 as type,
        title,
        phone,
        payment_status AS `status`,
        order_amount,
        payment_amount ,
        create_time,
        create_time as end_time,
        pay_time,
        refund_status,
        (payment_amount-refund_amount) as final_amount,
        del_flag
        FROM
        charging_pile_order.t_vip_order UNION ALL
        SELECT
        id,
        `code`,
        4 as type,
        title,
        phone,
        `status`,
        order_amount ,
        order_amount as payment_amount,
        create_time,
        out_parking_time as end_time,
        out_parking_time as pay_time,
        null as refund_status,
        0 as final_amount,
        0 as del_flag
        FROM
        charging_pile_service.t_parking_record ) o
                <where>
                     o.del_flag = 0
                    <if test="data.code != null and data.code != ''">
                        AND o.code LIKE CONCAT('%',#{data.code},'%')
                    </if>
@@ -169,9 +182,7 @@
                    <if test="data.type != null">
                        AND o.type = #{data.type}
                    </if>
                    <if test="data.status != null">
                        AND o.status = #{data.status}
                    </if>
                    <if test="data.createTime1 != null">
                        AND o.create_time &gt;= #{data.createTime1}
                    </if>
@@ -179,7 +190,7 @@
                        AND o.create_time &lt;= #{data.createTime2}
                    </if>
                </where>
        ORDER BY o.create_time desc
    </select>
    <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund">
@@ -233,4 +244,78 @@
    </select>
    <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO">
        select t1.* from t_charging_order t1
        where 1=1
        <if test="null != req.code and req.code!=''">
            and t1.code  LIKE CONCAT('%',#{req.code},'%')
        </if>
        <if test="null != req.carIds and req.carIds.size()>0" >
            and t1.app_user_car_id in
            <foreach collection="req.carIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.userIds and req.userIds.size()>0" >
            and t1.app_user_id in
            <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="req.orderType != null ">
            and t1.order_type = #{req.orderType}
        </if>
        <if test="req.status != null ">
            and t1.status = #{status}
        </if>
        <if test="req.status != null ">
            and t1.status = #{req.status}
        </if>
        <if test="req.siteId != null ">
            and t1.site_id = #{req.siteId}
        </if>
        <if test="startTime1 != null and startTime1!=''">
            and (t1.start_time between #{startTime1} and #{startTime2})
        </if>
        <if test="endTime1 != null and endTime1!=''">
            and (t1.end_time between #{endTime1} and #{endTime2})
        </if>
    </select>
    <select id="chargingList1" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO">
        select t1.* from t_charging_order t1
        where 1=1
        <if test="null != req.code and req.code!=''">
            and t1.code  LIKE CONCAT('%',#{req.code},'%')
        </if>
        <if test="null != req.carIds and req.carIds.size()>0" >
            and t1.app_user_car_id in
            <foreach collection="req.carIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != req.userIds and req.userIds.size()>0" >
            and t1.app_user_id in
            <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="req.orderType != null ">
            and t1.order_type = #{req.orderType}
        </if>
        <if test="req.status != null ">
            and t1.status = #{status}
        </if>
        <if test="req.status != null ">
            and t1.status = #{req.status}
        </if>
        <if test="req.siteId != null ">
            and t1.site_id = #{req.siteId}
        </if>
        <if test="startTime1 != null and startTime1!=''">
            and (t1.start_time between #{startTime1} and #{startTime2})
        </if>
        <if test="endTime1 != null and endTime1!=''">
            and (t1.end_time between #{endTime1} and #{endTime2})
        </if>
    </select>
</mapper>