<?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') >= #{item.startTime}
|
</if>
|
<if test="null != item.endTime and '' != item.endTime">
|
and DATE_FORMAT(endTime, '%Y-%m-%d') <= #{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') >= #{item.startTime}
|
</if>
|
<if test="null != item.endTime and '' != item.endTime">
|
and DATE_FORMAT(endTime, '%Y-%m-%d') <= #{item.endTime}
|
</if>
|
<if test="null != item.status">
|
and status= #{item.status}
|
</if>
|
</select>
|
</mapper>
|