Commit 5849a12a authored by Administrator's avatar Administrator

赛事助手后台赛事列表SQL改写2

parent 766fe9e8
...@@ -211,9 +211,11 @@ ...@@ -211,9 +211,11 @@
<select id="countCommitteeCmpt" resultType="long"> <select id="countCommitteeCmpt" resultType="long">
select count(1) select count(1)
from gk_cmpt a left join common.neucmpt b on a.cmpt_id=b.gtCmptId from gk_cmpt a
left join common.neucmpt b on a.cmpt_id=b.gtCmptId
left join common.neuuser nu on nu.neuUserId =b.committeeNeuUserId left join common.neuuser nu on nu.neuUserId =b.committeeNeuUserId
left join raceenroll.competition c on b.gcmptid=c.cmptid left join raceenroll.competition c on b.gcmptid=c.cmptid
LEFT JOIN geerunner.sys_admin sa ON sa.registerId =nu.gtUserId
where a.del_flag=0 where a.del_flag=0
<include refid="committee-cmpt-where-sql"/> <include refid="committee-cmpt-where-sql"/>
</select> </select>
...@@ -240,9 +242,10 @@ ...@@ -240,9 +242,10 @@
c.area as area, c.area as area,
c.location as location c.location as location
from gk_cmpt a from gk_cmpt a
left join common.neucmpt b on a.cmpt_id=b.gtCmptId left join common.neucmpt b on a.cmpt_id = b.gtCmptId
left join common.neuuser nu on nu.neuUserId =b.committeeNeuUserId left join common.neuuser nu on nu.neuUserId = b.committeeNeuUserId
left join raceenroll.competition c on b.gcmptid=c.cmptid left join raceenroll.competition c on b.gcmptid =c.cmptid
LEFT JOIN geerunner.sys_admin sa ON sa.registerId =nu.gtUserId
where a.del_flag=0 where a.del_flag=0
<include refid="committee-cmpt-where-sql"/> <include refid="committee-cmpt-where-sql"/>
order by c.startTime desc order by c.startTime desc
...@@ -259,7 +262,7 @@ ...@@ -259,7 +262,7 @@
and now() >= c.startTime and c.endTime >= now() and now() >= c.startTime and c.endTime >= now()
</if> </if>
<if test="param.userId > 0"> <if test="param.userId > 0">
and c.createUserId=#{param.userId} OR (nu.gUserId = #{param.userId} AND nu.gUserId != c.createUserId) and c.createUserId=#{param.userId} OR (nu.gUserId = #{param.userId} AND nu.gUserId != c.createUserId AND sa.org_id = (SELECT org_id FROM geerunner.sys_admin WHERE registerId=#{param.userId} ))
</if> </if>
<if test="param.userId lt 0"> <if test="param.userId lt 0">
AND c.createUserId NOT IN (SELECT user_id from gksite.gk_app_info WHERE user_id>0) AND c.createUserId NOT IN (SELECT user_id from gksite.gk_app_info WHERE user_id>0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment