71 lines
2.4 KiB
XML
71 lines
2.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="com._3e.dubdao.DubCriticDao">
|
|
<select id="findTheCritics" parameterType="map" resultType="com.dub.entity.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>
|
|
|
|
<select id="findReplyCritic" parameterType="map" resultType="com.dub.entity.DubCritic">
|
|
SELECT commentid, uid, commenttype, dubid, content, created, isquiet, aim
|
|
FROM dubcritic
|
|
WHERE commenttype = 3 AND dubid = #{commentid}
|
|
AND (((uid = #{uid} OR aim = #{uid}) AND isquiet = 1) OR isquiet = 0)
|
|
</select>
|
|
|
|
<update id="doUpdateCritic" parameterType="com.dub.entity.DubCritic">
|
|
Update dubcritic
|
|
<set>
|
|
<if test="uid != null">uid = #{uid},</if>
|
|
<if test="aim != null">aim = #{aim},</if>
|
|
<if test="commenttype != null">commenttype = #{commenttype},</if>
|
|
<if test="dubid != null">dubid = #{dubid},</if>
|
|
<if test="isquiet != null">isquiet = #{isquiet},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="created != null">created = #{created},</if>
|
|
<if test="areaid != null">areaid = #{areaid}</if>
|
|
</set>
|
|
WHERE commentid = #{commentid}
|
|
</update>
|
|
|
|
<select id="findCriticById" parameterType="long" resultType="com.dub.entity.DubCritic">
|
|
SELECT commentid, uid, commenttype, dubid, content, created, isquiet, aim
|
|
FROM dubcritic
|
|
WHERE commentid = #{commentid}
|
|
</select>
|
|
|
|
<delete id="doDeleteCritic" parameterType="com.dub.entity.DubCritic">
|
|
DELETE FROM dubcritic
|
|
WHERE commentid = #{commentid}
|
|
</delete>
|
|
|
|
<insert id="doSaveCritic" parameterType="com.dub.entity.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="map" resultType="int">
|
|
SELECT COUNT(commentid)
|
|
FROM dubcritic
|
|
WHERE dubid = #{dubid} AND commenttype = #{commentType}
|
|
</select>
|
|
</mapper>
|