<?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.community.huiju.dao.TaFeedbackMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaFeedback" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="content" property="content" jdbcType="VARCHAR" />
    <result column="ta_user_tel" property="taUserTel" jdbcType="VARCHAR" />
    <result column="estate_source" property="estateSource" jdbcType="VARCHAR" />
    <result column="handle_status" property="handleStatus" jdbcType="VARCHAR" />
    <result column="handle_remark" property="handleRemark" jdbcType="VARCHAR" />
    <result column="handle_user" property="handleUser" jdbcType="VARCHAR" />
    <result column="handle_time" property="handleTime" jdbcType="TIMESTAMP" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    <result column="create_user" property="createUser" jdbcType="INTEGER" />
    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, content, ta_user_tel, estate_source, handle_status, handle_remark, handle_user, 
    handle_time, create_date, create_user, update_date, update_user
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from ta_feedback
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from ta_feedback
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.TaFeedback" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
    insert into ta_feedback (id, content, ta_user_tel, 
      estate_source, handle_status, handle_remark, 
      handle_user, handle_time, create_date, 
      create_user, update_date, update_user
      )
    values (#{id,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{taUserTel,jdbcType=VARCHAR}, 
      #{estateSource,jdbcType=VARCHAR}, #{handleStatus,jdbcType=VARCHAR}, #{handleRemark,jdbcType=VARCHAR}, 
      #{handleUser,jdbcType=VARCHAR}, #{handleTime,jdbcType=TIMESTAMP}, #{createDate,jdbcType=TIMESTAMP}, 
      #{createUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.TaFeedback" >
    insert into ta_feedback
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="content != null" >
        content,
      </if>
      <if test="taUserTel != null" >
        ta_user_tel,
      </if>
      <if test="estateSource != null" >
        estate_source,
      </if>
      <if test="handleStatus != null" >
        handle_status,
      </if>
      <if test="handleRemark != null" >
        handle_remark,
      </if>
      <if test="handleUser != null" >
        handle_user,
      </if>
      <if test="handleTime != null" >
        handle_time,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
      <if test="createUser != null" >
        create_user,
      </if>
      <if test="updateDate != null" >
        update_date,
      </if>
      <if test="updateUser != null" >
        update_user,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="content != null" >
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="taUserTel != null" >
        #{taUserTel,jdbcType=VARCHAR},
      </if>
      <if test="estateSource != null" >
        #{estateSource,jdbcType=VARCHAR},
      </if>
      <if test="handleStatus != null" >
        #{handleStatus,jdbcType=VARCHAR},
      </if>
      <if test="handleRemark != null" >
        #{handleRemark,jdbcType=VARCHAR},
      </if>
      <if test="handleUser != null" >
        #{handleUser,jdbcType=VARCHAR},
      </if>
      <if test="handleTime != null" >
        #{handleTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null" >
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="updateDate != null" >
        #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUser != null" >
        #{updateUser,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaFeedback" >
    update ta_feedback
    <set >
      <if test="content != null" >
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="taUserTel != null" >
        ta_user_tel = #{taUserTel,jdbcType=VARCHAR},
      </if>
      <if test="estateSource != null" >
        estate_source = #{estateSource,jdbcType=VARCHAR},
      </if>
      <if test="handleStatus != null" >
        handle_status = #{handleStatus,jdbcType=VARCHAR},
      </if>
      <if test="handleRemark != null" >
        handle_remark = #{handleRemark,jdbcType=VARCHAR},
      </if>
      <if test="handleUser != null" >
        handle_user = #{handleUser,jdbcType=VARCHAR},
      </if>
      <if test="handleTime != null" >
        handle_time = #{handleTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null" >
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="updateDate != null" >
        update_date = #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUser != null" >
        update_user = #{updateUser,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaFeedback" >
    update ta_feedback
    set content = #{content,jdbcType=VARCHAR},
      ta_user_tel = #{taUserTel,jdbcType=VARCHAR},
      estate_source = #{estateSource,jdbcType=VARCHAR},
      handle_status = #{handleStatus,jdbcType=VARCHAR},
      handle_remark = #{handleRemark,jdbcType=VARCHAR},
      handle_user = #{handleUser,jdbcType=VARCHAR},
      handle_time = #{handleTime,jdbcType=TIMESTAMP},
      create_date = #{createDate,jdbcType=TIMESTAMP},
      create_user = #{createUser,jdbcType=INTEGER},
      update_date = #{updateDate,jdbcType=TIMESTAMP},
      update_user = #{updateUser,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="getFeedback" resultMap="BaseResultMap">
    select * from  ta_feedback
    <where>
      <if test="tel != null and tel !=''">
        and ta_user_tel like CONCAT('%', #{tel,jdbcType=VARCHAR}, '%')
      </if>

      <if test="content != null and content !=''">
        and handle_remark like CONCAT('%', #{content,jdbcType=VARCHAR}, '%')
      </if>

      <if test="handleStatus != null and handleStatus !=''">
        and handle_status like CONCAT('%', #{handleStatus,jdbcType=VARCHAR}, '%')
      </if>
    </where>
    ORDER BY update_date desc
  </select>
</mapper>