<?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.lets.dao.impl.IaMonthledgerDaoImpl">

    <resultMap id="get-IaMonthledgerEntity-result" type="com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity" >
       <result property="btryflag" column="BTRYFLAG" jdbcType="VARCHAR"/>
           <result property="caccountmonth" column="CACCOUNTMONTH" jdbcType="VARCHAR"/>
           <result property="caccountyear" column="CACCOUNTYEAR" jdbcType="VARCHAR"/>
           <result property="cinventoryid" column="CINVENTORYID" jdbcType="VARCHAR"/>
           <result property="cmonthledgerid" column="CMONTHLEDGERID" jdbcType="VARCHAR"/>
           <result property="crdcenterid" column="CRDCENTERID" jdbcType="VARCHAR"/>
           <result property="cvendorid" column="CVENDORID" jdbcType="VARCHAR"/>
           <result property="dr" column="DR" jdbcType="VARCHAR"/>
           <result property="fpricemodeflag" column="FPRICEMODEFLAG" jdbcType="VARCHAR"/>
           <result property="frecordtypeflag" column="FRECORDTYPEFLAG" jdbcType="VARCHAR"/>
           <result property="nabmny" column="NABMNY" jdbcType="VARCHAR"/>
           <result property="nabnum" column="NABNUM" jdbcType="VARCHAR"/>
           <result property="nabprice" column="NABPRICE" jdbcType="VARCHAR"/>
           <result property="nabvarymny" column="NABVARYMNY" jdbcType="VARCHAR"/>
           <result property="ninmny" column="NINMNY" jdbcType="VARCHAR"/>
           <result property="ninnum" column="NINNUM" jdbcType="VARCHAR"/>
           <result property="ninvarymny" column="NINVARYMNY" jdbcType="VARCHAR"/>
           <result property="nmonthprice" column="NMONTHPRICE" jdbcType="VARCHAR"/>
           <result property="noutmny" column="NOUTMNY" jdbcType="VARCHAR"/>
           <result property="noutnum" column="NOUTNUM" jdbcType="VARCHAR"/>
           <result property="noutvarymny" column="NOUTVARYMNY" jdbcType="VARCHAR"/>
           <result property="nplanedprice" column="NPLANEDPRICE" jdbcType="VARCHAR"/>
           <result property="nvariancerate" column="NVARIANCERATE" jdbcType="VARCHAR"/>
           <result property="pkCorp" column="PK_CORP" jdbcType="VARCHAR"/>
           <result property="ts" column="TS" jdbcType="VARCHAR"/>
           <result property="vbatch" column="VBATCH" jdbcType="VARCHAR"/>
           <result property="vfree1" column="VFREE1" jdbcType="VARCHAR"/>
           <result property="vfree10" column="VFREE10" jdbcType="VARCHAR"/>
           <result property="vfree2" column="VFREE2" jdbcType="VARCHAR"/>
           <result property="vfree3" column="VFREE3" jdbcType="VARCHAR"/>
           <result property="vfree4" column="VFREE4" jdbcType="VARCHAR"/>
           <result property="vfree5" column="VFREE5" jdbcType="VARCHAR"/>
           <result property="vfree6" column="VFREE6" jdbcType="VARCHAR"/>
           <result property="vfree7" column="VFREE7" jdbcType="VARCHAR"/>
           <result property="vfree8" column="VFREE8" jdbcType="VARCHAR"/>
           <result property="vfree9" column="VFREE9" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "IaMonthledgerEntity_Base_Column_List">
        BTRYFLAG
       ,CACCOUNTMONTH 
        ,CACCOUNTYEAR 
        ,CINVENTORYID 
        ,CMONTHLEDGERID 
        ,CRDCENTERID 
        ,CVENDORID 
        ,DR 
        ,FPRICEMODEFLAG 
        ,FRECORDTYPEFLAG 
        ,NABMNY 
        ,NABNUM 
        ,NABPRICE 
        ,NABVARYMNY 
        ,NINMNY 
        ,NINNUM 
        ,NINVARYMNY 
        ,NMONTHPRICE 
        ,NOUTMNY 
        ,NOUTNUM 
        ,NOUTVARYMNY 
        ,NPLANEDPRICE 
        ,NVARIANCERATE 
        ,PK_CORP 
        ,TS 
        ,VBATCH 
        ,VFREE1 
        ,VFREE10 
        ,VFREE2 
        ,VFREE3 
        ,VFREE4 
        ,VFREE5 
        ,VFREE6 
        ,VFREE7 
        ,VFREE8 
        ,VFREE9 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-IaMonthledgerEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity">
    select
    <include refid="IaMonthledgerEntity_Base_Column_List" />
    from IA_MONTHLEDGER
    <trim prefix="where" prefixOverrides="and"> 
        <if test="btryflag != null and btryflag != ''"> and BTRYFLAG = #{btryflag} </if>
            <if test="caccountmonth != null and caccountmonth != ''"> and CACCOUNTMONTH = #{caccountmonth} </if>
            <if test="caccountyear != null and caccountyear != ''"> and CACCOUNTYEAR = #{caccountyear} </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and CINVENTORYID = #{cinventoryid} </if>
            <if test="cmonthledgerid != null and cmonthledgerid != ''"> and CMONTHLEDGERID = #{cmonthledgerid} </if>
            <if test="crdcenterid != null and crdcenterid != ''"> and CRDCENTERID = #{crdcenterid} </if>
            <if test="cvendorid != null and cvendorid != ''"> and CVENDORID = #{cvendorid} </if>
            <if test="dr != null and dr != ''"> and DR = #{dr} </if>
            <if test="fpricemodeflag != null and fpricemodeflag != ''"> and FPRICEMODEFLAG = #{fpricemodeflag} </if>
            <if test="frecordtypeflag != null and frecordtypeflag != ''"> and FRECORDTYPEFLAG = #{frecordtypeflag} </if>
            <if test="nabmny != null and nabmny != ''"> and NABMNY = #{nabmny} </if>
            <if test="nabnum != null and nabnum != ''"> and NABNUM = #{nabnum} </if>
            <if test="nabprice != null and nabprice != ''"> and NABPRICE = #{nabprice} </if>
            <if test="nabvarymny != null and nabvarymny != ''"> and NABVARYMNY = #{nabvarymny} </if>
            <if test="ninmny != null and ninmny != ''"> and NINMNY = #{ninmny} </if>
            <if test="ninnum != null and ninnum != ''"> and NINNUM = #{ninnum} </if>
            <if test="ninvarymny != null and ninvarymny != ''"> and NINVARYMNY = #{ninvarymny} </if>
            <if test="nmonthprice != null and nmonthprice != ''"> and NMONTHPRICE = #{nmonthprice} </if>
            <if test="noutmny != null and noutmny != ''"> and NOUTMNY = #{noutmny} </if>
            <if test="noutnum != null and noutnum != ''"> and NOUTNUM = #{noutnum} </if>
            <if test="noutvarymny != null and noutvarymny != ''"> and NOUTVARYMNY = #{noutvarymny} </if>
            <if test="nplanedprice != null and nplanedprice != ''"> and NPLANEDPRICE = #{nplanedprice} </if>
            <if test="nvariancerate != null and nvariancerate != ''"> and NVARIANCERATE = #{nvariancerate} </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
            <if test="ts != null and ts != ''"> and TS = #{ts} </if>
            <if test="vbatch != null and vbatch != ''"> and VBATCH = #{vbatch} </if>
            <if test="vfree1 != null and vfree1 != ''"> and VFREE1 = #{vfree1} </if>
            <if test="vfree10 != null and vfree10 != ''"> and VFREE10 = #{vfree10} </if>
            <if test="vfree2 != null and vfree2 != ''"> and VFREE2 = #{vfree2} </if>
            <if test="vfree3 != null and vfree3 != ''"> and VFREE3 = #{vfree3} </if>
            <if test="vfree4 != null and vfree4 != ''"> and VFREE4 = #{vfree4} </if>
            <if test="vfree5 != null and vfree5 != ''"> and VFREE5 = #{vfree5} </if>
            <if test="vfree6 != null and vfree6 != ''"> and VFREE6 = #{vfree6} </if>
            <if test="vfree7 != null and vfree7 != ''"> and VFREE7 = #{vfree7} </if>
            <if test="vfree8 != null and vfree8 != ''"> and VFREE8 = #{vfree8} </if>
            <if test="vfree9 != null and vfree9 != ''"> and VFREE9 = #{vfree9} </if>
        ORDER BY TS DESC
    </trim>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity">
        select  count(1)   from IA_MONTHLEDGER
    <trim prefix="where" prefixOverrides="and"> 
        <if test="btryflag != null and btryflag != ''"> and BTRYFLAG = #{btryflag} </if>
            <if test="caccountmonth != null and caccountmonth != ''"> and CACCOUNTMONTH = #{caccountmonth} </if>
            <if test="caccountyear != null and caccountyear != ''"> and CACCOUNTYEAR = #{caccountyear} </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and CINVENTORYID = #{cinventoryid} </if>
            <if test="cmonthledgerid != null and cmonthledgerid != ''"> and CMONTHLEDGERID = #{cmonthledgerid} </if>
            <if test="crdcenterid != null and crdcenterid != ''"> and CRDCENTERID = #{crdcenterid} </if>
            <if test="cvendorid != null and cvendorid != ''"> and CVENDORID = #{cvendorid} </if>
            <if test="dr != null and dr != ''"> and DR = #{dr} </if>
            <if test="fpricemodeflag != null and fpricemodeflag != ''"> and FPRICEMODEFLAG = #{fpricemodeflag} </if>
            <if test="frecordtypeflag != null and frecordtypeflag != ''"> and FRECORDTYPEFLAG = #{frecordtypeflag} </if>
            <if test="nabmny != null and nabmny != ''"> and NABMNY = #{nabmny} </if>
            <if test="nabnum != null and nabnum != ''"> and NABNUM = #{nabnum} </if>
            <if test="nabprice != null and nabprice != ''"> and NABPRICE = #{nabprice} </if>
            <if test="nabvarymny != null and nabvarymny != ''"> and NABVARYMNY = #{nabvarymny} </if>
            <if test="ninmny != null and ninmny != ''"> and NINMNY = #{ninmny} </if>
            <if test="ninnum != null and ninnum != ''"> and NINNUM = #{ninnum} </if>
            <if test="ninvarymny != null and ninvarymny != ''"> and NINVARYMNY = #{ninvarymny} </if>
            <if test="nmonthprice != null and nmonthprice != ''"> and NMONTHPRICE = #{nmonthprice} </if>
            <if test="noutmny != null and noutmny != ''"> and NOUTMNY = #{noutmny} </if>
            <if test="noutnum != null and noutnum != ''"> and NOUTNUM = #{noutnum} </if>
            <if test="noutvarymny != null and noutvarymny != ''"> and NOUTVARYMNY = #{noutvarymny} </if>
            <if test="nplanedprice != null and nplanedprice != ''"> and NPLANEDPRICE = #{nplanedprice} </if>
            <if test="nvariancerate != null and nvariancerate != ''"> and NVARIANCERATE = #{nvariancerate} </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
            <if test="ts != null and ts != ''"> and TS = #{ts} </if>
            <if test="vbatch != null and vbatch != ''"> and VBATCH = #{vbatch} </if>
            <if test="vfree1 != null and vfree1 != ''"> and VFREE1 = #{vfree1} </if>
            <if test="vfree10 != null and vfree10 != ''"> and VFREE10 = #{vfree10} </if>
            <if test="vfree2 != null and vfree2 != ''"> and VFREE2 = #{vfree2} </if>
            <if test="vfree3 != null and vfree3 != ''"> and VFREE3 = #{vfree3} </if>
            <if test="vfree4 != null and vfree4 != ''"> and VFREE4 = #{vfree4} </if>
            <if test="vfree5 != null and vfree5 != ''"> and VFREE5 = #{vfree5} </if>
            <if test="vfree6 != null and vfree6 != ''"> and VFREE6 = #{vfree6} </if>
            <if test="vfree7 != null and vfree7 != ''"> and VFREE7 = #{vfree7} </if>
            <if test="vfree8 != null and vfree8 != ''"> and VFREE8 = #{vfree8} </if>
            <if test="vfree9 != null and vfree9 != ''"> and VFREE9 = #{vfree9} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-IaMonthledgerEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity">
    select
    <include refid="IaMonthledgerEntity_Base_Column_List" />
    from IA_MONTHLEDGER
    <trim prefix="where" prefixOverrides="and"> 
        <if test="btryflag != null and btryflag != ''"> and BTRYFLAG like concat('%',#{btryflag},'%') </if>
            <if test="caccountmonth != null and caccountmonth != ''"> and CACCOUNTMONTH like concat('%',#{caccountmonth},'%') </if>
            <if test="caccountyear != null and caccountyear != ''"> and CACCOUNTYEAR like concat('%',#{caccountyear},'%') </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and CINVENTORYID like concat('%',#{cinventoryid},'%') </if>
            <if test="cmonthledgerid != null and cmonthledgerid != ''"> and CMONTHLEDGERID like concat('%',#{cmonthledgerid},'%') </if>
            <if test="crdcenterid != null and crdcenterid != ''"> and CRDCENTERID like concat('%',#{crdcenterid},'%') </if>
            <if test="cvendorid != null and cvendorid != ''"> and CVENDORID like concat('%',#{cvendorid},'%') </if>
            <if test="dr != null and dr != ''"> and DR like concat('%',#{dr},'%') </if>
            <if test="fpricemodeflag != null and fpricemodeflag != ''"> and FPRICEMODEFLAG like concat('%',#{fpricemodeflag},'%') </if>
            <if test="frecordtypeflag != null and frecordtypeflag != ''"> and FRECORDTYPEFLAG like concat('%',#{frecordtypeflag},'%') </if>
            <if test="nabmny != null and nabmny != ''"> and NABMNY like concat('%',#{nabmny},'%') </if>
            <if test="nabnum != null and nabnum != ''"> and NABNUM like concat('%',#{nabnum},'%') </if>
            <if test="nabprice != null and nabprice != ''"> and NABPRICE like concat('%',#{nabprice},'%') </if>
            <if test="nabvarymny != null and nabvarymny != ''"> and NABVARYMNY like concat('%',#{nabvarymny},'%') </if>
            <if test="ninmny != null and ninmny != ''"> and NINMNY like concat('%',#{ninmny},'%') </if>
            <if test="ninnum != null and ninnum != ''"> and NINNUM like concat('%',#{ninnum},'%') </if>
            <if test="ninvarymny != null and ninvarymny != ''"> and NINVARYMNY like concat('%',#{ninvarymny},'%') </if>
            <if test="nmonthprice != null and nmonthprice != ''"> and NMONTHPRICE like concat('%',#{nmonthprice},'%') </if>
            <if test="noutmny != null and noutmny != ''"> and NOUTMNY like concat('%',#{noutmny},'%') </if>
            <if test="noutnum != null and noutnum != ''"> and NOUTNUM like concat('%',#{noutnum},'%') </if>
            <if test="noutvarymny != null and noutvarymny != ''"> and NOUTVARYMNY like concat('%',#{noutvarymny},'%') </if>
            <if test="nplanedprice != null and nplanedprice != ''"> and NPLANEDPRICE like concat('%',#{nplanedprice},'%') </if>
            <if test="nvariancerate != null and nvariancerate != ''"> and NVARIANCERATE like concat('%',#{nvariancerate},'%') </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP like concat('%',#{pkCorp},'%') </if>
            <if test="ts != null and ts != ''"> and TS like concat('%',#{ts},'%') </if>
            <if test="vbatch != null and vbatch != ''"> and VBATCH like concat('%',#{vbatch},'%') </if>
            <if test="vfree1 != null and vfree1 != ''"> and VFREE1 like concat('%',#{vfree1},'%') </if>
            <if test="vfree10 != null and vfree10 != ''"> and VFREE10 like concat('%',#{vfree10},'%') </if>
            <if test="vfree2 != null and vfree2 != ''"> and VFREE2 like concat('%',#{vfree2},'%') </if>
            <if test="vfree3 != null and vfree3 != ''"> and VFREE3 like concat('%',#{vfree3},'%') </if>
            <if test="vfree4 != null and vfree4 != ''"> and VFREE4 like concat('%',#{vfree4},'%') </if>
            <if test="vfree5 != null and vfree5 != ''"> and VFREE5 like concat('%',#{vfree5},'%') </if>
            <if test="vfree6 != null and vfree6 != ''"> and VFREE6 like concat('%',#{vfree6},'%') </if>
            <if test="vfree7 != null and vfree7 != ''"> and VFREE7 like concat('%',#{vfree7},'%') </if>
            <if test="vfree8 != null and vfree8 != ''"> and VFREE8 like concat('%',#{vfree8},'%') </if>
            <if test="vfree9 != null and vfree9 != ''"> and VFREE9 like concat('%',#{vfree9},'%') </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="IaMonthledgerentity_list_or" resultMap="get-IaMonthledgerEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity">
    select
    <include refid="IaMonthledgerEntity_Base_Column_List" />
    from IA_MONTHLEDGER
    <trim prefix="where" prefixOverrides="and"> 
         <if test="btryflag != null and btryflag != ''"> or BTRYFLAG = #{btryflag} </if>
             <if test="caccountmonth != null and caccountmonth != ''"> or CACCOUNTMONTH = #{caccountmonth} </if>
             <if test="caccountyear != null and caccountyear != ''"> or CACCOUNTYEAR = #{caccountyear} </if>
             <if test="cinventoryid != null and cinventoryid != ''"> or CINVENTORYID = #{cinventoryid} </if>
             <if test="cmonthledgerid != null and cmonthledgerid != ''"> or CMONTHLEDGERID = #{cmonthledgerid} </if>
             <if test="crdcenterid != null and crdcenterid != ''"> or CRDCENTERID = #{crdcenterid} </if>
             <if test="cvendorid != null and cvendorid != ''"> or CVENDORID = #{cvendorid} </if>
             <if test="dr != null and dr != ''"> or DR = #{dr} </if>
             <if test="fpricemodeflag != null and fpricemodeflag != ''"> or FPRICEMODEFLAG = #{fpricemodeflag} </if>
             <if test="frecordtypeflag != null and frecordtypeflag != ''"> or FRECORDTYPEFLAG = #{frecordtypeflag} </if>
             <if test="nabmny != null and nabmny != ''"> or NABMNY = #{nabmny} </if>
             <if test="nabnum != null and nabnum != ''"> or NABNUM = #{nabnum} </if>
             <if test="nabprice != null and nabprice != ''"> or NABPRICE = #{nabprice} </if>
             <if test="nabvarymny != null and nabvarymny != ''"> or NABVARYMNY = #{nabvarymny} </if>
             <if test="ninmny != null and ninmny != ''"> or NINMNY = #{ninmny} </if>
             <if test="ninnum != null and ninnum != ''"> or NINNUM = #{ninnum} </if>
             <if test="ninvarymny != null and ninvarymny != ''"> or NINVARYMNY = #{ninvarymny} </if>
             <if test="nmonthprice != null and nmonthprice != ''"> or NMONTHPRICE = #{nmonthprice} </if>
             <if test="noutmny != null and noutmny != ''"> or NOUTMNY = #{noutmny} </if>
             <if test="noutnum != null and noutnum != ''"> or NOUTNUM = #{noutnum} </if>
             <if test="noutvarymny != null and noutvarymny != ''"> or NOUTVARYMNY = #{noutvarymny} </if>
             <if test="nplanedprice != null and nplanedprice != ''"> or NPLANEDPRICE = #{nplanedprice} </if>
             <if test="nvariancerate != null and nvariancerate != ''"> or NVARIANCERATE = #{nvariancerate} </if>
             <if test="pkCorp != null and pkCorp != ''"> or PK_CORP = #{pkCorp} </if>
             <if test="ts != null and ts != ''"> or TS = #{ts} </if>
             <if test="vbatch != null and vbatch != ''"> or VBATCH = #{vbatch} </if>
             <if test="vfree1 != null and vfree1 != ''"> or VFREE1 = #{vfree1} </if>
             <if test="vfree10 != null and vfree10 != ''"> or VFREE10 = #{vfree10} </if>
             <if test="vfree2 != null and vfree2 != ''"> or VFREE2 = #{vfree2} </if>
             <if test="vfree3 != null and vfree3 != ''"> or VFREE3 = #{vfree3} </if>
             <if test="vfree4 != null and vfree4 != ''"> or VFREE4 = #{vfree4} </if>
             <if test="vfree5 != null and vfree5 != ''"> or VFREE5 = #{vfree5} </if>
             <if test="vfree6 != null and vfree6 != ''"> or VFREE6 = #{vfree6} </if>
             <if test="vfree7 != null and vfree7 != ''"> or VFREE7 = #{vfree7} </if>
             <if test="vfree8 != null and vfree8 != ''"> or VFREE8 = #{vfree8} </if>
             <if test="vfree9 != null and vfree9 != ''"> or VFREE9 = #{vfree9} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString()  "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity" keyProperty="cmonthledgerid" useGeneratedKeys="true">
    insert into IA_MONTHLEDGER(
  <trim suffix="" suffixOverrides=",">
       <if test="btryflag != null and btryflag != ''"> BTRYFLAG , </if>
            <if test="caccountmonth != null and caccountmonth != ''"> CACCOUNTMONTH , </if>
            <if test="caccountyear != null and caccountyear != ''"> CACCOUNTYEAR , </if>
            <if test="cinventoryid != null and cinventoryid != ''"> CINVENTORYID , </if>
            <if test="cmonthledgerid != null and cmonthledgerid != ''"> CMONTHLEDGERID , </if>
            <if test="crdcenterid != null and crdcenterid != ''"> CRDCENTERID , </if>
            <if test="cvendorid != null and cvendorid != ''"> CVENDORID , </if>
            <if test="dr != null and dr != ''"> DR , </if>
            <if test="fpricemodeflag != null and fpricemodeflag != ''"> FPRICEMODEFLAG , </if>
            <if test="frecordtypeflag != null and frecordtypeflag != ''"> FRECORDTYPEFLAG , </if>
            <if test="nabmny != null and nabmny != ''"> NABMNY , </if>
            <if test="nabnum != null and nabnum != ''"> NABNUM , </if>
            <if test="nabprice != null and nabprice != ''"> NABPRICE , </if>
            <if test="nabvarymny != null and nabvarymny != ''"> NABVARYMNY , </if>
            <if test="ninmny != null and ninmny != ''"> NINMNY , </if>
            <if test="ninnum != null and ninnum != ''"> NINNUM , </if>
            <if test="ninvarymny != null and ninvarymny != ''"> NINVARYMNY , </if>
            <if test="nmonthprice != null and nmonthprice != ''"> NMONTHPRICE , </if>
            <if test="noutmny != null and noutmny != ''"> NOUTMNY , </if>
            <if test="noutnum != null and noutnum != ''"> NOUTNUM , </if>
            <if test="noutvarymny != null and noutvarymny != ''"> NOUTVARYMNY , </if>
            <if test="nplanedprice != null and nplanedprice != ''"> NPLANEDPRICE , </if>
            <if test="nvariancerate != null and nvariancerate != ''"> NVARIANCERATE , </if>
            <if test="pkCorp != null and pkCorp != ''"> PK_CORP , </if>
            <if test="ts != null and ts != ''"> TS , </if>
            <if test="vbatch != null and vbatch != ''"> VBATCH , </if>
            <if test="vfree1 != null and vfree1 != ''"> VFREE1 , </if>
            <if test="vfree10 != null and vfree10 != ''"> VFREE10 , </if>
            <if test="vfree2 != null and vfree2 != ''"> VFREE2 , </if>
            <if test="vfree3 != null and vfree3 != ''"> VFREE3 , </if>
            <if test="vfree4 != null and vfree4 != ''"> VFREE4 , </if>
            <if test="vfree5 != null and vfree5 != ''"> VFREE5 , </if>
            <if test="vfree6 != null and vfree6 != ''"> VFREE6 , </if>
            <if test="vfree7 != null and vfree7 != ''"> VFREE7 , </if>
            <if test="vfree8 != null and vfree8 != ''"> VFREE8 , </if>
            <if test="vfree9 != null and vfree9 != ''"> VFREE9 , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="btryflag != null and btryflag != ''"> #{btryflag} ,</if>
            <if test="caccountmonth != null and caccountmonth != ''"> #{caccountmonth} ,</if>
            <if test="caccountyear != null and caccountyear != ''"> #{caccountyear} ,</if>
            <if test="cinventoryid != null and cinventoryid != ''"> #{cinventoryid} ,</if>
            <if test="cmonthledgerid != null and cmonthledgerid != ''"> #{cmonthledgerid} ,</if>
            <if test="crdcenterid != null and crdcenterid != ''"> #{crdcenterid} ,</if>
            <if test="cvendorid != null and cvendorid != ''"> #{cvendorid} ,</if>
            <if test="dr != null and dr != ''"> #{dr} ,</if>
            <if test="fpricemodeflag != null and fpricemodeflag != ''"> #{fpricemodeflag} ,</if>
            <if test="frecordtypeflag != null and frecordtypeflag != ''"> #{frecordtypeflag} ,</if>
            <if test="nabmny != null and nabmny != ''"> #{nabmny} ,</if>
            <if test="nabnum != null and nabnum != ''"> #{nabnum} ,</if>
            <if test="nabprice != null and nabprice != ''"> #{nabprice} ,</if>
            <if test="nabvarymny != null and nabvarymny != ''"> #{nabvarymny} ,</if>
            <if test="ninmny != null and ninmny != ''"> #{ninmny} ,</if>
            <if test="ninnum != null and ninnum != ''"> #{ninnum} ,</if>
            <if test="ninvarymny != null and ninvarymny != ''"> #{ninvarymny} ,</if>
            <if test="nmonthprice != null and nmonthprice != ''"> #{nmonthprice} ,</if>
            <if test="noutmny != null and noutmny != ''"> #{noutmny} ,</if>
            <if test="noutnum != null and noutnum != ''"> #{noutnum} ,</if>
            <if test="noutvarymny != null and noutvarymny != ''"> #{noutvarymny} ,</if>
            <if test="nplanedprice != null and nplanedprice != ''"> #{nplanedprice} ,</if>
            <if test="nvariancerate != null and nvariancerate != ''"> #{nvariancerate} ,</if>
            <if test="pkCorp != null and pkCorp != ''"> #{pkCorp} ,</if>
            <if test="ts != null and ts != ''"> #{ts} ,</if>
            <if test="vbatch != null and vbatch != ''"> #{vbatch} ,</if>
            <if test="vfree1 != null and vfree1 != ''"> #{vfree1} ,</if>
            <if test="vfree10 != null and vfree10 != ''"> #{vfree10} ,</if>
            <if test="vfree2 != null and vfree2 != ''"> #{vfree2} ,</if>
            <if test="vfree3 != null and vfree3 != ''"> #{vfree3} ,</if>
            <if test="vfree4 != null and vfree4 != ''"> #{vfree4} ,</if>
            <if test="vfree5 != null and vfree5 != ''"> #{vfree5} ,</if>
            <if test="vfree6 != null and vfree6 != ''"> #{vfree6} ,</if>
            <if test="vfree7 != null and vfree7 != ''"> #{vfree7} ,</if>
            <if test="vfree8 != null and vfree8 != ''"> #{vfree8} ,</if>
            <if test="vfree9 != null and vfree9 != ''"> #{vfree9} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from IA_MONTHLEDGER a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="cmonthledgerid" useGeneratedKeys="true">
  insert into IA_MONTHLEDGER(BTRYFLAG, CACCOUNTMONTH, CACCOUNTYEAR, CINVENTORYID, CRDCENTERID, CVENDORID, DR, FPRICEMODEFLAG, FRECORDTYPEFLAG, NABMNY, NABNUM, NABPRICE, NABVARYMNY, NINMNY, NINNUM, NINVARYMNY, NMONTHPRICE, NOUTMNY, NOUTNUM, NOUTVARYMNY, NPLANEDPRICE, NVARIANCERATE, PK_CORP, TS, VBATCH, VFREE1, VFREE10, VFREE2, VFREE3, VFREE4, VFREE5, VFREE6, VFREE7, VFREE8, VFREE9,  sts) 
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.btryflag},#{entity.caccountmonth},#{entity.caccountyear},#{entity.cinventoryid},#{entity.crdcenterid},#{entity.cvendorid},#{entity.dr},#{entity.fpricemodeflag},#{entity.frecordtypeflag},#{entity.nabmny},#{entity.nabnum},#{entity.nabprice},#{entity.nabvarymny},#{entity.ninmny},#{entity.ninnum},#{entity.ninvarymny},#{entity.nmonthprice},#{entity.noutmny},#{entity.noutnum},#{entity.noutvarymny},#{entity.nplanedprice},#{entity.nvariancerate},#{entity.pkCorp},#{entity.ts},#{entity.vbatch},#{entity.vfree1},#{entity.vfree10},#{entity.vfree2},#{entity.vfree3},#{entity.vfree4},#{entity.vfree5},#{entity.vfree6},#{entity.vfree7},#{entity.vfree8},#{entity.vfree9}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="cmonthledgerid" useGeneratedKeys="true">
    insert into IA_MONTHLEDGER(BTRYFLAG, CACCOUNTMONTH, CACCOUNTYEAR, CINVENTORYID, CRDCENTERID, CVENDORID, DR, FPRICEMODEFLAG, FRECORDTYPEFLAG, NABMNY, NABNUM, NABPRICE, NABVARYMNY, NINMNY, NINNUM, NINVARYMNY, NMONTHPRICE, NOUTMNY, NOUTNUM, NOUTVARYMNY, NPLANEDPRICE, NVARIANCERATE, PK_CORP, TS, VBATCH, VFREE1, VFREE10, VFREE2, VFREE3, VFREE4, VFREE5, VFREE6, VFREE7, VFREE8, VFREE9)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.btryflag},#{entity.caccountmonth},#{entity.caccountyear},#{entity.cinventoryid},#{entity.crdcenterid},#{entity.cvendorid},#{entity.dr},#{entity.fpricemodeflag},#{entity.frecordtypeflag},#{entity.nabmny},#{entity.nabnum},#{entity.nabprice},#{entity.nabvarymny},#{entity.ninmny},#{entity.ninnum},#{entity.ninvarymny},#{entity.nmonthprice},#{entity.noutmny},#{entity.noutnum},#{entity.noutvarymny},#{entity.nplanedprice},#{entity.nvariancerate},#{entity.pkCorp},#{entity.ts},#{entity.vbatch},#{entity.vfree1},#{entity.vfree10},#{entity.vfree2},#{entity.vfree3},#{entity.vfree4},#{entity.vfree5},#{entity.vfree6},#{entity.vfree7},#{entity.vfree8},#{entity.vfree9})
    </foreach>
    on duplicate key update
    BTRYFLAG = values(BTRYFLAG),
    CACCOUNTMONTH = values(CACCOUNTMONTH),
    CACCOUNTYEAR = values(CACCOUNTYEAR),
    CINVENTORYID = values(CINVENTORYID),
    CRDCENTERID = values(CRDCENTERID),
    CVENDORID = values(CVENDORID),
    DR = values(DR),
    FPRICEMODEFLAG = values(FPRICEMODEFLAG),
    FRECORDTYPEFLAG = values(FRECORDTYPEFLAG),
    NABMNY = values(NABMNY),
    NABNUM = values(NABNUM),
    NABPRICE = values(NABPRICE),
    NABVARYMNY = values(NABVARYMNY),
    NINMNY = values(NINMNY),
    NINNUM = values(NINNUM),
    NINVARYMNY = values(NINVARYMNY),
    NMONTHPRICE = values(NMONTHPRICE),
    NOUTMNY = values(NOUTMNY),
    NOUTNUM = values(NOUTNUM),
    NOUTVARYMNY = values(NOUTVARYMNY),
    NPLANEDPRICE = values(NPLANEDPRICE),
    NVARIANCERATE = values(NVARIANCERATE),
    PK_CORP = values(PK_CORP),
    TS = values(TS),
    VBATCH = values(VBATCH),
    VFREE1 = values(VFREE1),
    VFREE10 = values(VFREE10),
    VFREE2 = values(VFREE2),
    VFREE3 = values(VFREE3),
    VFREE4 = values(VFREE4),
    VFREE5 = values(VFREE5),
    VFREE6 = values(VFREE6),
    VFREE7 = values(VFREE7),
    VFREE8 = values(VFREE8),
    VFREE9 = values(VFREE9)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity" >
update IA_MONTHLEDGER  set
<trim suffix="" suffixOverrides=",">
  <if test="btryflag != null and btryflag != ''"> BTRYFLAG = #{btryflag},</if>
  <if test="caccountmonth != null and caccountmonth != ''"> CACCOUNTMONTH = #{caccountmonth},</if>
  <if test="caccountyear != null and caccountyear != ''"> CACCOUNTYEAR = #{caccountyear},</if>
  <if test="cinventoryid != null and cinventoryid != ''"> CINVENTORYID = #{cinventoryid},</if>
  <if test="crdcenterid != null and crdcenterid != ''"> CRDCENTERID = #{crdcenterid},</if>
  <if test="cvendorid != null and cvendorid != ''"> CVENDORID = #{cvendorid},</if>
  <if test="dr != null and dr != ''"> DR = #{dr},</if>
  <if test="fpricemodeflag != null and fpricemodeflag != ''"> FPRICEMODEFLAG = #{fpricemodeflag},</if>
  <if test="frecordtypeflag != null and frecordtypeflag != ''"> FRECORDTYPEFLAG = #{frecordtypeflag},</if>
  <if test="nabmny != null and nabmny != ''"> NABMNY = #{nabmny},</if>
  <if test="nabnum != null and nabnum != ''"> NABNUM = #{nabnum},</if>
  <if test="nabprice != null and nabprice != ''"> NABPRICE = #{nabprice},</if>
  <if test="nabvarymny != null and nabvarymny != ''"> NABVARYMNY = #{nabvarymny},</if>
  <if test="ninmny != null and ninmny != ''"> NINMNY = #{ninmny},</if>
  <if test="ninnum != null and ninnum != ''"> NINNUM = #{ninnum},</if>
  <if test="ninvarymny != null and ninvarymny != ''"> NINVARYMNY = #{ninvarymny},</if>
  <if test="nmonthprice != null and nmonthprice != ''"> NMONTHPRICE = #{nmonthprice},</if>
  <if test="noutmny != null and noutmny != ''"> NOUTMNY = #{noutmny},</if>
  <if test="noutnum != null and noutnum != ''"> NOUTNUM = #{noutnum},</if>
  <if test="noutvarymny != null and noutvarymny != ''"> NOUTVARYMNY = #{noutvarymny},</if>
  <if test="nplanedprice != null and nplanedprice != ''"> NPLANEDPRICE = #{nplanedprice},</if>
  <if test="nvariancerate != null and nvariancerate != ''"> NVARIANCERATE = #{nvariancerate},</if>
  <if test="pkCorp != null and pkCorp != ''"> PK_CORP = #{pkCorp},</if>
  <if test="ts != null and ts != ''"> TS = #{ts},</if>
  <if test="vbatch != null and vbatch != ''"> VBATCH = #{vbatch},</if>
  <if test="vfree1 != null and vfree1 != ''"> VFREE1 = #{vfree1},</if>
  <if test="vfree10 != null and vfree10 != ''"> VFREE10 = #{vfree10},</if>
  <if test="vfree2 != null and vfree2 != ''"> VFREE2 = #{vfree2},</if>
  <if test="vfree3 != null and vfree3 != ''"> VFREE3 = #{vfree3},</if>
  <if test="vfree4 != null and vfree4 != ''"> VFREE4 = #{vfree4},</if>
  <if test="vfree5 != null and vfree5 != ''"> VFREE5 = #{vfree5},</if>
  <if test="vfree6 != null and vfree6 != ''"> VFREE6 = #{vfree6},</if>
  <if test="vfree7 != null and vfree7 != ''"> VFREE7 = #{vfree7},</if>
  <if test="vfree8 != null and vfree8 != ''"> VFREE8 = #{vfree8},</if>
  <if test="vfree9 != null and vfree9 != ''"> VFREE9 = #{vfree9},</if>
</trim>
where CMONTHLEDGERID = #{cmonthledgerid}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity" >
update IA_MONTHLEDGER  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where CMONTHLEDGERID = #{cmonthledgerid}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.IaMonthledgerEntity" >
update IA_MONTHLEDGER  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="btryflag != null and btryflag != ''"> and BTRYFLAG = #{btryflag} </if>
            <if test="caccountmonth != null and caccountmonth != ''"> and CACCOUNTMONTH = #{caccountmonth} </if>
            <if test="caccountyear != null and caccountyear != ''"> and CACCOUNTYEAR = #{caccountyear} </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and CINVENTORYID = #{cinventoryid} </if>
            <if test="cmonthledgerid != null and cmonthledgerid != ''"> and CMONTHLEDGERID = #{cmonthledgerid} </if>
            <if test="crdcenterid != null and crdcenterid != ''"> and CRDCENTERID = #{crdcenterid} </if>
            <if test="cvendorid != null and cvendorid != ''"> and CVENDORID = #{cvendorid} </if>
            <if test="dr != null and dr != ''"> and DR = #{dr} </if>
            <if test="fpricemodeflag != null and fpricemodeflag != ''"> and FPRICEMODEFLAG = #{fpricemodeflag} </if>
            <if test="frecordtypeflag != null and frecordtypeflag != ''"> and FRECORDTYPEFLAG = #{frecordtypeflag} </if>
            <if test="nabmny != null and nabmny != ''"> and NABMNY = #{nabmny} </if>
            <if test="nabnum != null and nabnum != ''"> and NABNUM = #{nabnum} </if>
            <if test="nabprice != null and nabprice != ''"> and NABPRICE = #{nabprice} </if>
            <if test="nabvarymny != null and nabvarymny != ''"> and NABVARYMNY = #{nabvarymny} </if>
            <if test="ninmny != null and ninmny != ''"> and NINMNY = #{ninmny} </if>
            <if test="ninnum != null and ninnum != ''"> and NINNUM = #{ninnum} </if>
            <if test="ninvarymny != null and ninvarymny != ''"> and NINVARYMNY = #{ninvarymny} </if>
            <if test="nmonthprice != null and nmonthprice != ''"> and NMONTHPRICE = #{nmonthprice} </if>
            <if test="noutmny != null and noutmny != ''"> and NOUTMNY = #{noutmny} </if>
            <if test="noutnum != null and noutnum != ''"> and NOUTNUM = #{noutnum} </if>
            <if test="noutvarymny != null and noutvarymny != ''"> and NOUTVARYMNY = #{noutvarymny} </if>
            <if test="nplanedprice != null and nplanedprice != ''"> and NPLANEDPRICE = #{nplanedprice} </if>
            <if test="nvariancerate != null and nvariancerate != ''"> and NVARIANCERATE = #{nvariancerate} </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
            <if test="ts != null and ts != ''"> and TS = #{ts} </if>
            <if test="vbatch != null and vbatch != ''"> and VBATCH = #{vbatch} </if>
            <if test="vfree1 != null and vfree1 != ''"> and VFREE1 = #{vfree1} </if>
            <if test="vfree10 != null and vfree10 != ''"> and VFREE10 = #{vfree10} </if>
            <if test="vfree2 != null and vfree2 != ''"> and VFREE2 = #{vfree2} </if>
            <if test="vfree3 != null and vfree3 != ''"> and VFREE3 = #{vfree3} </if>
            <if test="vfree4 != null and vfree4 != ''"> and VFREE4 = #{vfree4} </if>
            <if test="vfree5 != null and vfree5 != ''"> and VFREE5 = #{vfree5} </if>
            <if test="vfree6 != null and vfree6 != ''"> and VFREE6 = #{vfree6} </if>
            <if test="vfree7 != null and vfree7 != ''"> and VFREE7 = #{vfree7} </if>
            <if test="vfree8 != null and vfree8 != ''"> and VFREE8 = #{vfree8} </if>
            <if test="vfree9 != null and vfree9 != ''"> and VFREE9 = #{vfree9} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from IA_MONTHLEDGER where CMONTHLEDGERID = #{cmonthledgerid}
</delete>

</mapper>

