587 lines
22 KiB
XML
587 lines
22 KiB
XML
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed Jul 11 17:43:20 CST 2018-->
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="Lesson">
|
|
|
|
<select id="UserOwnBooksByUid" parameterType="java.lang.Long" resultType="UserOwnBook">
|
|
|
|
SELECT distinct uid, lessonid, lessonname, courseType,
|
|
coursecode, orderid, packagePic , version,
|
|
versionNo, url, isrecommend
|
|
FROM V_UserOwnBook
|
|
WHERE uid = #{uid}
|
|
order by coursecode , orderid , courseType
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="RecommBooksByUid" parameterType="java.lang.Long" resultType="UserOwnBook">
|
|
|
|
SELECT uid, lessonid, lessonname, courseType,
|
|
coursecode, orderid, packagePic , version,
|
|
versionNo, url, isrecommend
|
|
FROM V_RecommBook
|
|
|
|
|
|
</select>
|
|
|
|
<select id="UserOwnMaterialsByUid" parameterType="java.lang.Long" resultType="UserOwnMaterial">
|
|
|
|
SELECT uid , materialId ,
|
|
title , teacherId , origiVoice , isNetMate , picture
|
|
FROM V_UserOwnMaterial
|
|
WHERE uid = #{uid} and isnetmate = 0
|
|
|
|
|
|
</select>
|
|
|
|
<select id="UserOwnMaterialsByTeacherId" parameterType="java.lang.Long" resultType="UserOwnMaterial">
|
|
|
|
SELECT uid , materialId ,
|
|
title , teacherId , origiVoice , isNetMate , picture
|
|
FROM V_TeacherOwnMaterial
|
|
WHERE uid = #{uid} and isnetmate = 0
|
|
|
|
|
|
</select>
|
|
|
|
<select id="UserOwnMaterialsByUidByNet" resultType="UserOwnMaterial">
|
|
|
|
SELECT uid , materialId , title ,
|
|
teacherId , origiVoice , isNetMate , picture
|
|
FROM V_TeacherOwnMaterial
|
|
where isnetmate = 1
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="simulatedExamByStudentId" parameterType="java.util.Map" resultType="Exam">
|
|
|
|
SELECT examId , examType , isRecommend , title , description , examPaperCount , examPapers , created , startTime , endTime ,isOral
|
|
FROM V_UserOwnExam
|
|
WHERE studentId=#{studentId} and isOral=#{isOral} and type =#{type}
|
|
AND examType = 'S' and startTime < now() and endTime > now()
|
|
order by examId desc
|
|
|
|
</select>
|
|
|
|
|
|
<select id="simulatedExamByNet" parameterType="java.lang.Integer" resultType="Exam">
|
|
|
|
SELECT examId , examType , isRecommend , title , description , examPaperCount , examPapers , created , startTime , endTime , isNetExam,isOral,teacherId
|
|
FROM Exam
|
|
WHERE isNetExam = 1 AND isOral=#{isOral} and type = 1 AND examType = 'S' and startTime < now() and endTime > now()
|
|
order by examId desc
|
|
|
|
</select>
|
|
|
|
<select id="officialExam" parameterType="java.util.Map" resultType="Exam">
|
|
|
|
SELECT examId , examType , isRecommend , title , description , examPaperCount , examPapers , created , startTime , endTime,isOral
|
|
FROM V_UserOwnExam
|
|
WHERE studentId=#{studentId} and isOral=#{isOral}
|
|
AND examType = 'O' and startTime < now() and endTime > now()
|
|
order by examId desc
|
|
|
|
</select>
|
|
|
|
<select id="recommendExamByNet" parameterType="java.lang.Integer" resultType="Exam">
|
|
|
|
SELECT examId , examType , isRecommend , title , description , examPaperCount , examPapers , created , startTime , endTime , isNetExam ,isOral,teacherId
|
|
FROM Exam
|
|
WHERE isNetExam = 1 and isOral=#{isOral} AND isRecommend = 1 and startTime < now() and endTime > now()
|
|
order by examId desc
|
|
|
|
</select>
|
|
|
|
<select id="recommendExamByStudentId" parameterType="java.util.Map" resultType="Exam">
|
|
|
|
SELECT examId , examType , isRecommend , title , description , examPaperCount , examPapers , created , startTime , endTime ,isOral
|
|
FROM V_UserOwnExam
|
|
WHERE studentId=#{studentId} and isOral=#{isOral}
|
|
AND isRecommend = 1 and startTime < now() and endTime > now()
|
|
order by examId desc
|
|
|
|
</select>
|
|
|
|
|
|
<select id="unFinishedRacesCount" resultType="Integer">
|
|
select count(*)
|
|
from Race
|
|
where status = 1
|
|
|
|
and current_timestamp < endTime
|
|
|
|
</select>
|
|
|
|
<select id="unFinishedRaces" parameterType="java.util.Map" resultType="RaceStatDto">
|
|
SELECT a.raceId , a.raceName , a.startTime , a.endTime ,
|
|
c.joinTotal , b.uid , b.score , d.truename
|
|
FROM
|
|
( select raceId , raceName , startTime , endTime
|
|
from Race
|
|
where status = 1
|
|
|
|
and current_timestamp < endTime
|
|
|
|
|
|
order by raceId desc
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
<if test="offset!=null">
|
|
offset #{offset}
|
|
</if>
|
|
) a
|
|
left join
|
|
(SELECT DISTINCT ON (raceId)
|
|
uid, raceId, score
|
|
FROM raceScore
|
|
ORDER BY raceId , score DESC ) b
|
|
on a.raceId = b.raceId
|
|
left join
|
|
( SELECT raceId , count(*) joinTotal
|
|
FROM raceScore
|
|
GROUP BY raceId ) c
|
|
ON a.raceId = c.raceId
|
|
LEFT JOIN v_baseuser d
|
|
on b.uid = d.studentId
|
|
</select>
|
|
|
|
<select id="finishedRacesCount" resultType="Integer">
|
|
select count(*)
|
|
from Race
|
|
where
|
|
<!-- endTime > '2015-06-30 23:59:59' and --> (status = 0
|
|
|
|
or current_timestamp > endTime )
|
|
and starttime > ( current_date + interval '-1 year')
|
|
|
|
</select>
|
|
|
|
|
|
<select id="finishedRaceIds" parameterType="java.util.Map" resultType="Integer">
|
|
select raceId
|
|
from Race
|
|
where <!-- endTime > '2015-06-30 23:59:59' and --> (status = 0 or current_timestamp > endTime)
|
|
and starttime > ( current_date + interval '-1 year')
|
|
order by endTime desc ,raceId desc
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
<if test="offset!=null">
|
|
offset #{offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="finishedRaces" parameterType="java.util.List" resultType="RaceStatDto">
|
|
|
|
WITH temp as ( select raceId , raceName , startTime , endTime,way,wayId
|
|
from Race
|
|
where raceId in
|
|
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
|
#{item}
|
|
</foreach> ) ,
|
|
temp2 as ( select n.raceid , n.uid , n.maxscore as score ,
|
|
rank() over (partition by n.raceId order by n.maxscore desc ,n.avgscore desc, n.created desc ) as mm
|
|
from RacemaxScore n inner join student as stu on stu.studentId = n.uid and stu.status =1
|
|
<!-- inner join (
|
|
select raceid,uid,avg(score) avgscore from racescore
|
|
where raceid in
|
|
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
|
#{item}
|
|
</foreach>
|
|
group by raceid,uid) as m
|
|
on m.raceid = n.raceid and n.uid=m.uid -->
|
|
where n.raceid in
|
|
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
|
#{item}
|
|
</foreach> ) ,
|
|
temp3 as ( SELECT q.raceId , count(q.racescoreId) joinTotal
|
|
FROM raceScore q
|
|
where q.raceId in
|
|
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
|
#{item}
|
|
</foreach>
|
|
GROUP BY q.raceId )
|
|
SELECT a.raceId , a.raceName , a.startTime , a.endTime ,
|
|
case when c.joinTotal is null then 0 else c.joinTotal end as joinTotal ,
|
|
case when b.uid is null then 0 else b.uid end as uid ,
|
|
case when b.score is null then 0 else b.score end as score ,
|
|
case when d.truename is null then '' else d.truename end as truename,
|
|
a.way,a.wayId
|
|
FROM temp as a
|
|
left join temp2 as b
|
|
on a.raceId = b.raceId and b.mm = 1
|
|
left join temp3 as c
|
|
ON a.raceId = c.raceId
|
|
left JOIN student d
|
|
on b.uid = d.studentId and d.status = 1
|
|
ORDER BY a.endTime desc , raceId desc
|
|
</select>
|
|
|
|
|
|
<!-- <select id="finishedRaces" parameterClass="java.util.Map" resultClass="RaceStatDto">
|
|
|
|
WITH temp as (
|
|
select raceId , raceName , startTime , endTime
|
|
from Race
|
|
where <![CDATA[
|
|
endTime > '2015-06-30 23:59:59'
|
|
and (status = 0 or current_timestamp > endTime )
|
|
]]>
|
|
order by endTime desc , raceId desc
|
|
<dynamic>
|
|
<isNotEmpty prepend=" LIMIT " property="pageSize">
|
|
#{pageSize}
|
|
</isNotEmpty>
|
|
<isNotEmpty prepend=" OFFSET " property="offset">
|
|
#{offset}
|
|
</isNotEmpty>
|
|
</dynamic> )
|
|
SELECT a.raceId , a.raceName , a.startTime , a.endTime ,
|
|
case when c.joinTotal is null then 0 else c.joinTotal end as joinTotal ,
|
|
case when b.uid is null then 0 else b.uid end as uid ,
|
|
case when b.score is null then 0 else b.score end as score ,
|
|
case when d.truename is null then '' else d.truename end as truename
|
|
FROM temp as a
|
|
left join
|
|
( select raceid , uid , maxscore as score ,
|
|
rank() over (partition by raceId order by maxscore desc , created desc ) as mm
|
|
from RacemaxScore
|
|
where raceId in ( select raceId from temp ) ) b
|
|
on a.raceId = b.raceId and b.mm = 1
|
|
left join
|
|
( SELECT raceId , count(*) joinTotal
|
|
FROM raceScore
|
|
WHERE raceId in ( select raceId from temp )
|
|
GROUP BY raceId ) c
|
|
ON a.raceId = c.raceId
|
|
left JOIN V_baseuser d
|
|
on b.uid = d.studentId and b.mm = 1
|
|
ORDER BY a.endTime desc , raceId desc
|
|
</select> -->
|
|
|
|
<select id="getRacesByRaceType" parameterType="java.lang.Integer" resultType="Race">
|
|
SELECT raceId , raceName , holder , raceType , '' as description ,
|
|
startTime , endTime , joinRace , credential , badge , '' as reward ,
|
|
timeLength , '' as content , status , created , raceAreaId , banner, title , groupLevel,way,wayId
|
|
FROM Race
|
|
WHERE status = 1 and raceType = #{raceType} and way != 3
|
|
|
|
and current_timestamp < endTime
|
|
|
|
ORDER BY endTime , raceId
|
|
-- order by created desc
|
|
</select>
|
|
|
|
<select id="getRacesByRaceTypeForStatusAndNet" parameterType="java.util.Map" resultType="Race">
|
|
SELECT raceId , raceName , holder , raceType , '' as description ,
|
|
startTime , endTime , joinRace , credential , badge , '' as reward ,
|
|
timeLength , '' as content , status , created , raceAreaId , banner, title , groupLevel,way,wayId
|
|
FROM Race
|
|
WHERE status = 1 and raceType in (#{netRaceType},#{statusRaceType}) and way != 3
|
|
|
|
and current_timestamp < endTime
|
|
|
|
ORDER BY endTime , raceId
|
|
-- order by created desc
|
|
</select>
|
|
|
|
|
|
|
|
<select id="simulatedHearExamByStudentId" parameterType="java.lang.Long" resultType="HearExam">
|
|
|
|
select * from(
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h inner join classownhear c on c.examid = h.examid
|
|
inner join studentownclass s on s.classesid = c.classesid and s.status = 1
|
|
WHERE s.studentId=#{studentId} and c.objectType = 1
|
|
AND h.examType = 'S' and h.startTime < now() and h.endTime > now()
|
|
|
|
union
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h inner join classownhear c on c.examid = h.examid
|
|
inner join classes co on c.classesid = co.classesid
|
|
WHERE co.teacherId=#{studentId}
|
|
AND h.examType = 'S' and h.startTime < now() and h.endTime > now())
|
|
as a order by examid desc
|
|
|
|
</select>
|
|
|
|
|
|
<select id="simulatedHearExamByNet" resultType="HearExam">
|
|
|
|
SELECT examid, examtype, isrecommend, title, description, hearpaperid,
|
|
created, starttime, endtime, isnetexam
|
|
FROM hearexam h
|
|
|
|
WHERE isNetExam = 1 AND examType = 'S' and startTime < now() and endTime > now()
|
|
order by examId desc
|
|
|
|
|
|
</select>
|
|
|
|
<select id="officialHearExam" parameterType="java.lang.Long" resultType="HearExam">
|
|
|
|
Select * from(
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h inner join classownhear c on c.examid = h.examid
|
|
inner join studentownclass s on s.classesid = c.classesid and s.status = 1
|
|
WHERE s.studentId=#{studentId} and c.objectType = 1
|
|
AND h.examType = 'O' and h.startTime < now() and h.endTime > now()
|
|
union
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h inner join classownhear c on c.examid = h.examid
|
|
inner join classes co on c.classesid = co.classesid
|
|
WHERE co.teacherId=#{studentId}
|
|
AND h.examType = 'O' and h.startTime < now() and h.endTime > now()
|
|
) as a order by examId desc
|
|
|
|
</select>
|
|
|
|
<select id="recommendHearExamByNet" resultType="HearExam">
|
|
|
|
SELECT examid, examtype, isrecommend, title, description, hearpaperid,
|
|
created, starttime, endtime, isnetexam
|
|
FROM hearexam h
|
|
|
|
WHERE isNetExam = 1 AND isRecommend = 1 and startTime < now() and endTime > now()
|
|
order by examid desc
|
|
|
|
</select>
|
|
|
|
<select id="recommendHearExamByStudentId" parameterType="java.lang.Long" resultType="HearExam">
|
|
|
|
Select * from(
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h inner join classownhear c on c.examid = h.examid
|
|
inner join studentownclass s on s.classesid = c.classesid and s.status = 1
|
|
WHERE s.studentId=#{studentId}
|
|
AND h.isRecommend = 1 and h.startTime < now() and h.endTime > now()
|
|
union
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h inner join classownhear c on c.examid = h.examid
|
|
inner join classes co on c.classesid = co.classesid
|
|
WHERE co.teacherId=#{studentId}
|
|
AND h.isRecommend = 1 and h.startTime < now() and h.endTime > now()
|
|
)as a order by examid desc
|
|
|
|
</select>
|
|
|
|
<select id="getExamsByClassesIdByType" parameterType="java.util.Map" resultType="Exam">
|
|
SELECT b.examId , b.examType , b.isRecommend , b.title , b.description ,
|
|
b.examPaperCount , b.examPapers , b.created , b.startTime , b.endTime ,
|
|
b.isNetExam,b.isOral
|
|
FROM ClassOwnExam a
|
|
INNER join Exam b
|
|
ON a.classesId = #{classesId} and a.examId = b.examId
|
|
AND a.objectType = #{objectType} and b.isOral=#{isOral}
|
|
WHERE
|
|
b.startTime <= current_timestamp and b.endTime >= current_timestamp and b.type = 1
|
|
|
|
ORDER BY b.examId DESC
|
|
|
|
</select>
|
|
|
|
<select id="getHearsByClassesIdByType" parameterType="java.util.Map" resultType="HearExam">
|
|
SELECT h.examid, h.examtype, h.isrecommend, h.title, h.description, h.hearpaperid,
|
|
h.created, h.starttime, h.endtime, h.isnetexam
|
|
FROM hearexam h
|
|
INNER JOIN classownhear c
|
|
ON c.classesId = #{classesId} AND c.examid = h.examid
|
|
AND c.objectType = #{objectType}
|
|
WHERE
|
|
h.startTime <= current_timestamp and h.endTime >= current_timestamp
|
|
|
|
ORDER BY h.created DESC
|
|
|
|
</select>
|
|
|
|
<select id="getNewHearsByClassesIdByType" parameterType="java.util.Map" resultType="Exam">
|
|
SELECT h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_hearexam h
|
|
INNER JOIN classownhear c
|
|
ON c.classesId = #{classesId} AND c.examid = h.examid
|
|
AND c.objectType = #{objectType} and h.isOral=-1
|
|
and h.startTime <= current_timestamp and h.endTime >= current_timestamp
|
|
union
|
|
|
|
SELECT h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_hearexam h
|
|
INNER JOIN classownexam c
|
|
ON c.classesId = #{classesId} AND c.examid = h.examid
|
|
AND c.objectType = #{objectType} and h.isOral=2
|
|
and h.startTime <= current_timestamp and h.endTime >= current_timestamp
|
|
ORDER BY created DESC
|
|
|
|
</select>
|
|
|
|
|
|
<select id="newHearExam" parameterType="java.util.Map" resultType="Exam">
|
|
select
|
|
h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_hearexam h inner join classownhear c on c.examid = h.examid and h.isOral=-1
|
|
inner join studentownclass s on s.classesid = c.classesid and s.status = 1
|
|
WHERE s.studentId=#{uid} and c.objectType = 1 and h.type= #{type}
|
|
AND h.examType = #{examType} and h.startTime < now() and h.endTime > now()
|
|
union
|
|
SELECT h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_hearexam h
|
|
WHERE h.teacherId=#{uid} and h.examType = #{examType} and
|
|
h.startTime < now() and h.endTime > now() and h.type= #{type}
|
|
union
|
|
select
|
|
h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_hearexam h inner join classownexam c on c.examid = h.examid and isOral=2
|
|
inner join studentownclass s on s.classesid = c.classesid and s.status = 1
|
|
WHERE s.studentId=#{uid} and c.objectType = 1 and h.type= #{type}
|
|
and h.examType = #{examType} and h.startTime < now() and h.endTime > now()
|
|
order by created desc ,title desc,isOral
|
|
</select>
|
|
|
|
<select id="simulatedNewHearExamByNet" resultType="Exam">
|
|
|
|
SELECT h.examId , h.examType , h.isRecommend , h.title , h.description ,
|
|
h.examPaperCount , h.examPapers , h.created , h.startTime , h.endTime ,
|
|
h.isNetExam , h.isOral
|
|
FROM v_hearexam h
|
|
|
|
WHERE isNetExam = 1 AND examType = 'S' and startTime < now() and endTime > now()
|
|
order by h.created desc
|
|
|
|
|
|
</select>
|
|
|
|
<select id="userOwnBooksByUidOrderByUse" parameterType="java.util.Map" resultType="UserOwnBook">
|
|
|
|
with temp as (
|
|
select count(a.objectid) howmuch,l1.parentid lessonid,achiveType from achivement a
|
|
inner join lesson l on a.objectid=l.lessonid and a.areaId=#{areaId} and a.pointcaseType !=2 and
|
|
a.uid=#{uid} and a.created>#{startTime} and achivetype='L'
|
|
inner join lesson l1 on l.parentid=l1.lessonid
|
|
group by l1.parentid,achiveType
|
|
union all
|
|
select count(a.objectid) howmuch,l.parentid lessonid,achiveType from achivement a
|
|
inner join lesson l on a.objectid=l.lessonid
|
|
and a.uid=#{uid} and a.areaId=#{areaId} and a.created>#{startTime} and achivetype='W'
|
|
group by l.parentid,achiveType )
|
|
SELECT distinct ${uid} as uid, v.lessonid, lessonname, courseType,
|
|
coursecode, orderid, packagePic , version,
|
|
versionNo, url, isrecommend,isOut,howmuch
|
|
FROM v_userownBook2 v
|
|
<if test="isAll==null">
|
|
inner join
|
|
</if>
|
|
<if test="isAll!=null">
|
|
left join
|
|
</if>
|
|
|
|
temp t on v.lessonid=t.lessonid and v.courseType=t.achiveType
|
|
|
|
WHERE
|
|
<if test="schoolUserId==null">
|
|
uid = #{uid}
|
|
</if>
|
|
<if test="schoolUserId!=null">
|
|
uid = #{schoolUserId}
|
|
</if>
|
|
order by howmuch desc nulls last,coursecode , orderid , courseType
|
|
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
<if test="offset!=null">
|
|
offset #{offset}
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
<select id="userOwnBooksByUidOrderByUseCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
|
|
with temp as (
|
|
select count(a.objectid) howmuch,l1.parentid lessonid,achiveType from achivement a
|
|
inner join lesson l on a.objectid=l.lessonid and
|
|
a.uid=#{uid} and a.areaId=#{areaId} and a.created>#{startTime} and achivetype='L'
|
|
inner join lesson l1 on l.parentid=l1.lessonid
|
|
group by l1.parentid,achiveType
|
|
union all
|
|
select count(a.objectid) howmuch,l.parentid lessonid,achiveType from achivement a
|
|
inner join lesson l on a.objectid=l.lessonid
|
|
and a.uid=#{uid} and a.areaId=#{areaId} and a.created>#{startTime} and achivetype='W'
|
|
group by l.parentid,achiveType )
|
|
select count(*) from (SELECT distinct v.lessonid, courseType
|
|
FROM v_userownBook2 v
|
|
<if test="isAll==null">
|
|
inner join
|
|
</if>
|
|
<if test="isAll!=null">
|
|
left join
|
|
</if>
|
|
temp t on v.lessonid=t.lessonid and v.courseType=t.achiveType
|
|
WHERE
|
|
<if test="schoolUserId==null">
|
|
uid = #{uid}
|
|
</if>
|
|
<if test="schoolUserId!=null">
|
|
uid = #{schoolUserId}
|
|
</if>
|
|
|
|
) as a
|
|
|
|
</select>
|
|
|
|
<select id="outsideBooks" parameterType="java.lang.Long" resultType="UserOwnBook">
|
|
SELECT distinct uid, v.lessonid, lessonname, courseType,
|
|
coursecode, orderid, packagePic , version,
|
|
versionNo, url, isrecommend,isOut
|
|
FROM v_userownBook2 v
|
|
where isOut=1 and uid=#{uid}
|
|
order by coursecode , orderid , courseType
|
|
</select>
|
|
|
|
|
|
|
|
<select id="userOwnBooksByUidNew" parameterType="java.lang.Long" resultType="UserOwnBook">
|
|
|
|
SELECT distinct uid, v.lessonid, lessonname, courseType,
|
|
coursecode, orderid, packagePic , version,
|
|
versionNo, url, isrecommend,isOut
|
|
FROM v_userownBook2 v
|
|
WHERE uid = #{uid}
|
|
order by coursecode , orderid , courseType
|
|
|
|
</select>
|
|
|
|
|
|
<select id="userOwnBooksByUidForWordClassRoom" parameterType="java.util.Map" resultType="UserOwnBook">
|
|
|
|
SELECT distinct uid, v.lessonid, lessonname, courseType,
|
|
coursecode, orderid, packagePic , version,
|
|
versionNo, url, isrecommend,isOut
|
|
FROM v_userownBook2 v
|
|
WHERE uid = #{uid} and coursetype = #{courseType}
|
|
order by coursecode , orderid , courseType
|
|
|
|
</select>
|
|
</mapper> |