<?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.tofly.feesapi.dzfp.mapper.EiFpkjMxMapper">
    <!--发票明细查看-->
    <sql id="querySql">
        select mxid,lsbh,goodsName,goodsCode,spectype,num,price,unit,tax,taxRate,taxExcludedAmount,taxIncludedAmount,zeroRateFlag,withTaxFlag,invoiceLineProperty,favouredPolicyFlag,
        (case withTaxFlag
        when '0' then '不含税'
        when '1' then '含税'
        end ) as withTaxFlagMc,
        (case zeroRateFlag
        when '1' then '免税'
        when '2' then '不征税'
        when '3' then '普通零税率'
        else  '非零税率'
        end)  as zeroRateFlagMc,
        (case invoiceLineProperty
        when '0' then '正常行'
        when '1' then '折扣行'
        when '2' then '被折扣行'
        end)  as invoiceLinePropertyMc,
        (case favouredPolicyFlag
        when '0' then '不使用'
        when '1' then '使用'
        when '01' then '简易征收'
        when '03' then '免税'
        when '04' then '不征税'
        when '08' then '按3%简易征收'
        else ''
        end) as favouredPolicyFlagMc,xh
        from ei_fpkj_mx where 1=1
        <!--lsbh-->
        <if test="lsbh!=null">
            AND lsbh=#{lsbh}
        </if>

    </sql>
    <select id="getList" resultType="com.tofly.feesapi.dzfp.entity.dto.EiFpkjMx_select">
        <include refid="querySql"></include>
    </select>
    <resultMap id="eiFpkjMxMap" type="com.tofly.feesapi.dzfp.entity.EiFpkjMx">
        <id property="mxid" column="MXID"/>
        <result property="lsbh" column="LSBH"/>
        <result property="goodsname" column="GOODSNAME"/>
        <result property="goodscode" column="GOODSCODE"/>
        <result property="selfcode" column="SELFCODE"/>
        <result property="withtaxflag" column="WITHTAXFLAG"/>
        <result property="price" column="PRICE"/>
        <result property="num" column="NUM"/>
        <result property="unit" column="UNIT"/>
        <result property="spectype" column="SPECTYPE"/>
        <result property="tax" column="TAX"/>
        <result property="taxrate" column="TAXRATE"/>
        <result property="taxexcludedamount" column="TAXEXCLUDEDAMOUNT"/>
        <result property="taxincludedamount" column="TAXINCLUDEDAMOUNT"/>
        <result property="invoicelineproperty" column="INVOICELINEPROPERTY"/>
        <result property="favouredpolicyflag" column="FAVOUREDPOLICYFLAG"/>
        <result property="favouredpolicyname" column="FAVOUREDPOLICYNAME"/>
        <result property="deduction" column="DEDUCTION"/>
        <result property="zerorateflag" column="ZERORATEFLAG"/>
        <result property="xh" column="XH"/>
    </resultMap>
</mapper>
