<?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="cn.jnu.core.dao.CommentDao" >
<!-- 根据商品id查询出其所有评论 -->
<select id="findCommentListByGoodsId" parameterType="Integer" resultType="Comment" >
select comment_id, goods_id, a.user_id, username publisher, content, create_time time
from m_user a, m_comment b
where a.user_id = b.user_id and goods_id = #{goods_id}
</select>
<!-- 根据cid查询某一条评论 -->
<select id="findCommentById" parameterType="Integer" resultType="Comment" >
select comment_id, goods_id, a.user_id, username publisher, content, create_time time
from m_user a, m_comment b
where a.user_id = b.user_id and b.comment_id = #{comment_id}
</select>
<!-- 给gid对应的商品添加评论 -->
<insert id="addComment" parameterType="Comment" >
insert into m_comment
values (
#{comment_id, jdbcType=NUMERIC},
#{goods_id, jdbcType=NUMERIC},
#{user_id, jdbcType=NUMERIC},
#{time, jdbcType=TIMESTAMP},
#{content, jdbcType=VARCHAR}
)
</insert>
<!-- 根据评论id删除评论 -->
<delete id="removeComment" parameterType="Integer" >
delete from m_comment
where comment_id = #{comment_id}
</delete>
</mapper>
CommentDao
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。