62 lines
1.8 KiB
XML
62 lines
1.8 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.DubFavoriteDao">
|
|
<select id="searchMyFavorites" parameterType="map" resultType="com.dub.dto.ResDubInfo">
|
|
SELECT 0 AS voiceid,s.videoid,s.videoname,s.video AS videoURL,'' AS soundURL,
|
|
s.videopic,f.created,f.type AS dubType
|
|
FROM dubVideoStatic s
|
|
INNER JOIN (
|
|
SELECT uid, dubid, type, created
|
|
FROM dubFavorite
|
|
WHERE uid = #{uid}
|
|
AND type = '2'
|
|
) f
|
|
ON f.dubid = s.videoid
|
|
WHERE s.videoname LIKE #{keyWord}
|
|
|
|
UNION
|
|
|
|
SELECT u.voiceid,0 AS videoid,u.voicename AS videoname,'' AS videoURL,u.production AS soundURL,
|
|
v.videopic,f.created,f.type AS dubType
|
|
FROM dubUserVoice u
|
|
INNER JOIN dubVideoStatic v
|
|
ON v.videoid = u.videoid
|
|
INNER JOIN (
|
|
SELECT uid, dubid, type, created
|
|
FROM dubFavorite
|
|
WHERE uid = #{uid}
|
|
AND type = '1'
|
|
) f
|
|
ON f.dubid = u.voiceid
|
|
WHERE u.voicename LIKE #{keyWord}
|
|
</select>
|
|
|
|
<select id="findFavoriteByPK" parameterType="map" resultType="com.dub.entity.DubFavorite">
|
|
SELECT uid, dubid, type, created
|
|
FROM dubfavorite
|
|
WHERE uid = #{uid} AND dubid = #{dubid} AND type = #{type}
|
|
</select>
|
|
|
|
<select id="findMyFavorites" parameterType="map" resultType="com.dub.entity.DubFavorite">
|
|
SELECT uid, dubid, type, created
|
|
FROM dubfavorite
|
|
WHERE uid = #{uid}
|
|
ORDER BY created DESC
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="doSaveFavorite" parameterType="com.dub.entity.DubFavorite">
|
|
INSERT INTO DubFavorite(uid,dubid,type,created)
|
|
VALUES (#{uid},#{dubid},#{type},#{created})
|
|
</insert>
|
|
|
|
<delete id="doDeleteFavorite" parameterType="com.dub.entity.DubFavorite">
|
|
DELETE FROM dubfavorite
|
|
WHERE uid = #{uid} AND dubid = #{dubid} AND type = #{type}
|
|
</delete>
|
|
</mapper>
|