puzhibing
2024-03-04 7e7f901b2172281dc294dfbc67e6ad00625f09f4
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
<?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.communityWorldCup.mapper.WorldCupMapper">
 
 
    <select id="getWorldCupListCoach" resultType="com.dsh.communityWorldCup.model.WorldCupListCoachVo">
        select
        id,
        name,
        CONCAT(DATE_FORMAT(startTime, '%Y.%m.%d %H:%i'), '-', DATE_FORMAT(endTime, '%Y.%m.%d %H:%i'))as activeTime,
        matchNumber,
        status,
        lon,
        lat,
        CASE status WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE status END as sort
        from t_world_cup where 1 = 1
        <if test="null != item.content and '' != item.content">
            and `name` like CONCAT('%', #{item.content}, '%')
        </if>
        <if test="null != item.storeId">
            and id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId})
        </if>
    </select>
 
 
 
    <select id="getWorldCupList" resultType="com.dsh.communityWorldCup.model.WorldCupListVo">
        select
        a.id,
        a.name,
        DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime,
        CONCAT(a.startAge, '-', a.endAge) as age,
        a.coverImg,
        a.intro as content,
        a.lon,
        a.lat,
        a.basePeople as heat
        from t_world_cup a
        where a.status in (1, 2)
        <if test="null != item.content and '' != item.content">
            and a.name like CONCAT('%', #{item.content}, '%')
        </if>
        <if test="null != item.storeId">
            and a.worldCupId in (select worldCupId from t_world_cup_store where storeId = #{item.storeId})
        </if>
        <if test="null != item.gender">
            and #{item.gender} = a.gender
        </if>
        order by a.createTime desc
    </select>
 
 
 
    <select id="getWorldCupInfo" resultType="com.dsh.communityWorldCup.model.WorldCupInfo">
        select
        a.id,
        a.infoImg,
        a.name,
        a.basePeople as heat,
        DATE_FORMAT(a.startTime, '%Y-%m-%d %H:%i') as startTime,
        DATE_FORMAT(a.endTime, '%Y-%m-%d %H:%i') as endTime,
        DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime,
        CONCAT(a.startAge, '-', a.endAge) as age,
        a.gender,
        a.address,
        a.cash,
        a.paiCoin,
        a.classHour,
        a.intro,
        a.content
        from t_world_cup  a
        where a.id = #{id}
    </select>
 
 
 
    <select id="getWorldCupListAll" resultType="map">
        select
        id,
        `name`,
        DATE_FORMAT(startTime, '%Y.%m.%d %H:%i') as startTime,
        DATE_FORMAT(endTime, '%Y.%m.%d %H:%i') as endTime,
        CONCAT(startAge, '至', endAge) as age,
        gender,
        maxPeople,
        status
        from t_world_cup
        where 1 = 1
        <if test="null != item.name and '' != item.name">
            and `name` like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.startTime and '' != item.startTime">
            and DATE_FORMAT(startTime, '%Y-%m-%d') &gt;= #{item.startTime}
        </if>
        <if test="null != item.endTime and '' != item.endTime">
            and DATE_FORMAT(endTime, '%Y-%m-%d') &lt;= #{item.endTime}
        </if>
        <if test="null != item.status">
            and status= #{item.status}
        </if>
        order by createTime desc limit #{item.offset}, #{item.limit}
    </select>
 
 
    <select id="getWorldCupListAllCount" resultType="int">
        select
        count(*)
        from t_world_cup
        where 1 = 1
        <if test="null != item.name and '' != item.name">
            and `name` like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.startTime and '' != item.startTime">
            and DATE_FORMAT(startTime, '%Y-%m-%d') &gt;= #{item.startTime}
        </if>
        <if test="null != item.endTime and '' != item.endTime">
            and DATE_FORMAT(endTime, '%Y-%m-%d') &lt;= #{item.endTime}
        </if>
        <if test="null != item.status">
            and status= #{item.status}
        </if>
    </select>
</mapper>