<?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.chaozhanggui.dao.system.dao.TbPlussIdCardMapper">
  <resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussIdCard">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="userId" jdbcType="INTEGER" property="userid" />
    <result column="userType" jdbcType="VARCHAR" property="usertype" />
    <result column="certType" jdbcType="VARCHAR" property="certtype" />
    <result column="certNo" jdbcType="VARCHAR" property="certno" />
    <result column="certName" jdbcType="VARCHAR" property="certname" />
    <result column="certStartTime" jdbcType="VARCHAR" property="certstarttime" />
    <result column="certEndTime" jdbcType="VARCHAR" property="certendtime" />
    <result column="certAddress" jdbcType="VARCHAR" property="certaddress" />
    <result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
    <result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
    <result column="imgPositive" jdbcType="VARCHAR" property="imgpositive" />
    <result column="imgNegative" jdbcType="VARCHAR" property="imgnegative" />
    <result column="virTypeFlag" jdbcType="VARCHAR" property="virtypeflag" />
  </resultMap>
  <sql id="Base_Column_List">
    id, userId, userType, certType, certNo, certName, certStartTime, certEndTime, certAddress, 
    createTime, updateTime, imgPositive, imgNegative, virTypeFlag
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tb_pluss_id_card
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectCertByUserId" resultType="com.chaozhanggui.dao.system.entity.TbPlussIdCard">
    select
    <include refid="Base_Column_List" />
    from tb_pluss_id_card
    where `userId` = #{userId}
    AND `userType` = #{type}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from tb_pluss_id_card
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussIdCard">
    insert into tb_pluss_id_card (id, userId, userType, 
      certType, certNo, certName, 
      certStartTime, certEndTime, certAddress, 
      createTime, updateTime, imgPositive, 
      imgNegative, virTypeFlag)
    values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, #{usertype,jdbcType=VARCHAR}, 
      #{certtype,jdbcType=VARCHAR}, #{certno,jdbcType=VARCHAR}, #{certname,jdbcType=VARCHAR}, 
      #{certstarttime,jdbcType=VARCHAR}, #{certendtime,jdbcType=VARCHAR}, #{certaddress,jdbcType=VARCHAR}, 
      #{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, #{imgpositive,jdbcType=VARCHAR}, 
      #{imgnegative,jdbcType=VARCHAR}, #{virtypeflag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussIdCard">
    insert into tb_pluss_id_card
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userid != null">
        userId,
      </if>
      <if test="usertype != null">
        userType,
      </if>
      <if test="certtype != null">
        certType,
      </if>
      <if test="certno != null">
        certNo,
      </if>
      <if test="certname != null">
        certName,
      </if>
      <if test="certstarttime != null">
        certStartTime,
      </if>
      <if test="certendtime != null">
        certEndTime,
      </if>
      <if test="certaddress != null">
        certAddress,
      </if>
      <if test="createtime != null">
        createTime,
      </if>
      <if test="updatetime != null">
        updateTime,
      </if>
      <if test="imgpositive != null">
        imgPositive,
      </if>
      <if test="imgnegative != null">
        imgNegative,
      </if>
      <if test="virtypeflag != null">
        virTypeFlag,
      </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="usertype != null">
        #{usertype,jdbcType=VARCHAR},
      </if>
      <if test="certtype != null">
        #{certtype,jdbcType=VARCHAR},
      </if>
      <if test="certno != null">
        #{certno,jdbcType=VARCHAR},
      </if>
      <if test="certname != null">
        #{certname,jdbcType=VARCHAR},
      </if>
      <if test="certstarttime != null">
        #{certstarttime,jdbcType=VARCHAR},
      </if>
      <if test="certendtime != null">
        #{certendtime,jdbcType=VARCHAR},
      </if>
      <if test="certaddress != null">
        #{certaddress,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null">
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="imgpositive != null">
        #{imgpositive,jdbcType=VARCHAR},
      </if>
      <if test="imgnegative != null">
        #{imgnegative,jdbcType=VARCHAR},
      </if>
      <if test="virtypeflag != null">
        #{virtypeflag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussIdCard">
    update tb_pluss_id_card
    <set>
      <if test="userid != null">
        userId = #{userid,jdbcType=INTEGER},
      </if>
      <if test="usertype != null">
        userType = #{usertype,jdbcType=VARCHAR},
      </if>
      <if test="certtype != null">
        certType = #{certtype,jdbcType=VARCHAR},
      </if>
      <if test="certno != null">
        certNo = #{certno,jdbcType=VARCHAR},
      </if>
      <if test="certname != null">
        certName = #{certname,jdbcType=VARCHAR},
      </if>
      <if test="certstarttime != null">
        certStartTime = #{certstarttime,jdbcType=VARCHAR},
      </if>
      <if test="certendtime != null">
        certEndTime = #{certendtime,jdbcType=VARCHAR},
      </if>
      <if test="certaddress != null">
        certAddress = #{certaddress,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        createTime = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null">
        updateTime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="imgpositive != null">
        imgPositive = #{imgpositive,jdbcType=VARCHAR},
      </if>
      <if test="imgnegative != null">
        imgNegative = #{imgnegative,jdbcType=VARCHAR},
      </if>
      <if test="virtypeflag != null">
        virTypeFlag = #{virtypeflag,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussIdCard">
    update tb_pluss_id_card
    set userId = #{userid,jdbcType=INTEGER},
      userType = #{usertype,jdbcType=VARCHAR},
      certType = #{certtype,jdbcType=VARCHAR},
      certNo = #{certno,jdbcType=VARCHAR},
      certName = #{certname,jdbcType=VARCHAR},
      certStartTime = #{certstarttime,jdbcType=VARCHAR},
      certEndTime = #{certendtime,jdbcType=VARCHAR},
      certAddress = #{certaddress,jdbcType=VARCHAR},
      createTime = #{createtime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP},
      imgPositive = #{imgpositive,jdbcType=VARCHAR},
      imgNegative = #{imgnegative,jdbcType=VARCHAR},
      virTypeFlag = #{virtypeflag,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>