forked from p4fmevgyr/XYSH
parent
7fc411dd1b
commit
8c953cd34e
@ -0,0 +1,53 @@
|
|||||||
|
<?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.forum.dao.CommentDao">
|
||||||
|
|
||||||
|
|
||||||
|
<resultMap id="comment" type="Comment">
|
||||||
|
<id property="id" column="cid"/>
|
||||||
|
<result property="username" column="username"/>
|
||||||
|
<result property="email" column="email"/>
|
||||||
|
<result property="content" column="content"/>
|
||||||
|
<result property="userComment" column="usercomment"/>
|
||||||
|
<result property="avatar" column="avatar"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="forumId" column="forum_id"/>
|
||||||
|
<association property="forum" javaType="Forum">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
<delete id="delById">
|
||||||
|
delete from comment where id=#{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="findByForumIdAndParentCommentNull" resultMap="comment">
|
||||||
|
select c.id cid,c.username,c.email,c.content,c.avatar,
|
||||||
|
c.create_time,c.forum_id,c.parent_comment_id
|
||||||
|
from comment c, forum b
|
||||||
|
where c.forum_id = b.id and c.forum_id = #{forumId}
|
||||||
|
order by c.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="saveComment" parameterType="Comment">
|
||||||
|
insert into comment (username,email,content,avatar,
|
||||||
|
create_time,forum_id,parent_comment_id, usercomment)
|
||||||
|
values (#{username},#{email},#{content},#{avatar},
|
||||||
|
#{createTime},#{forumId},#{parentCommentId}, #{userComment});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="findByParentCommentId" resultMap="comment">
|
||||||
|
select c.id cid, c.username, c.email, c.content, c.avatar,
|
||||||
|
c.create_time, c.forum_id, c.parent_comment_id
|
||||||
|
from comment c
|
||||||
|
where c.parent_comment_id = #{parentCommentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllComment" resultType="com.forum.entity.Comment">
|
||||||
|
select id,username,email,content,create_time from comment
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in new issue