<?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.brilliance.isc.mda.dao.FeeMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Fee">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="cod" column="cod" jdbcType="VARCHAR"/>
        <result property="sftcod" column="sftcod" jdbcType="VARCHAR"/>
        <result property="rol" column="rol" jdbcType="VARCHAR"/>
        <result property="incflg" column="incflg" jdbcType="VARCHAR"/>
        <result property="staflg" column="staflg" jdbcType="VARCHAR"/>
        <result property="vatflg" column="vatflg" jdbcType="VARCHAR"/>
        <result property="acc" column="acc" jdbcType="VARCHAR"/>
        <result property="accacr" column="accacr" jdbcType="VARCHAR"/>
        <result property="eno" column="eno" jdbcType="VARCHAR"/>
        <result property="reltir" column="reltir" jdbcType="VARCHAR"/>
        <result property="grpcod" column="grpcod" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="dscmodflg" column="dscmodflg" jdbcType="VARCHAR"/>
        <result property="reltrn" column="reltrn" jdbcType="VARCHAR"/>
        <result property="begdat" column="begdat" jdbcType="DATE"/>
        <result property="enddat" column="enddat" jdbcType="DATE"/>
        <result property="dtacod" column="dtacod" jdbcType="VARCHAR"/>
        <result property="etgextkey" column="etgextkey" jdbcType="VARCHAR"/>
        <result property="taxacc" column="taxacc" jdbcType="VARCHAR"/>
        <result property="taxflg" column="taxflg" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,cod,sftcod,rol,incflg,staflg,vatflg,acc,accacr,eno,reltir,grpcod,ver,dscmodflg,reltrn,begdat,enddat,dtacod,etgextkey,taxacc,taxflg,remark
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fee
        where inr = #{inr,jdbcType=VARCHAR}
    </select>

    <select id="selectByCod" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fee
        where cod = #{cod,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByPrimaryKey">
        delete from fee
        where inr = #{inr,jdbcType=VARCHAR}
    </delete>

    <insert id="insert">
        insert into fee (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{cod,jdbcType=VARCHAR},
            #{sftcod,jdbcType=VARCHAR},
            #{rol,jdbcType=VARCHAR},
            #{incflg,jdbcType=VARCHAR},
            #{staflg,jdbcType=VARCHAR},
            #{vatflg,jdbcType=VARCHAR},
            #{acc,jdbcType=VARCHAR},
            #{accacr,jdbcType=VARCHAR},
            #{eno,jdbcType=VARCHAR},
            #{reltir,jdbcType=VARCHAR},
            #{grpcod,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{dscmodflg,jdbcType=VARCHAR},
            #{reltrn,jdbcType=VARCHAR},
            #{begdat,jdbcType=DATE},
            #{enddat,jdbcType=DATE},
            #{dtacod,jdbcType=VARCHAR},
            'CEBGRP',
            #{taxacc,jdbcType=VARCHAR},
            #{taxflg,jdbcType=VARCHAR},
            #{remark,jdbcType=VARCHAR}
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into fee
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="cod != null">cod,</if>
            <if test="sftcod != null">sftcod,</if>
            <if test="rol != null">rol,</if>
            <if test="incflg != null">incflg,</if>
            <if test="staflg != null">staflg,</if>
            <if test="vatflg != null">vatflg,</if>
            <if test="acc != null">acc,</if>
            <if test="accacr != null">accacr,</if>
            <if test="eno != null">eno,</if>
            <if test="reltir != null">reltir,</if>
            <if test="grpcod != null">grpcod,</if>
            <if test="ver != null">ver,</if>
            <if test="dscmodflg != null">dscmodflg,</if>
            <if test="reltrn != null">reltrn,</if>
            <if test="begdat != null">begdat,</if>
            <if test="enddat != null">enddat,</if>
            <if test="dtacod != null">dtacod,</if>
            etgextkey,
            <if test="taxacc != null">taxacc,</if>
            <if test="taxflg != null">taxflg,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR},</if>
            <if test="cod != null">#{cod,jdbcType=VARCHAR},</if>
            <if test="sftcod != null">#{sftcod,jdbcType=VARCHAR},</if>
            <if test="rol != null">#{rol,jdbcType=VARCHAR},</if>
            <if test="incflg != null">#{incflg,jdbcType=VARCHAR},</if>
            <if test="staflg != null">#{staflg,jdbcType=VARCHAR},</if>
            <if test="vatflg != null">#{vatflg,jdbcType=VARCHAR},</if>
            <if test="acc != null">#{acc,jdbcType=VARCHAR},</if>
            <if test="accacr != null">#{accacr,jdbcType=VARCHAR},</if>
            <if test="eno != null">#{eno,jdbcType=VARCHAR},</if>
            <if test="reltir != null">#{reltir,jdbcType=VARCHAR},</if>
            <if test="grpcod != null">#{grpcod,jdbcType=VARCHAR},</if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR},</if>
            <if test="dscmodflg != null">#{dscmodflg,jdbcType=VARCHAR},</if>
            <if test="reltrn != null">#{reltrn,jdbcType=VARCHAR},</if>
            <if test="begdat != null">#{begdat,jdbcType=DATE},</if>
            <if test="enddat != null">#{enddat,jdbcType=DATE},</if>
            <if test="dtacod != null">#{dtacod,jdbcType=VARCHAR},</if>
            'CEBGRP',
            <if test="taxacc != null">#{taxacc,jdbcType=VARCHAR},</if>
            <if test="taxflg != null">#{taxflg,jdbcType=VARCHAR},</if>
            <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update fee
        <set>
            <if test="cod != null">cod = #{cod,jdbcType=VARCHAR},</if>
            <if test="sftcod != null">sftcod = #{sftcod,jdbcType=VARCHAR},</if>
            <if test="rol != null">rol = #{rol,jdbcType=VARCHAR},</if>
            <if test="incflg != null">incflg = #{incflg,jdbcType=VARCHAR},</if>
            <if test="staflg != null">staflg = #{staflg,jdbcType=VARCHAR},</if>
            <if test="vatflg != null">vatflg = #{vatflg,jdbcType=VARCHAR},</if>
            <if test="acc != null">acc = #{acc,jdbcType=VARCHAR},</if>
            <if test="accacr != null">accacr = #{accacr,jdbcType=VARCHAR},</if>
            <if test="eno != null">eno = #{eno,jdbcType=VARCHAR},</if>
            <if test="reltir != null">reltir = #{reltir,jdbcType=VARCHAR},</if>
            <if test="grpcod != null">grpcod = #{grpcod,jdbcType=VARCHAR},</if>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="dscmodflg != null">dscmodflg = #{dscmodflg,jdbcType=VARCHAR},</if>
            <if test="reltrn != null">reltrn = #{reltrn,jdbcType=VARCHAR},</if>
            <if test="begdat != null">begdat = #{begdat,jdbcType=DATE},</if>
            <if test="enddat != null">enddat = #{enddat,jdbcType=DATE},</if>
            <if test="dtacod != null">dtacod = #{dtacod,jdbcType=VARCHAR},</if>
            etgextkey = 'CEBGRP',
            <if test="taxacc != null">taxacc = #{taxacc,jdbcType=VARCHAR},</if>
            <if test="taxflg != null">taxflg = #{taxflg,jdbcType=VARCHAR},</if>
            <if test="remark != null">remark = #{remark,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update fee
        <set>
            cod = #{cod,jdbcType=VARCHAR},
            sftcod = #{sftcod,jdbcType=VARCHAR},
            rol = #{rol,jdbcType=VARCHAR},
            incflg = #{incflg,jdbcType=VARCHAR},
            staflg = #{staflg,jdbcType=VARCHAR},
            vatflg = #{vatflg,jdbcType=VARCHAR},
            acc = #{acc,jdbcType=VARCHAR},
            accacr = #{accacr,jdbcType=VARCHAR},
            eno = #{eno,jdbcType=VARCHAR},
            reltir = #{reltir,jdbcType=VARCHAR},
            grpcod = #{grpcod,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            dscmodflg = #{dscmodflg,jdbcType=VARCHAR},
            reltrn = #{reltrn,jdbcType=VARCHAR},
            begdat = #{begdat,jdbcType=DATE},
            enddat = #{enddat,jdbcType=DATE},
            dtacod = #{dtacod,jdbcType=VARCHAR},
            etgextkey = 'CEBGRP',
            taxacc = #{taxacc,jdbcType=VARCHAR},
            taxflg = #{taxflg,jdbcType=VARCHAR},
            remark = #{remark,jdbcType=VARCHAR},
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <delete id="deleteByIds">
        delete from act where inr in
        <foreach item="item" index="index" collection="collection" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <update id="dyncUpdate">
        update fee
        <set>
            <if test="module.cod != null">cod = #{module.cod,jdbcType=VARCHAR},</if>
            <if test="module.sftcod != null">sftcod = #{module.sftcod,jdbcType=VARCHAR},</if>
            <if test="module.rol != null">rol = #{module.rol,jdbcType=VARCHAR},</if>
            <if test="module.incflg != null">incflg = #{module.incflg,jdbcType=VARCHAR},</if>
            <if test="module.staflg != null">staflg = #{module.staflg,jdbcType=VARCHAR},</if>
            <if test="module.vatflg != null">vatflg = #{module.vatflg,jdbcType=VARCHAR},</if>
            <if test="module.acc != null">acc = #{module.acc,jdbcType=VARCHAR},</if>
            <if test="module.accacr != null">accacr = #{module.accacr,jdbcType=VARCHAR},</if>
            <if test="module.eno != null">eno = #{module.eno,jdbcType=VARCHAR},</if>
            <if test="module.reltir != null">reltir = #{module.reltir,jdbcType=VARCHAR},</if>
            <if test="module.grpcod != null">grpcod = #{module.grpcod,jdbcType=VARCHAR},</if>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.dscmodflg != null">dscmodflg = #{module.dscmodflg,jdbcType=VARCHAR},</if>
            <if test="module.reltrn != null">reltrn = #{module.reltrn,jdbcType=VARCHAR},</if>
            <if test="module.begdat != null">begdat = #{module.begdat,jdbcType=DATE},</if>
            <if test="module.enddat != null">enddat = #{module.enddat,jdbcType=DATE},</if>
            <if test="module.dtacod != null">dtacod = #{module.dtacod,jdbcType=VARCHAR},</if>
            etgextkey = 'CEBGRP',
            <if test="module.taxacc != null">taxacc = #{module.taxacc,jdbcType=VARCHAR},</if>
            <if test="module.taxflg != null">taxflg = #{module.taxflg,jdbcType=VARCHAR},</if>
            <if test="module.remark != null">remark = #{module.remark,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

    <delete id="dyncDelete">
        ${sql}
    </delete>

    <select id="dyncRead" resultMap="BaseResultMap">
        ${sql}
    </select>

    <select id="getAvbfeecod" resultType="string">
        <bind name="pattern1" value="'%'+ shortRecType + '%'"/>
        <bind name="pattern2" value="'%'+ transName + '%'"/>
        SELECT COD FROM FEE WHERE trim(ETGEXTKEY) = #{etgGrp} and ( (RELTRN LIKE #{pattern1} OR RELTRN LIKE #{pattern2} OR RELTRN = '')
        AND ( BEGDAT &lt;= #{date} OR BEGDAT IS NULL ) AND ( ENDDAT > #{date} OR ENDDAT IS NULL ) ) ORDER BY COD
    </select>

    <select id="getFeeByConditionSql" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fee
        ${conditionSql}
    </select>

    <!--查询单个-->
    <select id="queryById" resultMap="BaseResultMap">
        select
          INR, COD, SFTCOD, ROL, INCFLG, STAFLG, VATFLG, ACC, ACCACR, ENO, RELTIR, GRPCOD, VER, DSCMODFLG, RELTRN, BEGDAT, ENDDAT, DTACOD, ETGEXTKEY, TAXACC, TAXFLG, REMARK
        from FEE
        where  INR= #{inr}
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultMap="BaseResultMap">
        select
        INR, COD, SFTCOD, ROL, INCFLG, STAFLG, VATFLG, ACC, ACCACR, ENO, RELTIR, GRPCOD, VER, DSCMODFLG, RELTRN, BEGDAT, ENDDAT, DTACOD, ETGEXTKEY, TAXACC, TAXFLG, REMARK
        from FEE
        <where>
            <if test="entity.cod != null and entity.cod != ''">
                AND COD like concat(concat ('%',#{entity.cod}),'%')
            </if>
        </where>
        ORDER BY COD DESC
    </select>

    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from FEE
        <where>
            <if test="inr != null and inr != ''">
                and INR = #{inr}
            </if>
            <if test="cod != null and cod != ''">
                and COD = #{cod}
            </if>
            <if test="sftcod != null and sftcod != ''">
                and SFTCOD = #{sftcod}
            </if>
            <if test="rol != null and rol != ''">
                and ROL = #{rol}
            </if>
            <if test="incflg != null and incflg != ''">
                and INCFLG = #{incflg}
            </if>
            <if test="staflg != null and staflg != ''">
                and STAFLG = #{staflg}
            </if>
            <if test="vatflg != null and vatflg != ''">
                and VATFLG = #{vatflg}
            </if>
            <if test="acc != null and acc != ''">
                and ACC = #{acc}
            </if>
            <if test="accacr != null and accacr != ''">
                and ACCACR = #{accacr}
            </if>
            <if test="eno != null and eno != ''">
                and ENO = #{eno}
            </if>
            <if test="reltir != null and reltir != ''">
                and RELTIR = #{reltir}
            </if>
            <if test="grpcod != null and grpcod != ''">
                and GRPCOD = #{grpcod}
            </if>
            <if test="ver != null and ver != ''">
                and VER = #{ver}
            </if>
            <if test="dscmodflg != null and dscmodflg != ''">
                and DSCMODFLG = #{dscmodflg}
            </if>
            <if test="reltrn != null and reltrn != ''">
                and RELTRN = #{reltrn}
            </if>
            <if test="begdat != null">
                and BEGDAT = #{begdat}
            </if>
            <if test="enddat != null">
                and ENDDAT = #{enddat}
            </if>
            <if test="dtacod != null and dtacod != ''">
                and DTACOD = #{dtacod}
            </if>
            <if test="etgextkey != null and etgextkey != ''">
                and ETGEXTKEY = 'CEBGRP'
            </if>
            <if test="taxacc != null and taxacc != ''">
                and TAXACC = #{taxacc}
            </if>
            <if test="taxflg != null and taxflg != ''">
                and TAXFLG = #{taxflg}
            </if>
            <if test="remark != null and remark != ''">
                and REMARK = #{remark}
            </if>
        </where>
    </select>

    <!--通过主键修改数据-->
    <update id="update">
        update FEE
        <set>
            <if test="inr != null and inr != ''">
                INR = #{inr},
            </if>
            <if test="cod != null and cod != ''">
                COD = #{cod},
            </if>
            SFTCOD = #{sftcod},
            <if test="rol != null and rol != ''">
                ROL = #{rol},
            </if>
            <if test="incflg != null and incflg != ''">
                INCFLG = #{incflg},
            </if>
            <if test="staflg != null and staflg != ''">
                STAFLG = #{staflg},
            </if>
            <if test="vatflg != null and vatflg != ''">
                VATFLG = #{vatflg},
            </if>
            <if test="acc != null and acc != ''">
                ACC = #{acc},
            </if>
            <if test="accacr != null and accacr != ''">
                ACCACR = #{accacr},
            </if>
            <if test="eno != null and eno != ''">
                ENO = #{eno},
            </if>
            <if test="reltir != null and reltir != ''">
                RELTIR = #{reltir},
            </if>
            <if test="grpcod != null and grpcod != ''">
                GRPCOD = #{grpcod},
            </if>
            <if test="ver != null and ver != ''">
                VER = #{ver},
            </if>
            <if test="dscmodflg != null and dscmodflg != ''">
                DSCMODFLG = #{dscmodflg},
            </if>
            <if test="reltrn != null and reltrn != ''">
                RELTRN = #{reltrn},
            </if>
            <if test="begdat != null">
                BEGDAT = #{begdat},
            </if>
            <if test="enddat != null">
                ENDDAT = #{enddat},
            </if>
            DTACOD = #{dtacod},
            ETGEXTKEY = 'CEBGRP',
            TAXACC = #{taxacc},
            <if test="taxflg != null and taxflg != ''">
                TAXFLG = #{taxflg},
            </if>
            <if test="remark != null and remark != ''">
                REMARK = #{remark},
            </if>
        </set>
        where  INR= #{inr}
    </update>

    <!--通过主键删除-->
    <delete id="deleteById">
        delete from FEE where  INR= #{inr}
    </delete>

    <select id="queryCod" resultType="int">
        select count(1) from FEE where COD = #{cod}
    </select>

</mapper>