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
| <?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 * from (
| 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>
| ) as aa order by aa.sort
| </select>
|
|
|
| <select id="getWorldCupList" resultType="com.dsh.communityWorldCup.model.WorldCupListVo">
| select * from (
| 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,
| ifnull(b.num, 0) + a.basePeople as heat
| from t_world_cup a
| left join (select worldCupId, count(*) as num from t_world_cup_payment_participant where worldCupPaymentId in (select id from t_world_cup_payment where payStatus = 2 and state = 1) group by worldCupId) b on (a.id = b.worldCupId)
| where a.status in (1, 2) order by a.createTime desc
| <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} between #{startAge} and #{endAge}
| </if>
| ) as aa
| <if test="null != item.sort and 1 == item.sort">
| order by aa.heat
| </if>
| <if test="null != item.sort and 2 == item.sort">
| order by aa.heat desc
| </if>
| </select>
|
|
|
| <select id="getWorldCupInfo" resultType="com.dsh.communityWorldCup.model.WorldCupInfo">
| select
| a.id,
| a.infoImg,
| a.name,
| ifnull(b.num, 0) 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
| left join (select worldCupId, count(*) as num from t_world_cup_payment_participant where worldCupPaymentId in (select id from t_world_cup_payment where payStatus = 2 and state = 1) group by worldCupId) b on (a.id = b.worldCupId)
| where a.id = #{id}
| </select>
| </mapper>
|
|