xiaoyong931011
2021-04-12 a13a93a493e7e94e28b2225c26e7e13b52d3288c
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?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.matrix.system.activity.dao.ActivitySignReceiveRecordDao">
 
 
    <select id="findSignReceiveList" resultType="com.matrix.system.activity.vo.SignReceiveListVo">
        SELECT
        a.id id,
        b.nick_name nickName,
        a.receive_time reciveTime,
        a.state,
        c.cumulative_day cumulativeDay,
        c.award_type awardType,
        c.award_name awardName,
        c.award_rule awardRule
        FROM
        activity_sign_receive_record a
        LEFT JOIN biz_user b ON a.user_id = b.user_id
        LEFT JOIN activity_sign_award_set c ON a.award_id = c.id
        <where>
            a.company_id = #{record.companyId}
            and a.activity_id = #{record.actId}
            <if test="record.yhmc != null and record.yhmc != ''">
                and b.nick_name like concat('%',#{record.yhmc},'%')
            </if>
            <if test="record.startTime != null ">
                and a.receive_time >= #{record.startTime}
            </if>
            <if test="record.endTime != null">
                and  #{record.endTime} >= a.receive_time
            </if>
        </where>
        <if test="record.sort !=null">
            order by
            a.${record.sort} ${record.order}
        </if>
    </select>
 
    <select id="selectCouponList" resultType="com.matrix.system.activity.vo.CouponVo">
        SELECT
        a.id id,
        a.c_name cName,
        a.end_time endTime
        FROM
        shop_coupon a
        <where>
            a.company_id = #{record.companyId}
            <if test="record.yhjmc != null and record.yhjmc != ''">
                and a.c_name like concat('%',#{record.yhjmc},'%')
            </if>
        </where>
        <if test="record.sort !=null">
            order by
            a.${record.sort} ${record.order}
        </if>
    </select>
 
    <select id="selectGoodsList" resultType="com.matrix.system.activity.vo.GoodsVo">
        SELECT
        a.id id,
        a.name name,
        a.good_type goodType,
        a.code code,
        a.seal_pice sealPice
        FROM
        shopping_goods a
        <where>
            a.company_id = #{record.companyId}
            <if test="record.cpmc != null and record.cpmc != ''">
                and a.name like concat('%',#{record.cpmc},'%')
            </if>
        </where>
        <if test="record.sort !=null">
            order by
            a.${record.sort} ${record.order}
        </if>
    </select>
 
    <select id="getSignAwardReceiveCount" resultType="int">
        SELECT
            count(a.id)
        FROM
            activity_sign_receive_record a
        LEFT JOIN activity_sign_award_set b ON a.award_id = b.id
        where
              b.award_type = 1
              and a.state = 1
              and a.company_id = #{companyId}
            and a.user_id = #{userId}
 
    </select>
 
    <select id="selectSignAwardList" resultType="com.matrix.system.shopXcx.api.vo.SignAwardListVo">
        SELECT
        a.id id,
        a.state state,
        1 total,
        a.receive_time receiveTime,
        b.award_way awardWay,
        b.introduce_img introduceImg,
        b.award_name awardName
 
        FROM
        activity_sign_receive_record a
        LEFT JOIN activity_sign_award_set b ON a.award_id = b.id
        WHERE
        b.award_type = 1
        AND a.state = 1
        and a.company_id = #{record.companyId}
        and a.user_id = #{record.userId}
        <if test="record.sort !=null">
            order by
            a.${record.sort} ${record.order}
        </if>
    </select>
 
    <select id="selectSeeAwardTextVOById" resultType="com.matrix.system.shopXcx.api.vo.SeeAwardTextVo">
        SELECT
            a.id id,
            a.state state,
            a.receive_time receiveTime,
            a.write_off_code writeOffCode,
            1 total,
            b.wechat_img wechatImg,
            b.prize_address prizeAddress,
            b.operation_tip operationTip,
            b.prize_end_time prizeEndTime,
            b.prize_start_time prizeStartTime,
            b.award_way awardWay,
            b.introduce_img introduceImg,
            b.award_name awardName
        FROM
            activity_sign_receive_record a
                LEFT JOIN activity_sign_award_set b ON a.award_id = b.id
        WHERE
        a.id = #{record.awardId}
        and a.company_id = #{record.companyId}
        and a.user_id = #{record.userId}
    </select>
 
</mapper>