xuhy
2024-08-24 146cffe8e1a2223677dadf2b51e6fd4fd08e5810
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.order.mapper.TChargingOrderMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.order.api.model.TChargingOrder">
        <id column="id" property="id" />
        <result column="code" property="code" />
        <result column="order_type" property="orderType" />
        <result column="order_classification" property="orderClassification" />
        <result column="app_user_id" property="appUserId" />
        <result column="app_user_car_id" property="appUserCarId" />
        <result column="site_id" property="siteId" />
        <result column="parking_lot_id" property="parkingLotId" />
        <result column="charging_pile_id" property="chargingPileId" />
        <result column="charging_gun_id" property="chargingGunId" />
        <result column="charging_capacity" property="chargingCapacity"/>
        <result column="charging_power" property="chargingPower"/>
        <result column="start_time" property="startTime" />
        <result column="end_time" property="endTime" />
        <result column="status" property="status" />
        <result column="end_mode" property="endMode"/>
        <result column="recharge_amount" property="rechargeAmount" />
        <result column="recharge_payment_type" property="rechargePaymentType" />
        <result column="recharge_payment_status" property="rechargePaymentStatus" />
        <result column="recharge_serial_number" property="rechargeSerialNumber" />
        <result column="order_amount" property="orderAmount" />
        <result column="app_coupon_id" property="appCouponId" />
        <result column="coupon_discount_amount" property="couponDiscountAmount" />
        <result column="vip_discount" property="vipDiscount" />
        <result column="vip_discount_amount" property="vipDiscountAmount" />
        <result column="payment_amount" property="paymentAmount" />
        <result column="refund_code" property="refundCode" />
        <result column="refund_amount" property="refundAmount" />
        <result column="refund_status" property="refundStatus" />
        <result column="refund_serial_number" property="refundSerialNumber" />
        <result column="refund_time" property="refundTime" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, code, order_type, order_classification, app_user_id, app_user_car_id,site_id, parking_lot_id, charging_pile_id, charging_gun_id, start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag
    </sql>
 
    
    <select id="getMyChargingOrderList" resultMap="BaseResultMap">
        select * from t_charging_order where del_flag = 0 and app_user_id = #{appUserId}
        <if test="1 == type">
            and id not in (select order_id from t_order_evaluate where order_type = 1 and app_user_id = #{appUserId} and del_flag = 0)
        </if>
        order by create_time desc
        <if test="null != pageCurr and null != pageSize">
            limit #{pageCurr}, #{pageSize}
        </if>
    </select>
    <select id="getNoInvoicedOrder" resultMap="BaseResultMap">
        select * from t_charging_order where del_flag = 0 and app_user_id = #{appUserId}
        <if test="null != month and '' != month">
            and DATE_FORMAT(end_time, '%Y-%m') = #{month}
        </if>
        and id not in (select order_id from t_order_invoice_detail where order_type = 1)
        order by create_time desc
        <if test="null != pageCurr and null != pageSize">
            limit #{pageCurr}, #{pageSize}
        </if>
    </select>
 
    <select id="chargingOrder" resultType="com.ruoyi.order.api.vo.ChargingOrderVO">
        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.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 = #{req.status}
        </if>
        <if test="req.siteId != null ">
            and t1.site_id = #{req.siteId}
        </if>
        <if test="req.pileId != null ">
            and t1.charging_pile_id = #{req.pileId}
        </if>
        <if test="req.gunId != null ">
            and t1.charging_gun_id = #{req.gunId}
        </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>