puzhibing
2023-12-22 d45923a8b023f9a010fc75f53b13ffca01c573fa
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
<?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.stylefeng.guns.modular.system.dao.UserActivityBalanceMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.UserActivityBalance">
        <id column="id" property="id"/>
        <result column="enable" property="enable"/>
        <result column="userActivityId" property="userActivityId"/>
        <result column="money" property="money"/>
        <result column="generalNum" property="generalNum"/>
        <result column="generalCouponId" property="generalCouponId"/>
        <result column="specialNum" property="specialNum"/>
        <result column="specialCouponId" property="specialCouponId"/>
        <result column="taxiNum" property="taxiNum"/>
        <result column="taxiCouponId" property="taxiCouponId"/>
        <result column="intercityNum" property="intercityNum"/>
        <result column="intercityCouponId" property="intercityCouponId"/>
        <result column="insertTime" property="insertTime"/>
        <result column="startTime" property="startTime"/>
        <result column="endTime" property="endTime"/>
        <result column="totalPrice" property="totalPrice"/>
        <result column="lavePrice" property="lavePrice"/>
    </resultMap>
 
 
 
    <select id="query" resultType="map">
        select
        a.id as id,
        a.generalNum as generalNum,
        a.specialNum as specialNum,
        a.taxiNum as taxiNum,
        a.intercityNum as intercityNum,
        b.id as bId,
        c.id as cId,
        d.id as dId,
        e.id as eId,
        b.companyId as bcompanyId,
        c.companyId as ccompanyId,
        d.companyId as dcompanyId,
        e.companyId as ecompanyId,
        b.money as bmoney,
        c.money as cmoney,
        d.money as dmoney,
        e.money as emoney,
        b.fullMoney as bfullMoney,
        c.fullMoney as cfullMoney,
        d.fullMoney as dfullMoney,
        e.fullMoney as efullMoney,
        b.couponUseType as bcouponUseType,
        c.couponUseType as ccouponUseType,
        d.couponUseType as dcouponUseType,
        e.couponUseType as ecouponUseType,
        b.couponType as bcouponType,
        c.couponType as ccouponType,
        d.couponType as dcouponType,
        e.couponType as ecouponType,
        DATE_FORMAT(a.startTime, '%Y-%m-%d') as startTime,
        DATE_FORMAT(a.endTime, '%Y-%m-%d') as endTime,
        a.effective as beffective,
        a.effective as ceffective,
        a.effective as deffective,
        a.effective as eeffective,
        a.totalPrice as totalPrice,
        a.lavePrice as lavePrice
        from t_user_activity_balance a
        left join t_sys_coupon_record b on (a.generalCouponId = b.id)
        left join t_sys_coupon_record c on (a.specialCouponId = c.id)
        left join t_sys_coupon_record d on (a.taxiCouponId = d.id)
        left join t_sys_coupon_record e on (a.intercityCouponId = e.id)
        left join t_user_activity f on (a.userActivityId = f.id)
        where a.`enable` = 2 and f.status = 3 and now() between a.startTime and a.endTime and a.money &lt;= #{money}
        and (b.companyId = #{companyId} and c.companyId = #{companyId} and d.companyId = #{companyId} and e.companyId = #{companyId})
    </select>
</mapper>