<?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.jkcredit.invoice.mapper.binvoce.SelfCarApplMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.invoice.SelfCarAppl">
        <id column="id" property="id"/>
        <result column="customId" property="customId"/>
        <result column="companyNum" property="companyNum"/>
        <result column="cardId" property="cardId"/>
        <result column="applId" property="applId"/>
        <result column="invoiceCount" property="invoiceCount"/>
        <result column="invoiceAmount" property="invoiceAmount"/>
        <result column="invoiceTaxAmount" property="invoiceTaxAmount"/>
        <result column="applTime" property="applTime"/>
        <result column="voiceFlag" property="voiceFlag"/>
    </resultMap>

    <sql id="baseSql">
        id,
        customId,
        companyNum,
        cardId,
        applId,
        invoiceCount,
        invoiceAmount,
        invoiceTaxAmount,
        applTime,
        voiceFlag
    </sql>
    <select id="selectAllByPage" resultMap="BaseResultMap">
        select
        <include refid="baseSql" />
        from t_SelfCarAppl ORDER by id desc;
    </select>
    <select id="selectAllNoRec" resultMap="BaseResultMap">
        select
        <include refid="baseSql" />
        from t_SelfCarAppl where voiceFlag = 0
    </select>
    <insert id="insert" parameterType="com.jkcredit.invoice.model.entity.invoice.SelfCarAppl" >
        insert into t_SelfCarAppl (
        customId,
        companyNum,
        cardId,
        applId,
        invoiceCount,
        invoiceAmount,
        invoiceTaxAmount,
        applTime,
        voiceFlag
        )
        values ( #{customId,jdbcType=VARCHAR}, #{companyNum,jdbcType=VARCHAR},
        #{cardId,jdbcType=VARCHAR},#{applId,jdbcType=VARCHAR}, #{invoiceCount,jdbcType=INTEGER},
        #{invoiceAmount,jdbcType=INTEGER},#{invoiceTaxAmount,jdbcType=INTEGER},  #{applTime,jdbcType=VARCHAR},
        #{voiceFlag,jdbcType=INTEGER}
        )
    </insert>
</mapper>
