<?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.srs.stureg.mapper.SrsFeedbackMapper">
    
    <resultMap type="SrsFeedback" id="SrsFeedbackResult">
        <result property="id"    column="id"    />
        <result property="opinion"    column="opinion"    />
        <result property="ip"    column="ip"    />
        <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="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectSrsFeedbackVo">
        select id, opinion, ip, create_by, create_time, update_by, update_time, del_flag from srs_feedback
    </sql>

    <select id="selectSrsFeedbackList" parameterType="SrsFeedback" resultMap="SrsFeedbackResult">
        <include refid="selectSrsFeedbackVo"/>
        <where>  
            <if test="opinion != null  and opinion != ''"> and opinion = #{opinion}</if>
            <if test="ip != null  and ip != ''"> and ip = #{ip}</if>
        </where>
    </select>
    
    <select id="selectSrsFeedbackById" parameterType="Long" resultMap="SrsFeedbackResult">
        <include refid="selectSrsFeedbackVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSrsFeedback" parameterType="SrsFeedback" useGeneratedKeys="true" keyProperty="id">
        insert into srs_feedback
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="opinion != null">opinion,</if>
            <if test="ip != null">ip,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="delFlag != null and delFlag != ''">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="opinion != null">#{opinion},</if>
            <if test="ip != null">#{ip},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateSrsFeedback" parameterType="SrsFeedback">
        update srs_feedback
        <trim prefix="SET" suffixOverrides=",">
            <if test="opinion != null">opinion = #{opinion},</if>
            <if test="ip != null">ip = #{ip},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSrsFeedbackById" parameterType="Long">
        delete from srs_feedback where id = #{id}
    </delete>

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