<?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.xhpc.card.mapper.TIccardUsersMapper">
    <resultMap id="BaseResultMap" type="com.xhpc.card.pojo.TIccardUsers">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="userName" jdbcType="VARCHAR" property="username"/>
        <result column="userAge" jdbcType="TINYINT" property="userage"/>
        <result column="userSex" jdbcType="TINYINT" property="usersex"/>
        <result column="idNumber" jdbcType="VARCHAR" property="idnumber"/>
        <result column="phone" jdbcType="VARCHAR" property="phone"/>
        <result column="licencePlate" jdbcType="VARCHAR" property="licenceplate"/>
        <result column="createTime" jdbcType="TIMESTAMP" property="createtime"/>
        <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , userName, userAge, userSex, idNumber, phone, licencePlate, createTime, tenant_id
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_iccard_users
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from t_iccard_users
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xhpc.card.pojo.TIccardUsers"
            useGeneratedKeys="true">
        insert into t_iccard_users (userName, userAge, userSex,
                                    idNumber, phone, licencePlate,
                                    createTime, tenant_id)
        values (#{username,jdbcType=VARCHAR}, #{userage,jdbcType=TINYINT}, #{usersex,jdbcType=TINYINT},
                #{idnumber,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{licenceplate,jdbcType=VARCHAR},
                #{createtime,jdbcType=TIMESTAMP}, #{tenantId,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xhpc.card.pojo.TIccardUsers"
            useGeneratedKeys="true">
        insert into t_iccard_users
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="username != null">
                userName,
            </if>
            <if test="userage != null">
                userAge,
            </if>
            <if test="usersex != null">
                userSex,
            </if>
            <if test="idnumber != null">
                idNumber,
            </if>
            <if test="phone != null">
                phone,
            </if>
            <if test="licenceplate != null">
                licencePlate,
            </if>
            <if test="createtime != null">
                createTime,
            </if>
            <if test="tenantId != null">
                tenant_id,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="username != null">
                #{username,jdbcType=VARCHAR},
            </if>
            <if test="userage != null">
                #{userage,jdbcType=TINYINT},
            </if>
            <if test="usersex != null">
                #{usersex,jdbcType=TINYINT},
            </if>
            <if test="idnumber != null">
                #{idnumber,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
                #{phone,jdbcType=VARCHAR},
            </if>
            <if test="licenceplate != null">
                #{licenceplate,jdbcType=VARCHAR},
            </if>
            <if test="createtime != null">
                #{createtime,jdbcType=TIMESTAMP},
            </if>
            <if test="tenantId != null">
                #{tenantId,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.xhpc.card.pojo.TIccardUsers">
        update t_iccard_users
        <set>
            <if test="username != null">
                userName = #{username,jdbcType=VARCHAR},
            </if>
            <if test="userage != null">
                userAge = #{userage,jdbcType=TINYINT},
            </if>
            <if test="usersex != null">
                userSex = #{usersex,jdbcType=TINYINT},
            </if>
            <if test="idnumber != null">
                idNumber = #{idnumber,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
                phone = #{phone,jdbcType=VARCHAR},
            </if>
            <if test="licenceplate != null">
                licencePlate = #{licenceplate,jdbcType=VARCHAR},
            </if>
            <if test="createtime != null">
                createTime = #{createtime,jdbcType=TIMESTAMP},
            </if>
            <if test="tenantId != null">
                tenant_id = #{tenantId,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.xhpc.card.pojo.TIccardUsers">
        update t_iccard_users
        set userName     = #{username,jdbcType=VARCHAR},
            userAge      = #{userage,jdbcType=TINYINT},
            userSex      = #{usersex,jdbcType=TINYINT},
            idNumber     = #{idnumber,jdbcType=VARCHAR},
            phone        = #{phone,jdbcType=VARCHAR},
            licencePlate = #{licenceplate,jdbcType=VARCHAR},
            createTime   = #{createtime,jdbcType=TIMESTAMP},
            tenant_id    = #{tenantId,jdbcType=VARCHAR}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>