279 lines
10 KiB
XML
279 lines
10 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="DubVideoStatic">
|
|
|
|
<insert id="addDubVideoStatic" parameterType="DubVideoStatic">
|
|
INSERT INTO DubVideoStatic ( videoID,videoName,video,sound,soundEffect,
|
|
subtitle,description,uploader,created,interpreter,reviser,
|
|
difficulty,source,copyrighter,crowd,type,label,videoPic,
|
|
keyWord,status , producer , priority , startTime,summary,isTeach,timelength,sentCount,assigntime )
|
|
Values ( #{videoID},#{videoName},#{video},#{sound},#{soundEffect},
|
|
#{subtitle},#{description},#{uploader},#{created},#{interpreter},#{reviser},
|
|
#{difficulty},#{source},#{copyrighter},#{crowd},#{type},#{label},#{videoPic},
|
|
#{keyWord},#{status} , #{producer} , #{priority} , #{startTime},#{summary},#{isTeach},#{timelength},#{sentCount},#{assigntime})
|
|
</insert>
|
|
|
|
<update id="editDubVideoStatic" parameterType="DubVideoStatic">
|
|
UPDATE DubVideoStatic
|
|
SET videoID=#{videoID},videoName=#{videoName},video=#{video},sound=#{sound},
|
|
soundEffect=#{soundEffect},subtitle=#{subtitle},description=#{description},
|
|
uploader=#{uploader},created=#{created},interpreter=#{interpreter},
|
|
reviser=#{reviser},difficulty=#{difficulty},source=#{source},
|
|
copyrighter=#{copyrighter},crowd=#{crowd},type=#{type},
|
|
label=#{label},videoPic=#{videoPic},keyWord=#{keyWord},status=#{status},
|
|
producer =#{producer} , priority = #{priority} , startTime =#{startTime},summary=#{summary},isTeach=#{isTeach},timelength=#{timelength},sentCount=#{sentCount},assigntime=#{assigntime}
|
|
WHERE videoID=#{videoID}
|
|
</update>
|
|
|
|
<select id="getDubVideoStatic" parameterType="java.lang.Long" resultType="DubVideoStatic">
|
|
SELECT videoID,videoName,video,sound,soundEffect,subtitle, description,
|
|
uploader,created,interpreter,reviser,difficulty,source,copyrighter,
|
|
crowd,type,label,videoPic,keyWord,status , producer , priority , startTime,summary,isTeach,timelength,sentCount,assigntime
|
|
FROM DubVideoStatic
|
|
WHERE videoID=#{videoID}
|
|
</select>
|
|
|
|
|
|
<select id="getSearchDubVideoStatic" resultType="ResDubInfoAssign">
|
|
|
|
select b.videoid, videoname, video,videopic,type,vs.timeLength,vs.sentCount,vs.assignTime,difficulty,a1.gradeAffiliationStr,a2.themeStr,a3.knowledgeStr,b.playcount as playCount
|
|
from dubvideostatic vs LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
left JOIN (select videoid, string_agg(paraid::text, ',') AS gradeAffiliationStr from parameter p INNER JOIN dubvideotag t1 on p.paraid = t1.tagid where p.paraint = 1 and paratype =35 GROUP BY videoid) a1 on vs.videoid = a1.videoid
|
|
left JOIN (select videoid, string_agg(paraid::text, ',') AS themeStr from parameter p INNER JOIN dubvideotag t2 on p.paraid= t2.tagid where p.paraint = 2 and paratype =35 GROUP BY videoid) a2 on vs.videoid = a2.videoid
|
|
left JOIN (select videoid, string_agg(paraid::text, ',') AS knowledgeStr from parameter p INNER JOIN dubvideotag t3 on p.paraid= t3.tagid where p.paraint = 3 and paratype =35 GROUP BY videoid) a3 on vs.videoid = a3.videoid
|
|
where vs.starttime < current_timestamp AND vs.status = 1 AND vs.isTeach = 1
|
|
order by vs.starttime desc,vs.created desc
|
|
|
|
|
|
</select>
|
|
|
|
<select id="getSearchDubVideoStaticForStudent" resultType="ResDubInfoAssign">
|
|
|
|
select b.videoid, videoname, video,videopic,type,vs.timeLength,vs.sentCount,vs.assignTime,difficulty,b.playcount as playCount ,2 as dubType
|
|
from dubvideostatic vs LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
where vs.starttime < current_timestamp AND vs.status = 1 and vs.type = #{regionType}
|
|
|
|
<if test="difficulty != null and difficulty !=''">
|
|
and vs.difficulty = #{difficulty}
|
|
</if>
|
|
<if test="maxTimelength != null">
|
|
and vs.timeLength <= #{maxTimelength}
|
|
</if>
|
|
<if test="minTimelength != null">
|
|
and vs.timeLength >= #{minTimelength}
|
|
</if>
|
|
<if test="minSentCount != null">
|
|
and vs.sentCount >= #{minSentCount}
|
|
</if>
|
|
<if test="maxSentCount != null">
|
|
and vs.sentCount <= #{maxSentCount}
|
|
</if>
|
|
|
|
order by vs.starttime desc,vs.created desc
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize} offset #{offset}
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSearchDubVideoStaticForStudentCount" resultType="java.lang.Integer">
|
|
|
|
select count(*)
|
|
from dubvideostatic vs LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
where vs.starttime < current_timestamp AND vs.status = 1 and vs.type = #{regionType}
|
|
|
|
<if test="difficulty != null and difficulty !=''">
|
|
and vs.difficulty = #{difficulty}
|
|
</if>
|
|
<if test="maxTimelength != null">
|
|
and vs.timeLength <= #{maxTimelength}
|
|
</if>
|
|
<if test="minTimelength != null">
|
|
and vs.timeLength >= #{minTimelength}
|
|
</if>
|
|
<if test="minSentCount != null">
|
|
and vs.sentCount >= #{minSentCount}
|
|
</if>
|
|
<if test="maxSentCount != null">
|
|
and vs.sentCount <= #{maxSentCount}
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSearchDubVideoStaticForEveryDay" resultType="ResDubInfoAssign">
|
|
|
|
select b.videoid, video,videopic,type,vs.timeLength,vs.sentCount,vs.assignTime,difficulty,t.playcount as playCount,t.voiceid as voiceID,t.voicename AS videoName, t.uid AS uid , 1 as dubType
|
|
from dubuservoice t
|
|
INNER JOIN dubvideostatic vs
|
|
ON t.videoid = vs.videoid LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
where vs.starttime < current_timestamp AND vs.status = 1
|
|
|
|
|
|
<if test="difficulty != null and difficulty !=''">
|
|
and vs.difficulty = #{difficulty}
|
|
</if>
|
|
<if test="maxTimelength != null">
|
|
and vs.timeLength <= #{maxTimelength}
|
|
</if>
|
|
<if test="minTimelength != null">
|
|
and vs.timeLength >= #{minTimelength}
|
|
</if>
|
|
<if test="minSentCount != null">
|
|
and vs.sentCount >= #{minSentCount}
|
|
</if>
|
|
<if test="maxSentCount != null">
|
|
and vs.sentCount <= #{maxSentCount}
|
|
</if>
|
|
order by t.created desc,vs.starttime desc,vs.created desc
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize} offset #{offset}
|
|
</if>
|
|
|
|
|
|
</select>
|
|
<select id="getSearchDubVideoStaticForEveryDayCount" resultType="java.lang.Integer">
|
|
|
|
select count(*)
|
|
from dubuservoice t
|
|
INNER JOIN dubvideostatic vs
|
|
ON t.videoid = vs.videoid LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
where vs.starttime < current_timestamp AND vs.status = 1
|
|
|
|
|
|
<if test="difficulty != null and difficulty !=''">
|
|
and vs.difficulty = #{difficulty}
|
|
</if>
|
|
<if test="maxTimelength != null">
|
|
and vs.timeLength <= #{maxTimelength}
|
|
</if>
|
|
<if test="minTimelength != null">
|
|
and vs.timeLength >= #{minTimelength}
|
|
</if>
|
|
<if test="minSentCount != null">
|
|
and vs.sentCount >= #{minSentCount}
|
|
</if>
|
|
<if test="maxSentCount != null">
|
|
and vs.sentCount <= #{maxSentCount}
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSearchDubVideoStaticForHot" resultType="ResDubInfoAssign">
|
|
|
|
select b.videoid, videoname, video,videopic,type,vs.timeLength,vs.sentCount,vs.assignTime,difficulty,b.playcount as playCount ,2 as dubType
|
|
from dubvideostatic vs
|
|
LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
|
|
where vs.starttime < current_timestamp AND vs.status = 1
|
|
<if test="difficulty != null and difficulty !=''">
|
|
and vs.difficulty = #{difficulty}
|
|
</if>
|
|
<if test="maxTimelength != null">
|
|
and vs.timeLength <= #{maxTimelength}
|
|
</if>
|
|
<if test="minTimelength != null">
|
|
and vs.timeLength >= #{minTimelength}
|
|
</if>
|
|
<if test="minSentCount != null">
|
|
and vs.sentCount >= #{minSentCount}
|
|
</if>
|
|
<if test="maxSentCount != null">
|
|
and vs.sentCount <= #{maxSentCount}
|
|
</if>
|
|
|
|
order by b.playcount DESC, date_trunc('day',vs.starttime) DESC, vs.priority DESC, vs.difficulty DESC
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize} offset #{offset}
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSearchDubVideoStaticForHotCount" resultType="java.lang.Integer">
|
|
|
|
select count(*)
|
|
from dubvideostatic vs
|
|
LEFT JOIN dubvideodynamic b ON vs.videoId = b.videoId
|
|
|
|
where vs.starttime < current_timestamp AND vs.status = 1
|
|
<if test="difficulty != null and difficulty !=''">
|
|
and vs.difficulty = #{difficulty}
|
|
</if>
|
|
<if test="maxTimelength != null">
|
|
and vs.timeLength <= #{maxTimelength}
|
|
</if>
|
|
<if test="minTimelength != null">
|
|
and vs.timeLength >= #{minTimelength}
|
|
</if>
|
|
<if test="minSentCount != null">
|
|
and vs.sentCount >= #{minSentCount}
|
|
</if>
|
|
<if test="maxSentCount != null">
|
|
and vs.sentCount <= #{maxSentCount}
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
<select id="getSeqDubVideoStatic" resultType="java.lang.Long" useCache="false" flushCache="true">
|
|
SELECT nextval('seq_dubvideo') ;
|
|
</select>
|
|
|
|
<select id="getDubVideoStaticsCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
|
SELECT COUNT(*)
|
|
FROM DubVideoStatic
|
|
WHERE status = #{status}
|
|
</select>
|
|
|
|
<select id="getDubVideoStatics" parameterType="java.util.Map" resultType="DubVideoStatic">
|
|
SELECT videoID,videoName,'' as video,'' as sound,'' as soundEffect,'' as subtitle,'' as description,
|
|
uploader,created,'' as interpreter,reviser,difficulty,'' as source,'' as copyrighter,
|
|
'' as crowd,type,'' as label,'' as videoPic,'' as keyWord,status , '' as producer , priority,assigntime
|
|
FROM DubVideoStatic
|
|
WHERE status = #{status}
|
|
<if test="keyWord != null and keyWord != ''">
|
|
and videoName like '%'||#{keyWord}||'%'
|
|
</if>
|
|
ORDER BY videoID DESC
|
|
<if test="pageSize!=null">
|
|
limit #{pageSize}
|
|
</if>
|
|
<if test="offset!=null">
|
|
offset #{offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getDubUserVoiceByVoiceId" parameterType="java.lang.Long" resultType="DubUserVoice">
|
|
select voiceId,uid,videoId, voiceName,isShare, playCount, isdelete,thirdPartyLink, production, isRecommend,award,
|
|
created, areaId,recommendTime,draft, likeCount
|
|
from DubUserVoice where voiceId=#{voiceId} and isdelete=0 and isShare=1
|
|
</select>
|
|
|
|
<select id="getIsLikeByVoiceId" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
select isLike from dubsupport where uid=#{uid} and voiceid=#{voiceId}
|
|
</select>
|
|
|
|
<select id="getIsFavoriteByVoiceId" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
select count(uid) from dubfavorite where uid=#{uid} and dubid=#{voiceId}
|
|
</select>
|
|
|
|
|
|
<select id="getCommentCountByVoiceId" parameterType="java.lang.Long" resultType="java.lang.Integer">
|
|
select count(commentid) from dubcritic where dubid=#{voiceId} and commenttype=2
|
|
</select>
|
|
</mapper> |