<?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.easyproject.service.mapper.operate.OperateFeedbackMapper">
    
    <resultMap type="OperateFeedback" id="OperateFeedbackResult">
        <result property="id"    column="id"    />
        <result property="feedbackContent"    column="feedback_content"    />
        <result property="phone"    column="phone"    />
        <result property="status"    column="status"    />
        <result property="ipAddress"    column="ip_address"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectOperateFeedbackVo">
        select id, feedback_content, phone, status, ip_address, create_by, create_time, update_by, update_time, remark from operate_feedback
    </sql>

    <select id="selectOperateFeedbackList" parameterType="OperateFeedback" resultMap="OperateFeedbackResult">
        <include refid="selectOperateFeedbackVo"/>
        <where>  
            <if test="phone != null  and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
        order by id desc
    </select>
    
    <select id="selectOperateFeedbackById" parameterType="Long" resultMap="OperateFeedbackResult">
        <include refid="selectOperateFeedbackVo"/>
        where id = #{id}
    </select>

    <update id="updateOperateFeedback" parameterType="OperateFeedback">
        update operate_feedback
        <trim prefix="SET" suffixOverrides=",">
            <if test="status != null">status = #{status},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteOperateFeedbackByIds" parameterType="String">
        delete from operate_feedback where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>