liujie
2023-09-25 8c55ab2701c99cec16eff92a26fefdf77fcdd28f
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
<?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.dsh.competition.mapper.PaymentCompetitionMapper">
 
 
    <select id="queryMyCompetitionList" resultType="com.dsh.competition.model.CompetitionListVo">
        select
        a.id,
        b.`name`,
        b.coverDrawing,
        b.city as cityName,
        b.registerCondition,
        b.introduction,
        DATE_FORMAT(b.registerEndTime, '%Y-%m-%d %H:%i') as registerEndTime,
        CONCAT(b.startAge, '-', b.endAge) as age,
        b.baseNumber + b.applicantsNumber as heat,
        if(a.payStatus = 3, 4, b.status) as status
        from t_payment_competition a
        left join t_competition b on (a.competitionId = b.id)
        where a.state = 1 and a.appUserId = #{uid} and a.payStatus != 1
        <!--1=未开始,2=进行中,3=已结束,4=已取消-->
        <if test="null != type and 1 == type">
            and b.status = 1 and a.payStatus = 2
        </if>
        <if test="null != type and 2 == type">
            and b.status = 2 and a.payStatus = 2
        </if>
        <if test="null != type and 3 == type">
            and b.status = 3 and a.payStatus = 2
        </if>
        <if test="null != type and 4 == type">
            and a.payStatus = 3
        </if>
        order by a.insertTime desc limit #{pageNo}, #{pageSize}
    </select>
    <select id="queryDatas" resultType="com.dsh.competition.feignclient.model.BillingRequest">
        SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`,
        amount
        from t_payment_competition
        where  payStatus = 2 and payType = 1 and payType = 2
        <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
            and DATE_FORMAT(payTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
        </if>
        <if test="null != appUserId and '' != appUserId ">
            and appUserId = #{appUserId}
        </if>
    </select>
    <select id="queryCancelDatas" resultType="com.dsh.competition.feignclient.model.BillingRequest">
        SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`,
        amount
        from t_payment_competition
        where  payStatus = 3 and payType = 1 and payType = 2
        <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
            and DATE_FORMAT(refundTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
        </if>
        <if test="null != appUserId and '' != appUserId ">
            and appUserId = #{appUserId}
        </if>
    </select>
</mapper>