39 lines
1.4 KiB
XML
39 lines
1.4 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="DubCritic">
|
||
|
|
|
||
|
|
<select id="findTheCritics" parameterType="java.util.Map" resultType="DubCritic">
|
||
|
|
SELECT commentid, uid, commenttype, dubid, content, created, isquiet, aim
|
||
|
|
FROM dubcritic
|
||
|
|
WHERE dubid = #{dubid} AND commenttype = #{commentType}
|
||
|
|
<if test="commenttype == 3">
|
||
|
|
AND (((uid = #{uid} OR aim = #{uid}) AND isquiet = 1) OR isquiet = 0)
|
||
|
|
</if>
|
||
|
|
ORDER BY created ASC
|
||
|
|
<if test="page != null">
|
||
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="doSaveCritic" parameterType="DubCritic">
|
||
|
|
INSERT INTO dubcritic(commentid,uid,aim,commenttype,dubid,isquiet,content,created,areaid)
|
||
|
|
VALUES (
|
||
|
|
<if test="commentid == 0">
|
||
|
|
(SELECT NEXTVAL('seq_dubcritic')),
|
||
|
|
</if>
|
||
|
|
<if test="commentid != 0">
|
||
|
|
#{commentid},
|
||
|
|
</if>
|
||
|
|
#{uid},#{aim},#{commenttype},#{dubid},#{isquiet},#{content},#{created},#{areaid})
|
||
|
|
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id="findCriticCountByDubId" parameterType="java.util.Map" resultType="java.lang.Integer">
|
||
|
|
SELECT COUNT(commentid)
|
||
|
|
FROM dubcritic
|
||
|
|
WHERE dubid = #{dubid} AND commenttype = #{commentType}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
</mapper>
|