IMProductCommentMapper.xml 3.8 KB
<?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.sibu.orderHelper.integral.dao.IMProductCommentDao">

	<sql id="IMProductComment_Column">
		im_comment_id,im_product_id,comment_member_id,comment_nickname,comment_phone,
		comment_head,comment_level_name,order_id,order1_id,content,grade,create_date,buy_date,status,comment_img,
		comment_img1,comment_img2,reply_remark,reply_dt,reply_username 
	</sql>
    <insert id="addIMProductComment" parameterType="map">
        insert into ${productCommentTable}(<include refid="IMProductComment_Column"/>)
        value(
            #{productComment.imCommentId},
            #{productComment.imProductId},
            #{productComment.commentMemberId},
            #{productComment.commentNickname},
            #{productComment.commentPhone},
            #{productComment.commentHead},
            #{productComment.commentLevelName},
            #{productComment.orderId},
            #{productComment.order1Id},
            #{productComment.content},
            #{productComment.grade},
            NOW(),
            #{productComment.buyDate},
            1,
            #{productComment.commentImg},
            #{productComment.commentImg1},
            #{productComment.commentImg2},
            #{productComment.replyRemark},
            NOW(),
            #{productComment.replyUsername}
        )
    </insert>
    <delete id="deleteIMProductComment" parameterType="map">
    	delete from ${productCommentTable} where im_comment_id = #{productComment.imCommentId}
    </delete>
   	<!-- 评论列表 -->
   	<select id="pagerIMProductComment" parameterType="map" resultMap="listIMProductComment">
   		select <include refid="IMProductComment_Column" /> 
   		from ${productCommentTable} 
   		where im_product_id = #{productId} AND status=3 AND delete_flag=1 
   		order by create_date desc 
   		limit ${pageNow},${pageSize}
   	</select>
   	<!-- 查询用户是否已经评论 -->
   	<select id="getOneCommentDetail" parameterType="map" resultMap="listIMProductComment">
   		select <include refid="IMProductComment_Column" /> 
   		from ${productCommentTable} 
   		where im_product_id = #{productId} AND order1_id=#{order1Id} 
   		limit 1
   	</select>
   	<select id="countIMProductComment" parameterType="map" resultType="int">
   		select count(1) from ${productCommentTable} where im_product_id = #{productId} AND status=3 AND delete_flag=1
   	</select>
   	<resultMap type="IMProductCommentBean" id="listIMProductComment">
   		<id column="im_comment_id" property="imCommentId" />
        <result column="im_product_id" property="imProductId" />
        <result column="comment_member_id" property="commentMemberId" />
        <result column="comment_nickname" property="commentNickname" />
        <result column="comment_phone" property="commentPhone" />
        <result column="comment_head" property="commentHead" />
        <result column="comment_level_name" property="commentLevelName" />
        <result column="order1_id" property="order1Id" />
        <result column="order_id" property="orderId" />
        <result column="content" property="content" />
        <result column="grade" property="grade" />
        <result column="create_date" property="createDate" />
        <result column="buy_date" property="buyDate" />
        <result column="status" property="status" />
        <result column="comment_img" property="commentImg" />
        <result column="comment_img1" property="commentImg1" />
        <result column="comment_img2" property="commentImg2" />
        <result column="reply_remark" property="replyRemark" />
        <result column="reply_dt" property="replyDt" />
        <result column="reply_username" property="replyUsername" />
   	</resultMap>
</mapper>