You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
419 lines
17 KiB
419 lines
17 KiB
<?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.ccsens.mt.persist.dao.CompeteProjectConfigDao">
|
|
<resultMap id="BaseResultMap" type="com.ccsens.mt.bean.po.CompeteProjectConfig">
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="project_id" jdbcType="BIGINT" property="projectId" />
|
|
<result column="site_num" jdbcType="INTEGER" property="siteNum" />
|
|
<result column="start_time" jdbcType="BIGINT" property="startTime" />
|
|
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
|
|
<result column="project_duration" jdbcType="BIGINT" property="projectDuration" />
|
|
</resultMap>
|
|
|
|
<resultMap id="startOrderByCompany" type="com.ccsens.mt.bean.vo.ProvinceCompeteVo$StartOrderByCompanyAndProject">
|
|
<id column="projectId" property="projectId" />
|
|
<result column="projectName" property="projectName" />
|
|
<result column="startTime" property="startTime" />
|
|
<result column="endTime" property="endTime" />
|
|
<result column="videoRestrict" property="restrict" />
|
|
<collection property="startOrderList" ofType="com.ccsens.mt.bean.vo.ProvinceCompeteVo$StartOrder">
|
|
<id column="startOrderId" property="startOrderId" />
|
|
<result column="competeOrder" property="competeOrder" />
|
|
<result column="site" property="site" />
|
|
<result column="team" property="team" />
|
|
<result column="groupName" property="groupName" />
|
|
<result column="videoUrl" property="videoUrl" />
|
|
<result column="playerOrTeamId" property="playerOrTeamId" />
|
|
<collection property="playerNameList" ofType="String">
|
|
<result column="playerName"/>
|
|
</collection>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<resultMap id="qwe" type="com.ccsens.mt.bean.vo.TableVo$SchedulePlan">
|
|
<id column="startDate" property="date" />
|
|
<collection property="schedulePlanDetailListMorning" ofType="com.ccsens.mt.bean.vo.TableVo$SchedulePlanDetail">
|
|
<id column="projectName" property="projectName" />
|
|
<result column="start_time" property="startTime" />
|
|
<result column="endTime" property="endTime" />
|
|
</collection>
|
|
<collection property="schedulePlanDetailListAfternoon" ofType="com.ccsens.mt.bean.vo.TableVo$SchedulePlanDetail">
|
|
<id column="projectNameP" property="projectName" />
|
|
<result column="start_timeP" property="startTime" />
|
|
<result column="endTimeP" property="endTime" />
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="selectByProjectId" resultMap="BaseResultMap" parameterType="java.util.Map">
|
|
select * from t_compete_project_config
|
|
where project_id = #{projectId}
|
|
and rec_status = 0
|
|
</select>
|
|
<select id="selectDetail" resultMap="qwe" parameterType="java.util.Map">
|
|
SELECT
|
|
FROM_UNIXTIME(start_time/1000,'%Y-%m-%d') as startDate,
|
|
if(a.aa = 1,p.`name`,null) as projectName,
|
|
if(a.aa = 0,p.`name`,null) as projectNamep,
|
|
if(a.aa = 1,c.start_time,null) as start_time,
|
|
if(a.aa = 0,c.start_time,null) as start_timeP,
|
|
if(a.aa = 1,c.end_time,null) as endTime,
|
|
if(a.aa = 0,c.end_time,null) as endTimeP
|
|
FROM
|
|
`t_compete_project_config` c
|
|
LEFT JOIN t_compete_project p on c.project_id = p.id
|
|
LEFT JOIN (
|
|
SELECT
|
|
id,
|
|
if(FROM_UNIXTIME(start_time/1000,'%H') < 12,1 ,0) as aa
|
|
FROM
|
|
t_compete_project_config b
|
|
where b.rec_status=0
|
|
)a on c.id = a.id
|
|
where c.project_id = p.id
|
|
and c.rec_status = 0
|
|
and p.rec_status = 0
|
|
ORDER BY c.start_time
|
|
</select>
|
|
<select id="selectStartTime" resultType="com.ccsens.mt.bean.po.CompeteProjectConfig" parameterType="java.util.Map">
|
|
SELECT
|
|
project_id
|
|
FROM t_compete_project_config
|
|
where project_id = #{projectId}
|
|
</select>
|
|
|
|
<select id="selectPeople" resultType="com.ccsens.mt.bean.vo.TableVo$CompeteJoin" parameterType="java.util.Map">
|
|
SELECT
|
|
tcpro.id as projectId,
|
|
tcpro.name as competeProject,
|
|
tcg.group_name as competeGroup,
|
|
tcc.`name` as joinTeam,
|
|
tcp.`name` as name,
|
|
tcp.gender as gender,
|
|
tcp.id_card as idCard,
|
|
tcpro.join_rule as joinRule,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_front_file = id ) as idCardPromiseFront,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_back_file = id ) as idCardPromiseBack,
|
|
(SELECT visit_location from t_common_file where tcp.id_photo_file = id ) as picture,
|
|
(SELECT visit_location from t_common_file where tcp.student_record_file = id ) as studentPromise,
|
|
(SELECT visit_location from t_common_file where tcp.health_record_file = id ) as bodyTest,
|
|
(SELECT visit_location from t_common_file where tcp.insurance_record_file = id ) as bodyProtect
|
|
from
|
|
t_compete_project tcpro LEFT JOIN t_compete_team tct on tcpro.id = tct.project_id
|
|
LEFT JOIN t_compete_team_member tctm on tct.id = tctm.compete_team_id
|
|
LEFT JOIN t_compete_player tcp on tcp.id = tctm.player_id
|
|
LEFT JOIN t_compete_company tcc on tcc.id = tcp.company_id
|
|
LEFT JOIN t_compete_group tcg on tcg.id = tcp.compete_group_id
|
|
WHERE
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<if test="projectId != null">
|
|
tcpro.id = #{projectId}
|
|
</if>
|
|
<if test="groupId != null">
|
|
and tcg.id = #{groupId}
|
|
</if>
|
|
<if test="companyId != null">
|
|
and tcc.id = #{companyId}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and tcp.name like concat('%',#{name, jdbcType=VARCHAR},'%')
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and tcp.id_card = #{idCard}
|
|
</if>
|
|
and tcpro.type=0
|
|
and tcpro.`level` =2
|
|
and tcpro.team=1
|
|
and tcpro.rec_status = 0
|
|
and tctm.rec_status = 0
|
|
and tcp.rec_status = 0
|
|
and tcc.rec_status = 0
|
|
and tcg.rec_status = 0
|
|
and tct.rec_status = 0
|
|
</trim>
|
|
UNION
|
|
SELECT
|
|
tcpro.id as projectId,
|
|
tcpro.name as competeProject,
|
|
tcg.group_name as competeGroup,
|
|
tcc.`name` as joinTeam,
|
|
tcp.`name` as name,
|
|
tcp.gender as gender,
|
|
tcp.id_card as idCard,
|
|
tcpro.join_rule as joinRule,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_front_file = id ) as idCardPromiseFront,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_back_file = id ) as idCardPromiseBack,
|
|
(SELECT visit_location from t_common_file where tcp.id_photo_file = id ) as picture,
|
|
(SELECT visit_location from t_common_file where tcp.student_record_file = id ) as studentPromise,
|
|
(SELECT visit_location from t_common_file where tcp.health_record_file = id ) as bodyTest,
|
|
(SELECT visit_location from t_common_file where tcp.insurance_record_file = id ) as bodyProtect
|
|
from
|
|
t_compete_project tcpro LEFT JOIN t_compete_project_player tcpp on tcpro.id = tcpp.project_id
|
|
LEFT JOIN t_compete_player tcp on tcpp.player_id = tcp.id
|
|
LEFT JOIN t_compete_group tcg on tcg.id = tcp.compete_group_id
|
|
LEFT JOIN t_compete_company tcc on tcc.id = tcp.company_id
|
|
where
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<if test="projectId != null">
|
|
tcpro.id = #{projectId}
|
|
</if>
|
|
<if test="groupId != null">
|
|
and tcg.id = #{groupId}
|
|
</if>
|
|
<if test="companyId != null">
|
|
and tcc.id = #{companyId}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and tcp.name like concat('%',#{name, jdbcType=VARCHAR},'%')
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and tcp.id_card = #{idCard}
|
|
</if>
|
|
and tcpro.type=0
|
|
and tcpro.`level` =2
|
|
and tcpro.team=0
|
|
and tcp.rec_status = 0
|
|
and tcc.rec_status = 0
|
|
and tcpp.rec_status = 0
|
|
and tcpro.rec_status = 0
|
|
</trim>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectSingle" resultType="com.ccsens.mt.bean.vo.TableVo$CompeteJoin" parameterType="java.util.Map">
|
|
SELECT
|
|
tcpro.id as projectId,
|
|
tcpro.name as competeProject,
|
|
tcg.group_name as competeGroup,
|
|
tcc.`name` as joinTeam,
|
|
tcp.`name` as name,
|
|
tcp.gender as gender,
|
|
tcp.id_card as idCard,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_front_file = id ) as idCardPromiseFront,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_back_file = id ) as idCardPromiseBack,
|
|
(SELECT visit_location from t_common_file where tcp.id_photo_file = id ) as picture,
|
|
(SELECT visit_location from t_common_file where tcp.student_record_file = id ) as studentPromise,
|
|
(SELECT visit_location from t_common_file where tcp.health_record_file = id ) as bodyTest,
|
|
(SELECT visit_location from t_common_file where tcp.insurance_record_file = id ) as bodyProtect
|
|
from
|
|
t_compete_project tcpro LEFT JOIN t_compete_project_player tcpp on tcpro.id = tcpp.project_id
|
|
LEFT JOIN t_compete_player tcp on tcpp.player_id = tcp.id
|
|
LEFT JOIN t_compete_group tcg on tcg.id = tcp.compete_group_id
|
|
LEFT JOIN t_compete_company tcc on tcc.id = tcp.company_id
|
|
where
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<if test="projectId != null">
|
|
tcpro.id = #{projectId}
|
|
</if>
|
|
<if test="groupId != null">
|
|
and tcg.id = #{groupId}
|
|
</if>
|
|
<if test="companyId != null">
|
|
and tcc.id = #{companyId}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and tcp.name like concat('%',#{name, jdbcType=VARCHAR},'%')
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and tcp.id_card = #{idCard}
|
|
</if>
|
|
and tcpro.type=0
|
|
and tcpro.`level` =2
|
|
and tcpro.team=0
|
|
and tcp.rec_status = 0
|
|
and tcc.rec_status = 0
|
|
and tcpp.rec_status = 0
|
|
and tcpro.rec_status = 0
|
|
</trim>
|
|
</select>
|
|
|
|
|
|
<select id="selectGroup" resultType="com.ccsens.mt.bean.vo.TableVo$CompeteJoin" parameterType="java.util.Map">
|
|
SELECT
|
|
tcpro.id as projectId,
|
|
tcpro.name as competeProject,
|
|
tcg.group_name as competeGroup,
|
|
tcc.`name` as joinTeam,
|
|
tcp.`name` as name,
|
|
tcp.gender as gender,
|
|
tcp.id_card as idCard,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_front_file = id ) as idCardPromiseFront,
|
|
(SELECT visit_location from t_common_file where tcp.id_card_back_file = id ) as idCardPromiseBack,
|
|
(SELECT visit_location from t_common_file where tcp.id_photo_file = id ) as picture,
|
|
(SELECT visit_location from t_common_file where tcp.student_record_file = id ) as studentPromise,
|
|
(SELECT visit_location from t_common_file where tcp.health_record_file = id ) as bodyTest,
|
|
(SELECT visit_location from t_common_file where tcp.insurance_record_file = id ) as bodyProtect
|
|
from
|
|
t_compete_project tcpro LEFT JOIN t_compete_team tct on tcpro.id = tct.project_id
|
|
LEFT JOIN t_compete_team_member tctm on tct.id = tctm.compete_team_id
|
|
LEFT JOIN t_compete_player tcp on tcp.id = tctm.player_id
|
|
LEFT JOIN t_compete_company tcc on tcc.id = tcp.company_id
|
|
LEFT JOIN t_compete_group tcg on tcg.id = tcp.compete_group_id
|
|
WHERE
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<if test="projectId != null">
|
|
tcpro.id = #{projectId}
|
|
</if>
|
|
<if test="groupId != null">
|
|
and tcg.id = #{groupId}
|
|
</if>
|
|
<if test="companyId != null">
|
|
and tcc.id = #{companyId}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and tcp.name like concat('%',#{name, jdbcType=VARCHAR},'%')
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and tcp.id_card = #{idCard}
|
|
</if>
|
|
and tcpro.type=0
|
|
and tcpro.`level` =2
|
|
and tcpro.team=1
|
|
and tcpro.rec_status = 0
|
|
and tctm.rec_status = 0
|
|
and tcp.rec_status = 0
|
|
and tcc.rec_status = 0
|
|
and tcg.rec_status = 0
|
|
and tct.rec_status = 0
|
|
</trim>
|
|
</select>
|
|
<select id="queryProjectConfig" resultType="com.ccsens.mt.bean.vo.TableVo$CompeteProjectConfig">
|
|
SELECT
|
|
p.id as projectId,
|
|
p.`name` as projectName,
|
|
if(p.team = 0,count(a.projectId),count(b.projectId)) as joinNum,
|
|
pc.project_duration as duration,
|
|
pc.site_num as siteNum,
|
|
pc.start_time as startTime,
|
|
pc.end_time as endTime
|
|
FROM
|
|
t_compete_project p
|
|
LEFT JOIN (SELECT * FROM t_compete_project_config WHERE rec_status = 0 or rec_status is null) pc on pc.project_id = p.id
|
|
LEFT JOIN
|
|
(
|
|
SELECT
|
|
pp.project_id as projectId
|
|
FROM
|
|
t_compete_project_player pp LEFT JOIN t_compete_player pl on pp.player_id = pl.id
|
|
LEFT JOIN t_compete_company c on pl.company_id = c.id
|
|
WHERE
|
|
pp.rec_status = 0
|
|
and pl .rec_status = 0
|
|
and c.rec_status = 0
|
|
)a on a.projectId = p.id
|
|
LEFT JOIN
|
|
(
|
|
SELECT
|
|
t.project_id as projectId
|
|
FROM
|
|
t_compete_team t LEFT JOIN t_compete_team_member m on t.id = m.compete_team_id
|
|
LEFT JOIN t_compete_player pl on m.player_id = pl.id
|
|
LEFT JOIN t_compete_company c on t.company_id = c.id
|
|
WHERE
|
|
t.rec_status = 0
|
|
and m .rec_status = 0
|
|
and pl .rec_status = 0
|
|
and c.rec_status = 0
|
|
GROUP BY t.id
|
|
)b on b.projectId = p.id
|
|
WHERE
|
|
p.type = #{type}
|
|
and p.`level` = 2
|
|
and p.certificate = 0
|
|
and p.rec_status = 0
|
|
GROUP BY p.id
|
|
ORDER BY pc.start_time
|
|
</select>
|
|
<select id="queryStartOrderByCompany" resultMap="startOrderByCompany">
|
|
SELECT
|
|
so.id as startOrderId,
|
|
so.compete_order as competeOrder,
|
|
so.site as site,
|
|
pc.video_start_time as startTime,
|
|
pc.video_end_time as endTime,
|
|
pc.video_restrict as videoRestrict,
|
|
pr.id as projectId,
|
|
pr.`name` as projectName,
|
|
pr.`team` as team,
|
|
if(pr.team = 0,a.plName,b.plName) as playerName,
|
|
if(pr.team = 0,a.groupName,b.groupName) as groupName,
|
|
if(pr.team = 0,a.videoUrl,b.videoUrl) as videoUrl,
|
|
if(pr.team = 0,a.ppId,b.teamId) as playerOrTeamId
|
|
from
|
|
t_compete_start_order so
|
|
LEFT JOIN t_compete_project pr on so.project_id = pr.id
|
|
LEFT JOIN t_compete_time ti on pr.type = ti.type
|
|
LEFT JOIN t_compete_project_config pc on pc.project_id = pr.id
|
|
LEFT JOIN
|
|
(
|
|
SELECT
|
|
pp.id as ppId,
|
|
pl.`name` as plName,
|
|
g.group_name as groupName,
|
|
v.video_url as videoUrl
|
|
FROM
|
|
t_compete_project_player pp LEFT JOIN t_compete_player pl on pp.player_id = pl.id
|
|
LEFT JOIN t_compete_group g on g.id = pl.compete_group_id
|
|
LEFT JOIN t_compete_video v on pp.id = v.player_id
|
|
WHERE
|
|
pl.company_id = #{companyId}
|
|
and pp.rec_status = 0
|
|
and pl.rec_status = 0
|
|
)a on a.ppId = so.player_id
|
|
LEFT JOIN
|
|
(
|
|
SELECT
|
|
t.id as teamId,
|
|
pl.`name` as plName,
|
|
g.group_name as groupName,
|
|
v.video_url as videoUrl
|
|
FROM
|
|
t_compete_team t LEFT JOIN t_compete_team_member m on t.id = m.compete_team_id
|
|
LEFT JOIN t_compete_player pl on m.player_id = pl.id
|
|
LEFT JOIN t_compete_group g on t.group_remark = g.group_remark and t.gender_group = g.sex
|
|
LEFT JOIN t_compete_video v on t.id = v.player_id
|
|
WHERE
|
|
t.company_id = #{companyId}
|
|
and t.rec_status = 0
|
|
and m.rec_status = 0
|
|
and pl.rec_status = 0
|
|
)b on b.teamId = so.player_id
|
|
WHERE
|
|
<if test="projectId != null">
|
|
pr.id = #{projectId}
|
|
and
|
|
</if>
|
|
ti.id = #{competeTimeId}
|
|
and(a.ppId is not null or b.teamId is not null)
|
|
and so.rec_status = 0
|
|
and pr.rec_status = 0
|
|
and pc.rec_status = 0
|
|
ORDER BY so.start_time
|
|
</select>
|
|
<select id="queryProjectByTaskDetailId" resultType="com.ccsens.mt.bean.vo.ProvinceCompeteVo$QueryProjectByTall">
|
|
SELECT
|
|
s.id as startOrderId,
|
|
p.id as projectId,
|
|
if(p.parent_id = 2001,0,1) as projectType
|
|
FROM
|
|
`t_compete_start_order` s LEFT JOIN t_compete_project p on s.project_id = p.id
|
|
LEFT JOIN tall.t_pro_task_detail d on d.parent_id = s.task_id
|
|
|
|
WHERE
|
|
d.id = #{taskDetailId}
|
|
and s.rec_status = 0
|
|
and p.rec_status = 0
|
|
LIMIT 1
|
|
</select>
|
|
|
|
|
|
</mapper>
|