<?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.huiju.estateagents.property.dao.TpSocialViewMapper" >
  <resultMap id="BaseResultMap" type="com.huiju.estateagents.property.model.TpSocialView" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="org_id" property="orgId" jdbcType="INTEGER" />
    <result column="uuid" property="uuid" jdbcType="INTEGER" />
    <result column="social_type" property="socialType" jdbcType="VARCHAR" />
    <result column="ta_user_id" property="taUserId" jdbcType="INTEGER" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, org_id, uuid, social_type, ta_user_id, remark, create_date
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tp_social_view
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from tp_social_view
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.huiju.estateagents.property.model.TpSocialView" >
    insert into tp_social_view (id, org_id, uuid,
      social_type, ta_user_id, remark, 
      create_date)
    values (#{id,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER}, #{uuid,jdbcType=INTEGER},
      #{socialType,jdbcType=VARCHAR}, #{taUserId,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, 
      #{createDate,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.huiju.estateagents.property.model.TpSocialView" >
    insert into tp_social_view
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
      <if test="uuid != null" >
        uuid,
      </if>
      <if test="socialType != null" >
        social_type,
      </if>
      <if test="taUserId != null" >
        ta_user_id,
      </if>
      <if test="remark != null" >
        remark,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orgId != null" >
        #{orgId,jdbcType=INTEGER},
      </if>
      <if test="uuid != null" >
        #{uuid,jdbcType=INTEGER},
      </if>
      <if test="socialType != null" >
        #{socialType,jdbcType=VARCHAR},
      </if>
      <if test="taUserId != null" >
        #{taUserId,jdbcType=INTEGER},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.huiju.estateagents.property.model.TpSocialView" >
    update tp_social_view
    <set >
      <if test="orgId != null" >
        org_id = #{orgId,jdbcType=INTEGER},
      </if>
      <if test="uuid != null" >
        uuid = #{uuid,jdbcType=INTEGER},
      </if>
      <if test="socialType != null" >
        social_type = #{socialType,jdbcType=VARCHAR},
      </if>
      <if test="taUserId != null" >
        ta_user_id = #{taUserId,jdbcType=INTEGER},
      </if>
      <if test="remark != null" >
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.huiju.estateagents.property.model.TpSocialView" >
    update tp_social_view
    set org_id = #{orgId,jdbcType=INTEGER},
      uuid = #{uuid,jdbcType=INTEGER},
      social_type = #{socialType,jdbcType=VARCHAR},
      ta_user_id = #{taUserId,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="selectViewNum" resultType="java.lang.Integer" parameterType="com.huiju.estateagents.property.model.TpSocialView">
    select count(*) from tp_social_view
    where 1=1
    <if test="taUserId != null" >
      and ta_user_id = #{taUserId}
    </if>
    and uuid = #{uuid}
    and org_id = #{orgId}
    and social_type = #{socialType}
  </select>
</mapper>