<?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.dromara.system.mapper.TblDzbcFeedbackMapper">

    <resultMap type="org.dromara.system.domain.vo.TblDzbcFeedbackVo" id="TblDzbcFeedbackResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="userPhone"    column="user_phone"    />
        <result property="content"    column="content"    />
        <result property="imageUrls"    column="image_urls"    />
        <result property="type"    column="type"    />
        <result property="status"    column="status"    />
        <result property="replyContent"    column="reply_content"    />
        <result property="replyUserId"    column="reply_user_id"    />
        <result property="replyUserName"    column="reply_user_name"    />
        <result property="replyTime"    column="reply_time"    />
        <result property="remark"    column="remark"    />
        <result property="ext1"    column="ext1"    />
        <result property="ext2"    column="ext2"    />
    </resultMap>

    <select id="selectVoList" parameterType="org.dromara.system.domain.vo.TblDzbcFeedbackVo" resultMap="TblDzbcFeedbackResult">
        select id, user_id, user_name, user_phone, content, image_urls, type, status, reply_content, reply_user_id, reply_user_name, reply_time, remark, ext1, ext2
        from tbl_dzbc_feedback
        <where>
            <if test="userId != null">
                and user_id = #{userId}
            </if>
            <if test="userName != null and userName != ''">
                and user_name like concat('%', #{userName}, '%')
            </if>
            <if test="content != null and content != ''">
                and content like concat('%', #{content}, '%')
            </if>
            <if test="type != null">
                and type = #{type}
            </if>
            <if test="status != null">
                and status = #{status}
            </if>
        </where>
        order by create_time desc
    </select>

    <select id="selectVoById" parameterType="Long" resultMap="TblDzbcFeedbackResult">
        select id, user_id, user_name, user_phone, content, image_urls, type, status, reply_content, reply_user_id, reply_user_name, reply_time, remark, ext1, ext2
        from tbl_dzbc_feedback
        where id = #{id}
    </select>

    <select id="selectVoByIds" parameterType="Collection" resultMap="TblDzbcFeedbackResult">
        select id, user_id, user_name, user_phone, content, image_urls, type, status, reply_content, reply_user_id, reply_user_name, reply_time, remark, ext1, ext2
        from tbl_dzbc_feedback
        where id in
        <foreach item="id" collection="ids" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

    <select id="selectByUserId" parameterType="Long" resultMap="TblDzbcFeedbackResult">
        select id, user_id, user_name, user_phone, content, image_urls, type, status, reply_content, reply_user_id, reply_user_name, reply_time, remark, ext1, ext2
        from tbl_dzbc_feedback
        where user_id = #{userId}
        order by create_time desc
    </select>

</mapper>
