570 lines
18 KiB
XML
570 lines
18 KiB
XML
<?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._3e.dubdao.DubUserVoiceDao">
|
||
<select id="getDubVoiceCount" parameterType="long" resultType="int">
|
||
SELECT COUNT(voiceid)
|
||
FROM dubuservoice
|
||
WHERE uid = #{uid} AND isdelete = 0
|
||
<if test="otherOrMe == 'OTHER'.toString()">
|
||
<if test="type == 'A'.toString()">
|
||
AND isshare = 1 AND draft = 'OK'
|
||
</if>
|
||
<if test="type != 'A'.toString()">
|
||
AND 1 = -1
|
||
</if>
|
||
</if>
|
||
<if test="otherOrMe != 'OTHER'.toString()">
|
||
<choose>
|
||
<when test="type == 'A'.toString()">
|
||
AND isshare = 1 AND draft = 'OK'
|
||
</when>
|
||
<when test="type == 'B'.toString()">
|
||
AND isshare = 0 AND draft = 'OK'
|
||
</when>
|
||
<when test="type == 'C'.toString()">
|
||
AND isshare = 0 draft != 'OK'
|
||
</when>
|
||
<otherwise>
|
||
AND 1 = -1
|
||
</otherwise>
|
||
</choose>
|
||
</if>
|
||
ORDER BY created DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="findDubsByUser" parameterType="map" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT voiceid, videoid, voicename, created, production, award,playcount,likecount,score
|
||
FROM dubuservoice
|
||
WHERE uid = #{uid} AND isdelete = 0
|
||
<if test="otherOrMe == 'OTHER'.toString()">
|
||
<if test="type == 'A'.toString()">
|
||
AND isshare = 1 AND draft = 'OK'
|
||
</if>
|
||
<if test="type != 'A'.toString()">
|
||
AND 1 = -1
|
||
</if>
|
||
</if>
|
||
<if test="otherOrMe != 'OTHER'.toString()">
|
||
<choose>
|
||
<when test="type == 'A'.toString()">
|
||
AND isshare = 1 AND draft = 'OK'
|
||
</when>
|
||
<when test="type == 'B'.toString()">
|
||
AND isshare = 0 AND draft = 'OK'
|
||
</when>
|
||
<when test="type == 'C'.toString()">
|
||
AND isshare = 0 draft != 'OK'
|
||
</when>
|
||
<otherwise>
|
||
AND 1 = -1
|
||
</otherwise>
|
||
</choose>
|
||
</if>
|
||
ORDER BY created DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="searchDubsByUser" parameterType="map" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT voiceid, videoid, voicename, created, production, award,playcount,likecount,score
|
||
FROM dubuservoice
|
||
WHERE uid = #{uid} AND isdelete = 0
|
||
<if test="voicename != null">
|
||
AND voicename like '%'||#{voicename}||'%'
|
||
</if>
|
||
AND isshare = 1 AND draft = 'OK'
|
||
ORDER BY created DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="getDubsCount" parameterType="map" resultType="int">
|
||
SELECT count(voiceid)
|
||
FROM dubuservoice
|
||
WHERE uid = #{uid} AND isdelete = 0
|
||
<choose>
|
||
<when test="type == 'A'.toString()">
|
||
AND isshare = 1 AND draft = 'OK'
|
||
</when>
|
||
<when test="type == 'B'.toString()">
|
||
AND isshare = 0 AND draft = 'OK'
|
||
</when>
|
||
<when test="type == 'C'.toString()">
|
||
AND isshare = 0 draft != 'OK'
|
||
</when>
|
||
<otherwise>
|
||
AND 1 = -1
|
||
</otherwise>
|
||
</choose>
|
||
</select>
|
||
<!--素材-->
|
||
<select id="findHotProduction_1" parameterType="map" resultType="com.dub.dto.DubVideo">
|
||
SELECT b.videoid, videoname, video, sound, soundeffect, subtitle, description,timeLength,sentCount,
|
||
uploader, created, interpreter, reviser, difficulty, source,
|
||
copyrighter, crowd, type, label, videopic, keyword, status, playcount, dubcount, priority,
|
||
a.starttime, a.summary
|
||
FROM dubvideostatic a
|
||
LEFT JOIN dubvideodynamic b ON a.videoid = b.videoid
|
||
<!--<where>-->
|
||
<!--<choose>-->
|
||
<!--<when test="type == 'TEST'">-->
|
||
<!--status <![CDATA[<>]]> 1-->
|
||
<!--</when>-->
|
||
<!--<when test="type == 'UNSTART'">-->
|
||
<!--a.starttime > current_timestamp-->
|
||
<!--AND status = 1-->
|
||
<!--</when>-->
|
||
<!--<otherwise>-->
|
||
<!--a.starttime < current_timestamp-->
|
||
<!--AND type = #{type} AND status = 1-->
|
||
<!--</otherwise>-->
|
||
<!--</choose>-->
|
||
<!--</where>-->
|
||
where a.starttime < current_timestamp
|
||
AND status = 1
|
||
ORDER BY playcount DESC, date_trunc('day',a.starttime) DESC, priority DESC, dubcount DESC, difficulty DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
|
||
<select id="getMaxPlayCountAndNewVoice" parameterType="map" resultType="com.dub.dto.DubVideo">
|
||
(SELECT b.videoid, videoname, video, sound, soundeffect, subtitle, description,
|
||
uploader, created, interpreter, reviser, difficulty, source,
|
||
copyrighter, crowd, type, label, videopic, keyword, status, playcount, dubcount, priority,
|
||
a.starttime, a.summary
|
||
FROM dubvideostatic a
|
||
inner JOIN dubvideodynamic b ON a.videoid = b.videoid
|
||
where a.starttime < current_timestamp
|
||
AND status = 1
|
||
ORDER BY playcount DESC, date_trunc('day',a.starttime) DESC, priority DESC, dubcount DESC, difficulty DESC limit 1)
|
||
union all
|
||
(SELECT b.videoid, videoname, video, sound, soundeffect, subtitle, description,
|
||
uploader, created, interpreter, reviser, difficulty, source,
|
||
copyrighter, crowd, type, label, videopic, keyword, status, playcount, dubcount, priority,
|
||
a.starttime, a.summary
|
||
FROM dubvideostatic a
|
||
inner JOIN dubvideodynamic b ON a.videoid = b.videoid
|
||
where a.starttime < current_timestamp
|
||
AND status = 1
|
||
ORDER BY date_trunc('day',a.starttime) DESC, priority DESC, dubcount DESC, difficulty DESC limit 1)
|
||
</select>
|
||
<!--学生配音-->
|
||
<select id="findHotProduction" parameterType="map" resultType="com.dub.dto.ResDubInfo">
|
||
WITH temp AS (
|
||
SELECT videoid, voiceid ,uid, voicename, likecount as likeCount, production, created, playcount,
|
||
row_number() OVER(PARTITION BY videoid ORDER BY likecount DESC ) AS rn
|
||
FROM dubuservoice
|
||
WHERE created > (current_timestamp + interval'-1 month')
|
||
AND created < current_timestamp
|
||
AND isdelete = 0
|
||
AND isshare = 1
|
||
GROUP BY videoid, voiceid
|
||
)
|
||
|
||
SELECT a.videopic, t.voicename AS videoName, t.uid AS copyrighter, a.source, t.videoid, t.voiceid, t.playcount, t.likeCount,
|
||
t.production AS soundURL
|
||
FROM temp t
|
||
INNER JOIN dubvideostatic a
|
||
ON t.videoid = a.videoid
|
||
WHERE t.rn <= 3
|
||
<if test="voicename != null">
|
||
AND t.voicename like '%'||#{voicename}||'%'
|
||
</if>
|
||
ORDER BY t.playcount DESC ,t.created DESC , t.likeCount DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="findNewProduction" parameterType="map" resultType="com.dub.dto.ResDubInfo">
|
||
SELECT a.videopic, t.voicename AS videoName, t.uid AS copyrighter, a.source, t.videoid, t.voiceid, t.playcount, t.likeCount,a.timeLength,a.sentCount,
|
||
t.production AS soundURL, t.created
|
||
FROM dubuservoice t
|
||
INNER JOIN dubvideostatic a
|
||
ON t.videoid = a.videoid
|
||
|
||
WHERE t.isdelete = 0
|
||
AND t.isshare = 1
|
||
AND t.draft = 'OK'
|
||
<if test="voicename != null">
|
||
AND t.voicename like '%'||#{voicename}||'%'
|
||
</if>
|
||
ORDER BY t.created DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="findVoiceByID" parameterType="long" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT voiceid,uid,videoid,voicename,isshare,
|
||
playcount,isdelete,thirdpartylink,production,
|
||
isrecommend,recommendtime,award,created,
|
||
areaid,draft,likecount
|
||
FROM DubUserVoice
|
||
WHERE voiceid = #{voiceid}
|
||
</select>
|
||
|
||
<select id="findDubByID" parameterType="long" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT voiceid,uid,videoid,voicename,isshare,
|
||
playcount,isdelete,thirdpartylink,production,
|
||
isrecommend,recommendtime,award,created,
|
||
areaid,draft,likecount
|
||
FROM DubUserVoice
|
||
WHERE voiceid = #{voiceid} AND isdelete = 0
|
||
</select>
|
||
|
||
<select id="findShareDubByID" parameterType="long" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT voiceid,uid,videoid,voicename,isshare,
|
||
playcount,isdelete,thirdpartylink,production,
|
||
isrecommend,recommendtime,award,created,
|
||
areaid,draft,likecount
|
||
FROM DubUserVoice
|
||
WHERE voiceid = #{voiceid} AND isshare = 1 AND isdelete = 0
|
||
</select>
|
||
|
||
<select id="findVoiceRankListByVideo" parameterType="map" resultType="com.dub.dto.DubRankDto">
|
||
SELECT voiceid, likeCount, uid, voicename, production ,created
|
||
FROM dubuservoice
|
||
WHERE videoid = #{videoid} AND isdelete = 0
|
||
AND isshare = 1 AND likecount > 0
|
||
ORDER BY likecount DESC, created ASC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 排行榜查询说明:
|
||
除全网外 schoolType 不为null
|
||
1、同班级:objType == 1
|
||
2、同年级:objType == 2
|
||
1、同校级:objType == 3
|
||
4、全网:objType 不传-->
|
||
<select id="findVoiceRankList" parameterType="map" resultType="com.dub.dto.DubRankDto">
|
||
WITH temp1 AS (
|
||
SELECT a.videoid, a.uid, a.voiceid , a.likecount,a.rank2, a.production,a.voicename,a.created,
|
||
row_number() OVER(PARTITION BY a.videoid ORDER BY a.likecount DESC) AS rank1
|
||
FROM(
|
||
SELECT u.videoid, u.uid, u.voiceid , u.likecount, u.production,u.voicename,u.created,
|
||
row_number() OVER(PARTITION BY u.uid ORDER BY u.likecount DESC) AS rank2
|
||
FROM DubUserVoice u
|
||
<if test="schoolType != null">
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univstudentownclass s
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
studentownclass s
|
||
</if>
|
||
ON s.studentid = u.uid and s.status=1
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univclasses c
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
classes c
|
||
</if>
|
||
ON c.classesid = s.classesid and c.status=1 and c.classtype = 1
|
||
</if>
|
||
<choose>
|
||
<when test="reqFiltrate.day == 1">
|
||
WHERE u.created > (current_timestamp + interval'-1 day')
|
||
</when>
|
||
<when test="reqFiltrate.week == 1">
|
||
WHERE u.created > (current_date + interval'-1 week')
|
||
AND u.created < current_date
|
||
</when>
|
||
<otherwise>
|
||
WHERE u.created > (current_date + interval'-1 month')
|
||
AND u.created < current_date
|
||
</otherwise>
|
||
</choose>
|
||
AND u.isdelete = 0 AND isshare = 1
|
||
AND u.likecount > 0
|
||
<if test="objType == 1">
|
||
AND s.classesid = #{classesId} AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 2">
|
||
AND c.classlevel = #{classlevel}
|
||
AND c.schoolyear = #{schoolyear}
|
||
AND c.schoolid = #{schoolid}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 3">
|
||
AND c.schoolid = #{schoolid}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 4">
|
||
and (CAST(SUBSTRING(CAST(u.areaId AS TEXT) FROM 1 FOR 4) || REPEAT('0', 2) AS INT)) = #{areaId}
|
||
</if>
|
||
<if test="objType == 5">
|
||
and (CAST(SUBSTRING(CAST(u.areaId AS TEXT) FROM 1 FOR 2) || REPEAT('0', 4) AS INT)) = #{areaId}
|
||
</if>
|
||
) a
|
||
WHERE a.rank2 <=3
|
||
)
|
||
SELECT uid , voiceid , likecount, production, voicename
|
||
FROM temp1
|
||
WHERE rank1 <=3
|
||
ORDER BY likecount DESC, created ASC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="getUserCount" parameterType="long" resultType="int">
|
||
SELECT COUNT(DISTINCT(uid))
|
||
FROM dubuservoice
|
||
WHERE videoid = #{videoid} AND isdelete = 0 AND isshare = 1
|
||
</select>
|
||
|
||
<select id="findUserIdByVideoId_1" parameterType="long" resultType="com.dub.entity.DubUserVoice">
|
||
with temp0 as ( select d.voiceid,d.uid,d.production,d.voicename,d.created
|
||
from dubuservoice
|
||
WHERE d.videoid = #{videoid} AND isdelete = 0 AND isshare = 1
|
||
ORDER BY d.created DESC LIMIT 20 )
|
||
SELECT d.voiceid,d.uid,d.production,d.voicename,d.created,b.truename as truename
|
||
FROM temp0 d
|
||
inner join v_baseuser b
|
||
on d.uid = b.uid
|
||
ORDER BY d.created DESC
|
||
|
||
</select>
|
||
<select id="findUserIdByVideoId" parameterType="long" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT voiceid,uid,production,voicename
|
||
FROM dubuservoice
|
||
WHERE videoid = #{videoid} AND isdelete = 0 AND isshare = 1
|
||
ORDER BY created DESC LIMIT 20
|
||
</select>
|
||
<insert id="doSaveUserVoice" parameterType="com.dub.entity.DubUserVoice">
|
||
INSERT INTO dubuservoice(voiceid,uid,videoid,voicename,isshare,playcount,isdelete,thirdpartylink,production,isrecommend,recommendtime,award,created,areaid,draft,likecount,score,accuracy,fluent,integrity)
|
||
VALUES (
|
||
<if test="voiceid == 0">
|
||
(SELECT NEXTVAL('seq_dubuservoice')),
|
||
</if>
|
||
<if test="voiceid != 0">
|
||
#{voiceid},
|
||
</if>
|
||
#{uid},#{videoid},#{voicename},#{isshare},#{playcount},#{isdelete},#{thirdpartylink},#{production},#{isrecommend},#{recommendtime},#{award},#{created},#{areaid},#{draft},#{likecount},#{score},#{accuracy},#{fluent},#{integrity})
|
||
</insert>
|
||
|
||
<update id="doUpdateUserVoicById" parameterType="map">
|
||
Update dubuservoice
|
||
<set>
|
||
<if test="uid != null">uid = #{uid},</if>
|
||
<if test="videoid != null">videoid = #{videoid},</if>
|
||
<if test="voicename != null">voicename = #{voicename},</if>
|
||
<if test="isshare != null">isshare = #{isshare},</if>
|
||
<if test="playcount != null">playcount = ${playcount},</if>
|
||
<if test="isdelete != null">isdelete = #{isdelete},</if>
|
||
<if test="thirdpartylink != null">thirdpartylink = #{thirdpartylink},</if>
|
||
<if test="production != null">production = #{production},</if>
|
||
<if test="isrecommend != null">isrecommend = #{isrecommend},</if>
|
||
<if test="recommendtime != null">recommendtime = #{recommendtime},</if>
|
||
<if test="award != null">award = #{award},</if>
|
||
<if test="created != null">created = #{created},</if>
|
||
<if test="areaid != null">areaid = #{areaid},</if>
|
||
<if test="draft != null">draft = #{draft},</if>
|
||
<if test="likecount != null">likecount = ${likecount}</if>
|
||
</set>
|
||
WHERE voiceid = #{voiceid}
|
||
</update>
|
||
|
||
<!-- 推荐查询说明:
|
||
除全网外 schoolType 不为null
|
||
1、同班级:objType == 1
|
||
2、同年级:objType == 2
|
||
3、同校级:objType == 3
|
||
4、同城级:objType == 4
|
||
5、同地区:objType == 5 注意这里的areaid 要除100后传入
|
||
6、全网:objType 不传或=0-->
|
||
<select id="findAllNetRecommend" parameterType="map" resultType="com.dub.entity.DubUserVoice">
|
||
SELECT u.voiceid, u.uid, u.videoid, u.voicename, u.playcount, u.production,
|
||
u.award, u.areaid, u.recommendtime
|
||
FROM dubuservoice u
|
||
<if test="schoolType != null and objType < 4">
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univstudentownclass s
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
studentownclass s
|
||
</if>
|
||
ON s.studentid = u.uid
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univclasses c
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
classes c
|
||
</if>
|
||
ON c.classesid = s.classesid
|
||
</if>
|
||
<if test="schoolType != null and objType >= 4">
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univstudent s
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
student s
|
||
</if>
|
||
ON s.studentid = u.uid
|
||
</if>
|
||
<where>
|
||
isrecommend = 1 AND isdelete = 0 AND isshare = 1
|
||
AND recommendtime > (current_date + interval'-3 month')
|
||
AND recommendtime < current_date
|
||
<if test="objType == 1">
|
||
AND s.classesid = #{classesId}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 2">
|
||
AND c.classlevel = #{classlevel}
|
||
AND c.schoolyear = #{schoolyear}
|
||
AND c.schoolid = #{schoolid}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 3">
|
||
AND c.schoolid = #{schoolid}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 4">
|
||
AND s.areaid/100 = #{areaid}/100
|
||
</if>
|
||
<if test="objType == 5">
|
||
AND s.areaid = #{areaid}
|
||
</if>
|
||
</where>
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 推荐数量查询说明:
|
||
除全网外 schoolType 不为null
|
||
1、同班级:objType == 1
|
||
2、同年级:objType == 2
|
||
3、同校级:objType == 3
|
||
4、同城级:objType == 4
|
||
5、同地区:objType == 5 注意这里的areaid 要除100后传入
|
||
6、全网:objType 不传或=0-->
|
||
<select id="getRecommendCount" parameterType="map" resultType="int">
|
||
SELECT COUNT(u.voiceid)
|
||
FROM dubuservoice u
|
||
<if test="schoolType != null and objType < 4">
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univstudentownclass s
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
studentownclass s
|
||
</if>
|
||
ON s.studentid = u.uid
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univclasses c
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
classes c
|
||
</if>
|
||
ON c.classesid = s.classesid
|
||
</if>
|
||
<if test="schoolType != null and objType >= 4">
|
||
RIGHT JOIN
|
||
<if test="schoolType == 'UNIV'.toString()">
|
||
univstudent s
|
||
</if>
|
||
<if test="schoolType != 'UNIV'.toString()">
|
||
student s
|
||
</if>
|
||
ON s.studentid = u.uid
|
||
</if>
|
||
<where>
|
||
isrecommend = 1 AND isdelete = 0 AND isshare = 1
|
||
AND recommendtime > (current_date + interval'-3 month')
|
||
AND recommendtime < current_date
|
||
<if test="objType == 1">
|
||
AND s.classesid = #{classesId}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 2">
|
||
AND c.classlevel = #{classlevel}
|
||
AND c.schoolyear = #{schoolyear}
|
||
AND c.schoolid = #{schoolid}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 3">
|
||
AND c.schoolid = #{schoolid}
|
||
AND c.classtype = 1
|
||
</if>
|
||
<if test="objType == 4">
|
||
AND s.areaid/100 = #{areaid}/100
|
||
</if>
|
||
<if test="objType == 5">
|
||
AND s.areaid = #{areaid}
|
||
</if>
|
||
</where>
|
||
</select>
|
||
<select id="findDubDiligentStudyList" resultType="com.dub.dto.DubRankDto">
|
||
select uid,count(1) studyNum from dubuservoice u
|
||
<if test="objType == 3">
|
||
inner join student s on u.uid = s.studentid and s.status = 1
|
||
inner join studentownclass st on s.studentid = st.studentid and st.status = 1
|
||
inner join classes c on st.classesid = c.classesid and c.schoolid = #{schoolId}
|
||
</if>
|
||
<choose>
|
||
<when test="reqFiltrate.day == 1">
|
||
WHERE u.created > (current_timestamp + interval'-1 day')
|
||
</when>
|
||
<when test="reqFiltrate.week == 1">
|
||
WHERE u.created > (current_date + interval'-1 week')
|
||
AND u.created < current_date
|
||
</when>
|
||
<otherwise>
|
||
WHERE u.created > (current_date + interval'-1 month')
|
||
AND u.created < current_date
|
||
</otherwise>
|
||
</choose>
|
||
AND u.isdelete = 0 AND isshare = 1
|
||
<if test="objType == 4">
|
||
and (CAST(SUBSTRING(CAST(u.areaId AS TEXT) FROM 1 FOR 4) || REPEAT('0', 2) AS INT)) = #{areaId}
|
||
</if>
|
||
<if test="objType == 5">
|
||
and (CAST(SUBSTRING(CAST(u.areaId AS TEXT) FROM 1 FOR 2) || REPEAT('0', 10 - LENGTH(CAST(u.areaId AS TEXT))) AS INT)) = #{areaId}
|
||
</if>
|
||
GROUP BY u.uid order by studyNum desc
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
<select id="findTeachProduction" resultType="com.dub.dto.DubVideo">
|
||
SELECT b.videoid, videoname, video, sound, soundeffect, subtitle, description,timeLength,sentCount,
|
||
uploader, created, interpreter, reviser, difficulty, source,
|
||
copyrighter, crowd, type, label, videopic, keyword, status, playcount, dubcount, priority,
|
||
a.starttime, a.summary
|
||
FROM dubvideostatic a
|
||
LEFT JOIN dubvideodynamic b ON a.videoid = b.videoid
|
||
where a.starttime < current_timestamp
|
||
AND status = 1 and a.isteach = 1
|
||
ORDER BY playcount DESC, date_trunc('day',a.starttime) DESC, priority DESC, dubcount DESC, difficulty DESC
|
||
<if test="page != null">
|
||
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
</if>
|
||
</select>
|
||
<select id="getDubVoiceByCreated" resultType="java.lang.String">
|
||
select type from
|
||
(select u.*,s.type,row_number()over(PARTITION by s.type ORDER BY u.created desc) num from dubuservoice u
|
||
INNER JOIN dubvideostatic s on u.videoid = s.videoid where u.uid = #{studentId} )a
|
||
where a.num = 1 order by created desc
|
||
</select>
|
||
|
||
</mapper>
|