<?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 status != 3
|
<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(ifnull(a.registrationClosingTime, a.endTime), '%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.id 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(ifnull(a.registrationClosingTime, a.endTime), '%Y-%m-%d %H:%i') as registrationClosingTime,
|
CONCAT(a.startAge, '-', a.endAge) as age,
|
a.gender,
|
a.province,
|
a.city,
|
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>
|
|
|
|
<select id="worldCupGameStatistics" resultType="map">
|
select
|
a.id,
|
a.`name`,
|
DATE_FORMAT(a.startTime, '%Y.%m.%d %H:%i') as startTime,
|
DATE_FORMAT(a.endTime, '%Y.%m.%d %H:%i') as endTime
|
from t_world_cup a
|
where 1 = 1
|
<if test="null != item.name and '' != item.name">
|
and a.`name` like CONCAT('%', #{item.name}, '%')
|
</if>
|
order by a.createTime desc limit #{item.offset}, #{item.limit}
|
</select>
|
|
<select id="worldCupGameStatisticsCount" resultType="int">
|
select
|
count(*)
|
from t_world_cup a
|
where 1 = 1
|
<if test="null != item.name and '' != item.name">
|
and a.`name` like CONCAT('%', #{item.name}, '%')
|
</if>
|
</select>
|
|
|
|
<update id="updateWorldCupAll">
|
update t_world_cup set name = #{item.name}, startTime = #{item.startTime}, endTime = #{item.endTime}, registrationClosingTime = #{item.registrationClosingTime}, startAge = #{item.startAge}, endAge = #{item.endAge},
|
gender = #{item.gender}, payType = #{item.payType}, cash = #{item.cash}, paiCoin = #{item.paiCoin}, classHour = #{item.classHour}, maxPeople = #{item.maxPeople}, basePeople = #{item.basePeople}, participationIntegral = #{item.participationIntegral},
|
winIntegral = #{item.winIntegral}, province = #{item.province}, provinceCode = #{item.provinceCode}, city = #{item.city}, cityCode = #{item.cityCode}, address = #{item.address}, lon = #{item.lon}, lat = #{item.lat}, coverImg = #{item.coverImg}, homeBackdropImg = #{item.homeBackdropImg},
|
infoImg = #{item.infoImg}, intro = #{item.intro}, content = #{item.content}, status = #{item.status}, createTime = #{item.createTime}, matchNumber = #{item.matchNumber} where id = #{item.id}
|
</update>
|
</mapper>
|