<?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="org.springblade.business.mapper.UserOpinionCommentsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="userOpinionCommentsResultMap" type="org.springblade.business.entity.UserOpinionComments">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="user_opinion_id" property="userOpinionId"/>
        <result column="reply_id" property="replyId"/>
        <result column="reply_content" property="replyContent"/>
        <result column="good_count" property="goodCount"/>
        <result column="project_id" property="projectId"/>
        <result column="contract_id" property="contractId"/>
    </resultMap>

    <select id="queryUserOpinionCommentsByUserOpinionId" resultMap="userOpinionCommentsResultMap">
        select id,user_opinion_id,reply_id,reply_content,good_count,project_id,contract_id,create_user,create_time from u_user_opinion_comments where user_opinion_id = #{key} and is_deleted = 0
    </select>

    <select id="countCommentsByUserOpinionKey" resultType="java.lang.Integer">
        select count(id) from u_user_opinion_comments where user_opinion_id = #{key} and is_deleted = 0
    </select>

    <select id="countGoodByUserOpinionKey" resultType="java.lang.Integer">
        select count(good_count) from u_user_opinion_comments where user_opinion_id = #{key} and is_deleted = 0
    </select>

    <select id="selectUserOpinionCommentsPage" resultMap="userOpinionCommentsResultMap">
        select * from u_user_opinion_comments where is_deleted = 0
    </select>

</mapper>
