<?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">
<!--suppress ALL -->
<mapper namespace="com.xhpc.card.mapper.TIccardInfoMapper">
    <resultMap id="BaseResultMap" type="com.xhpc.card.pojo.TIccardInfo">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="cardID" jdbcType="VARCHAR" property="cardid"/>
        <result column="cardNo" jdbcType="VARCHAR" property="cardno"/>
        <result column="is_platform" jdbcType="TINYINT" property="isPlatform"/>
        <result column="cardType" jdbcType="TINYINT" property="cardtype"/>
        <result column="userIndex" jdbcType="INTEGER" property="userindex"/>
        <result column="password" jdbcType="VARCHAR" property="password"/>
        <result column="corpNo" jdbcType="VARCHAR" property="corpno"/>
        <result column="cashPledge" jdbcType="INTEGER" property="cashpledge"/>
        <result column="balance" jdbcType="INTEGER" property="balance"/>
        <result column="status" jdbcType="TINYINT" property="status"/>
        <result column="createTime" jdbcType="TIMESTAMP" property="createtime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , cardID, cardNo, is_platform, cardType, userIndex, `password`, corpNo, cashPledge,
    balance, `status`, createTime
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_iccard_info
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="selectAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_iccard_info
    </select>
    <select id="selectAllBy" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_iccard_info
        <where>
            <if test="cardSerialNumber != null and cardSerialNumber != '' ">
                and cardId = #{cardSerialNumber},
            </if>
            <if test="cardPhysicalNumber != null cardPhysicalNumber !='' ">
                and cardNo = #{cardPhysicalNumber},
            </if>
            <if test="grantOperator != null">
                and cardID = #{grantOperator},
            </if>
            <if test="cardSerialNumber != null">
                and cardID = #{cardSerialNumber},
            </if>
            <if test="userindex != null">
                userIndex,
            </if>
        </where>
        limit #{currentPage},#{items}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from t_iccard_info
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xhpc.card.pojo.TIccardInfo"
            useGeneratedKeys="true">
        insert into t_iccard_info (cardID, cardNo, is_platform,
                                   cardType, userIndex, `password`,
                                   corpNo, cashPledge, balance,
                                   `status`, createTime)
        values (#{cardid,jdbcType=VARCHAR}, #{cardno,jdbcType=VARCHAR}, #{isPlatform,jdbcType=TINYINT},
                #{cardtype,jdbcType=TINYINT}, #{userindex,jdbcType=INTEGER}, #{password,jdbcType=VARCHAR},
                #{corpno,jdbcType=VARCHAR}, #{cashpledge,jdbcType=INTEGER}, #{balance,jdbcType=INTEGER},
                #{status,jdbcType=TINYINT}, #{createtime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xhpc.card.pojo.TIccardInfo"
            useGeneratedKeys="true">
        insert into t_iccard_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="cardid != null">
                cardID,
            </if>
            <if test="cardno != null">
                cardNo,
            </if>
            <if test="isPlatform != null">
                is_platform,
            </if>
            <if test="cardtype != null">
                cardType,
            </if>
            <if test="userindex != null">
                userIndex,
            </if>
            <if test="password != null">
                `password`,
            </if>
            <if test="corpno != null">
                corpNo,
            </if>
            <if test="cashpledge != null">
                cashPledge,
            </if>
            <if test="balance != null">
                balance,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="createtime != null">
                createTime,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="cardid != null">
                #{cardid,jdbcType=VARCHAR},
            </if>
            <if test="cardno != null">
                #{cardno,jdbcType=VARCHAR},
            </if>
            <if test="isPlatform != null">
                #{isPlatform,jdbcType=TINYINT},
            </if>
            <if test="cardtype != null">
                #{cardtype,jdbcType=TINYINT},
            </if>
            <if test="userindex != null">
                #{userindex,jdbcType=INTEGER},
            </if>
            <if test="password != null">
                #{password,jdbcType=VARCHAR},
            </if>
            <if test="corpno != null">
                #{corpno,jdbcType=VARCHAR},
            </if>
            <if test="cashpledge != null">
                #{cashpledge,jdbcType=INTEGER},
            </if>
            <if test="balance != null">
                #{balance,jdbcType=INTEGER},
            </if>
            <if test="status != null">
                #{status,jdbcType=TINYINT},
            </if>
            <if test="createtime != null">
                #{createtime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.xhpc.card.pojo.TIccardInfo">
        update t_iccard_info
        <set>
            <if test="cardid != null">
                cardID = #{cardid,jdbcType=VARCHAR},
            </if>
            <if test="cardno != null">
                cardNo = #{cardno,jdbcType=VARCHAR},
            </if>
            <if test="isPlatform != null">
                is_platform = #{isPlatform,jdbcType=TINYINT},
            </if>
            <if test="cardtype != null">
                cardType = #{cardtype,jdbcType=TINYINT},
            </if>
            <if test="userindex != null">
                userIndex = #{userindex,jdbcType=INTEGER},
            </if>
            <if test="password != null">
                `password` = #{password,jdbcType=VARCHAR},
            </if>
            <if test="corpno != null">
                corpNo = #{corpno,jdbcType=VARCHAR},
            </if>
            <if test="cashpledge != null">
                cashPledge = #{cashpledge,jdbcType=INTEGER},
            </if>
            <if test="balance != null">
                balance = #{balance,jdbcType=INTEGER},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=TINYINT},
            </if>
            <if test="createtime != null">
                createTime = #{createtime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.xhpc.card.pojo.TIccardInfo">
        update t_iccard_info
        set cardID      = #{cardid,jdbcType=VARCHAR},
            cardNo      = #{cardno,jdbcType=VARCHAR},
            is_platform = #{isPlatform,jdbcType=TINYINT},
            cardType    = #{cardtype,jdbcType=TINYINT},
            userIndex   = #{userindex,jdbcType=INTEGER},
            `password`  = #{password,jdbcType=VARCHAR},
            corpNo      = #{corpno,jdbcType=VARCHAR},
            cashPledge  = #{cashpledge,jdbcType=INTEGER},
            balance     = #{balance,jdbcType=INTEGER},
            `status`    = #{status,jdbcType=TINYINT},
            createTime  = #{createtime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>