<?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.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl">
    <resultMap id="get-CInvoiceImportHEntity-result" type="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
        <result property="id" column="id" />
        <result property="tab_name" column="tab_name" />
        <result property="bill_type" column="bill_type" />
        <result property="bill_code" column="bill_code" />

    </resultMap>

    <select id="entity_list_base" resultMap="get-CInvoiceImportHEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
        select  * from (
        SELECT
        id,
        'formmain_0327' as tab_name,
        '对公付款单' as bill_type,
        field0146 as bill_code
        FROM
        formmain_0327
        WHERE
        finishedflag = 1

        UNION ALL

        SELECT
        id,
        'formmain_0533' as tab_name,
        '差旅费报销单' as bill_type,
        field0094 as bill_code
        FROM
        formmain_0533
        WHERE
        finishedflag = 1
        ) f
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">f.id = #{id}</if>
            <if test="bill_code != null and bill_code != ''">and f.bill_code = #{bill_code}</if>
        </trim>
    </select>
</mapper>
