<?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.TaUserVerifyMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaUserVerify" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="community_id" property="communityId" jdbcType="INTEGER" />
    <result column="role_id" property="roleId" jdbcType="INTEGER" />
    <result column="phase_id" property="phaseId" jdbcType="INTEGER" />
    <result column="phase_name" property="phaseName" jdbcType="VARCHAR" />
    <result column="building_id" property="buildingId" jdbcType="INTEGER" />
    <result column="building_name" property="buildingName" jdbcType="VARCHAR" />
    <result column="unit_id" property="unitId" jdbcType="INTEGER" />
    <result column="unit_name" property="unitName" jdbcType="VARCHAR" />
    <result column="level_id" property="levelId" jdbcType="INTEGER" />
    <result column="level_name" property="levelName" jdbcType="VARCHAR" />
    <result column="room_no_id" property="roomNoId" jdbcType="INTEGER" />
    <result column="room_no_name" property="roomNoName" jdbcType="VARCHAR" />
    <result column="verify_status" property="verifyStatus" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    <result column="verify_name" property="verifyName" jdbcType="VARCHAR" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_id, community_id, role_id, phase_id, phase_name, building_id, building_name,
    unit_id, unit_name, level_id, level_name, room_no_id, room_no_name, verify_status,
    create_date, verify_name, remark
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    from ta_user_verify
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from ta_user_verify
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.TaUserVerify"  keyColumn="id" useGeneratedKeys="true" >
    insert into ta_user_verify (id, user_id, community_id,
      role_id, phase_id, phase_name,
      building_id, building_name, unit_id,
      unit_name, level_id, level_name,
      room_no_id, room_no_name, verify_status,
      create_date, verify_name, remark)
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER},
      #{roleId,jdbcType=INTEGER}, #{phaseId,jdbcType=INTEGER}, #{phaseName,jdbcType=VARCHAR},
      #{buildingId,jdbcType=INTEGER}, #{buildingName,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER},
      #{unitName,jdbcType=VARCHAR}, #{levelId,jdbcType=INTEGER}, #{levelName,jdbcType=VARCHAR},
      #{roomNoId,jdbcType=INTEGER}, #{roomNoName,jdbcType=VARCHAR}, #{verifyStatus,jdbcType=VARCHAR},
      #{createDate,jdbcType=TIMESTAMP}, #{verifyName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUserVerify" keyProperty="id" useGeneratedKeys="true">
    insert into ta_user_verify
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="communityId != null" >
        community_id,
      </if>
      <if test="roleId != null" >
        role_id,
      </if>
      <if test="phaseId != null" >
        phase_id,
      </if>
      <if test="phaseName != null" >
        phase_name,
      </if>
      <if test="buildingId != null" >
        building_id,
      </if>
      <if test="buildingName != null" >
        building_name,
      </if>
      <if test="unitId != null" >
        unit_id,
      </if>
      <if test="unitName != null" >
        unit_name,
      </if>
      <if test="levelId != null" >
        level_id,
      </if>
      <if test="levelName != null" >
        level_name,
      </if>
      <if test="roomNoId != null" >
        room_no_id,
      </if>
      <if test="roomNoName != null" >
        room_no_name,
      </if>
      <if test="verifyStatus != null" >
        verify_status,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
      <if test="verifyName != null" >
        verify_name,
      </if>
      <if test="remark != null">
        remark,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="communityId != null" >
        #{communityId,jdbcType=INTEGER},
      </if>
      <if test="roleId != null" >
        #{roleId,jdbcType=INTEGER},
      </if>
      <if test="phaseId != null" >
        #{phaseId,jdbcType=INTEGER},
      </if>
      <if test="phaseName != null" >
        #{phaseName,jdbcType=VARCHAR},
      </if>
      <if test="buildingId != null" >
        #{buildingId,jdbcType=INTEGER},
      </if>
      <if test="buildingName != null" >
        #{buildingName,jdbcType=VARCHAR},
      </if>
      <if test="unitId != null" >
        #{unitId,jdbcType=INTEGER},
      </if>
      <if test="unitName != null" >
        #{unitName,jdbcType=VARCHAR},
      </if>
      <if test="levelId != null" >
        #{levelId,jdbcType=INTEGER},
      </if>
      <if test="levelName != null" >
        #{levelName,jdbcType=VARCHAR},
      </if>
      <if test="roomNoId != null" >
        #{roomNoId,jdbcType=INTEGER},
      </if>
      <if test="roomNoName != null" >
        #{roomNoName,jdbcType=VARCHAR},
      </if>
      <if test="verifyStatus != null" >
        #{verifyStatus,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="verifyName != null" >
        #{verifyName,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUserVerify" >
    update ta_user_verify
    <set >
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="communityId != null" >
        community_id = #{communityId,jdbcType=INTEGER},
      </if>
      <if test="roleId != null" >
        role_id = #{roleId,jdbcType=INTEGER},
      </if>
      <if test="phaseId != null" >
        phase_id = #{phaseId,jdbcType=INTEGER},
      </if>
      <if test="phaseName != null" >
        phase_name = #{phaseName,jdbcType=VARCHAR},
      </if>
      <if test="buildingId != null" >
        building_id = #{buildingId,jdbcType=INTEGER},
      </if>
      <if test="buildingName != null" >
        building_name = #{buildingName,jdbcType=VARCHAR},
      </if>
      <if test="unitId != null" >
        unit_id = #{unitId,jdbcType=INTEGER},
      </if>
      <if test="unitName != null" >
        unit_name = #{unitName,jdbcType=VARCHAR},
      </if>
      <if test="levelId != null" >
        level_id = #{levelId,jdbcType=INTEGER},
      </if>
      <if test="levelName != null" >
        level_name = #{levelName,jdbcType=VARCHAR},
      </if>
      <if test="roomNoId != null" >
        room_no_id = #{roomNoId,jdbcType=INTEGER},
      </if>
      <if test="roomNoName != null" >
        room_no_name = #{roomNoName,jdbcType=VARCHAR},
      </if>
      <if test="verifyStatus != null" >
        verify_status = #{verifyStatus,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="verifyName != null" >
        verify_name = #{verifyName,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR}
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaUserVerify" >
    update ta_user_verify
    set user_id = #{userId,jdbcType=INTEGER},
      community_id = #{communityId,jdbcType=INTEGER},
      role_id = #{roleId,jdbcType=INTEGER},
      phase_id = #{phaseId,jdbcType=INTEGER},
      phase_name = #{phaseName,jdbcType=VARCHAR},
      building_id = #{buildingId,jdbcType=INTEGER},
      building_name = #{buildingName,jdbcType=VARCHAR},
      unit_id = #{unitId,jdbcType=INTEGER},
      unit_name = #{unitName,jdbcType=VARCHAR},
      level_id = #{levelId,jdbcType=INTEGER},
      level_name = #{levelName,jdbcType=VARCHAR},
      room_no_id = #{roomNoId,jdbcType=INTEGER},
      room_no_name = #{roomNoName,jdbcType=VARCHAR},
      verify_status = #{verifyStatus,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP},
      verify_name = #{verifyName,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByUserId" resultMap="BaseResultMap" parameterType="integer">
    select
    <include refid="Base_Column_List"/>
    from ta_user_verify
    where user_id = #{userId,jdbcType=INTEGER}
  </select>
  <select id="selectCommunityAndAddress" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from ta_user_verify
    where community_id = #{communityId,jdbcType=INTEGER}
    and user_id = #{userId,jdbcType=INTEGER}
    and phase_id = #{phaseId,jdbcType=INTEGER}
    and building_id = #{buildingId,jdbcType=INTEGER}
    and unit_id = #{unitId,jdbcType=INTEGER}
    and level_id = #{levelId,jdbcType=INTEGER}
    and room_no_id = #{roomNoId,jdbcType=INTEGER}
    <if test="verifyStatus != null and verifyStatus != ''">
      and verify_status = #{verifyStatus}
    </if>

  </select>
</mapper>