<?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="pwc.taxtech.atms.vat.dao.CustBalanceMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.vat.entity.CustBalance">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="BalanceId" jdbcType="VARCHAR" property="balanceId" />
    <result column="PeriodId" jdbcType="BIGINT" property="periodId" />
    <result column="AcctCode" jdbcType="VARCHAR" property="acctCode" />
    <result column="CustomerCode" jdbcType="VARCHAR" property="customerCode" />
    <result column="BegBal" jdbcType="DECIMAL" property="begBal" />
    <result column="BegDebitBal" jdbcType="DECIMAL" property="begDebitBal" />
    <result column="BegCreditBal" jdbcType="DECIMAL" property="begCreditBal" />
    <result column="DebitBal" jdbcType="DECIMAL" property="debitBal" />
    <result column="CreditBal" jdbcType="DECIMAL" property="creditBal" />
    <result column="YearDebitBal" jdbcType="DECIMAL" property="yearDebitBal" />
    <result column="YearCreditBal" jdbcType="DECIMAL" property="yearCreditBal" />
    <result column="EndBal" jdbcType="DECIMAL" property="endBal" />
    <result column="EndDebitBal" jdbcType="DECIMAL" property="endDebitBal" />
    <result column="EndCreditBal" jdbcType="DECIMAL" property="endCreditBal" />
    <result column="MonthId" jdbcType="INTEGER" property="monthId" />
    <result column="IsDummy" jdbcType="INTEGER" property="isDummy" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    BalanceId, PeriodId, AcctCode, CustomerCode, BegBal, BegDebitBal, BegCreditBal, DebitBal, 
    CreditBal, YearDebitBal, YearCreditBal, EndBal, EndDebitBal, EndCreditBal, MonthId, 
    IsDummy
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.CustBalanceExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from CustBalance
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from CustBalance
    where BalanceId = #{balanceId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from CustBalance
    where BalanceId = #{balanceId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.vat.entity.CustBalanceExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from CustBalance
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.vat.entity.CustBalance">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into CustBalance (BalanceId, PeriodId, AcctCode, 
      CustomerCode, BegBal, BegDebitBal, 
      BegCreditBal, DebitBal, CreditBal, 
      YearDebitBal, YearCreditBal, EndBal, 
      EndDebitBal, EndCreditBal, MonthId, 
      IsDummy)
    values (#{balanceId,jdbcType=VARCHAR}, #{periodId,jdbcType=BIGINT}, #{acctCode,jdbcType=VARCHAR}, 
      #{customerCode,jdbcType=VARCHAR}, #{begBal,jdbcType=DECIMAL}, #{begDebitBal,jdbcType=DECIMAL}, 
      #{begCreditBal,jdbcType=DECIMAL}, #{debitBal,jdbcType=DECIMAL}, #{creditBal,jdbcType=DECIMAL}, 
      #{yearDebitBal,jdbcType=DECIMAL}, #{yearCreditBal,jdbcType=DECIMAL}, #{endBal,jdbcType=DECIMAL}, 
      #{endDebitBal,jdbcType=DECIMAL}, #{endCreditBal,jdbcType=DECIMAL}, #{monthId,jdbcType=INTEGER}, 
      #{isDummy,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.CustBalance">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into CustBalance
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="balanceId != null">
        BalanceId,
      </if>
      <if test="periodId != null">
        PeriodId,
      </if>
      <if test="acctCode != null">
        AcctCode,
      </if>
      <if test="customerCode != null">
        CustomerCode,
      </if>
      <if test="begBal != null">
        BegBal,
      </if>
      <if test="begDebitBal != null">
        BegDebitBal,
      </if>
      <if test="begCreditBal != null">
        BegCreditBal,
      </if>
      <if test="debitBal != null">
        DebitBal,
      </if>
      <if test="creditBal != null">
        CreditBal,
      </if>
      <if test="yearDebitBal != null">
        YearDebitBal,
      </if>
      <if test="yearCreditBal != null">
        YearCreditBal,
      </if>
      <if test="endBal != null">
        EndBal,
      </if>
      <if test="endDebitBal != null">
        EndDebitBal,
      </if>
      <if test="endCreditBal != null">
        EndCreditBal,
      </if>
      <if test="monthId != null">
        MonthId,
      </if>
      <if test="isDummy != null">
        IsDummy,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="balanceId != null">
        #{balanceId,jdbcType=VARCHAR},
      </if>
      <if test="periodId != null">
        #{periodId,jdbcType=BIGINT},
      </if>
      <if test="acctCode != null">
        #{acctCode,jdbcType=VARCHAR},
      </if>
      <if test="customerCode != null">
        #{customerCode,jdbcType=VARCHAR},
      </if>
      <if test="begBal != null">
        #{begBal,jdbcType=DECIMAL},
      </if>
      <if test="begDebitBal != null">
        #{begDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="begCreditBal != null">
        #{begCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="debitBal != null">
        #{debitBal,jdbcType=DECIMAL},
      </if>
      <if test="creditBal != null">
        #{creditBal,jdbcType=DECIMAL},
      </if>
      <if test="yearDebitBal != null">
        #{yearDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="yearCreditBal != null">
        #{yearCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="endBal != null">
        #{endBal,jdbcType=DECIMAL},
      </if>
      <if test="endDebitBal != null">
        #{endDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="endCreditBal != null">
        #{endCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="monthId != null">
        #{monthId,jdbcType=INTEGER},
      </if>
      <if test="isDummy != null">
        #{isDummy,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.CustBalanceExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from CustBalance
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update CustBalance
    <set>
      <if test="record.balanceId != null">
        BalanceId = #{record.balanceId,jdbcType=VARCHAR},
      </if>
      <if test="record.periodId != null">
        PeriodId = #{record.periodId,jdbcType=BIGINT},
      </if>
      <if test="record.acctCode != null">
        AcctCode = #{record.acctCode,jdbcType=VARCHAR},
      </if>
      <if test="record.customerCode != null">
        CustomerCode = #{record.customerCode,jdbcType=VARCHAR},
      </if>
      <if test="record.begBal != null">
        BegBal = #{record.begBal,jdbcType=DECIMAL},
      </if>
      <if test="record.begDebitBal != null">
        BegDebitBal = #{record.begDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="record.begCreditBal != null">
        BegCreditBal = #{record.begCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="record.debitBal != null">
        DebitBal = #{record.debitBal,jdbcType=DECIMAL},
      </if>
      <if test="record.creditBal != null">
        CreditBal = #{record.creditBal,jdbcType=DECIMAL},
      </if>
      <if test="record.yearDebitBal != null">
        YearDebitBal = #{record.yearDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="record.yearCreditBal != null">
        YearCreditBal = #{record.yearCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="record.endBal != null">
        EndBal = #{record.endBal,jdbcType=DECIMAL},
      </if>
      <if test="record.endDebitBal != null">
        EndDebitBal = #{record.endDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="record.endCreditBal != null">
        EndCreditBal = #{record.endCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="record.monthId != null">
        MonthId = #{record.monthId,jdbcType=INTEGER},
      </if>
      <if test="record.isDummy != null">
        IsDummy = #{record.isDummy,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update CustBalance
    set BalanceId = #{record.balanceId,jdbcType=VARCHAR},
      PeriodId = #{record.periodId,jdbcType=BIGINT},
      AcctCode = #{record.acctCode,jdbcType=VARCHAR},
      CustomerCode = #{record.customerCode,jdbcType=VARCHAR},
      BegBal = #{record.begBal,jdbcType=DECIMAL},
      BegDebitBal = #{record.begDebitBal,jdbcType=DECIMAL},
      BegCreditBal = #{record.begCreditBal,jdbcType=DECIMAL},
      DebitBal = #{record.debitBal,jdbcType=DECIMAL},
      CreditBal = #{record.creditBal,jdbcType=DECIMAL},
      YearDebitBal = #{record.yearDebitBal,jdbcType=DECIMAL},
      YearCreditBal = #{record.yearCreditBal,jdbcType=DECIMAL},
      EndBal = #{record.endBal,jdbcType=DECIMAL},
      EndDebitBal = #{record.endDebitBal,jdbcType=DECIMAL},
      EndCreditBal = #{record.endCreditBal,jdbcType=DECIMAL},
      MonthId = #{record.monthId,jdbcType=INTEGER},
      IsDummy = #{record.isDummy,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.vat.entity.CustBalance">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update CustBalance
    <set>
      <if test="periodId != null">
        PeriodId = #{periodId,jdbcType=BIGINT},
      </if>
      <if test="acctCode != null">
        AcctCode = #{acctCode,jdbcType=VARCHAR},
      </if>
      <if test="customerCode != null">
        CustomerCode = #{customerCode,jdbcType=VARCHAR},
      </if>
      <if test="begBal != null">
        BegBal = #{begBal,jdbcType=DECIMAL},
      </if>
      <if test="begDebitBal != null">
        BegDebitBal = #{begDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="begCreditBal != null">
        BegCreditBal = #{begCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="debitBal != null">
        DebitBal = #{debitBal,jdbcType=DECIMAL},
      </if>
      <if test="creditBal != null">
        CreditBal = #{creditBal,jdbcType=DECIMAL},
      </if>
      <if test="yearDebitBal != null">
        YearDebitBal = #{yearDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="yearCreditBal != null">
        YearCreditBal = #{yearCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="endBal != null">
        EndBal = #{endBal,jdbcType=DECIMAL},
      </if>
      <if test="endDebitBal != null">
        EndDebitBal = #{endDebitBal,jdbcType=DECIMAL},
      </if>
      <if test="endCreditBal != null">
        EndCreditBal = #{endCreditBal,jdbcType=DECIMAL},
      </if>
      <if test="monthId != null">
        MonthId = #{monthId,jdbcType=INTEGER},
      </if>
      <if test="isDummy != null">
        IsDummy = #{isDummy,jdbcType=INTEGER},
      </if>
    </set>
    where BalanceId = #{balanceId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.vat.entity.CustBalance">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update CustBalance
    set PeriodId = #{periodId,jdbcType=BIGINT},
      AcctCode = #{acctCode,jdbcType=VARCHAR},
      CustomerCode = #{customerCode,jdbcType=VARCHAR},
      BegBal = #{begBal,jdbcType=DECIMAL},
      BegDebitBal = #{begDebitBal,jdbcType=DECIMAL},
      BegCreditBal = #{begCreditBal,jdbcType=DECIMAL},
      DebitBal = #{debitBal,jdbcType=DECIMAL},
      CreditBal = #{creditBal,jdbcType=DECIMAL},
      YearDebitBal = #{yearDebitBal,jdbcType=DECIMAL},
      YearCreditBal = #{yearCreditBal,jdbcType=DECIMAL},
      EndBal = #{endBal,jdbcType=DECIMAL},
      EndDebitBal = #{endDebitBal,jdbcType=DECIMAL},
      EndCreditBal = #{endCreditBal,jdbcType=DECIMAL},
      MonthId = #{monthId,jdbcType=INTEGER},
      IsDummy = #{isDummy,jdbcType=INTEGER}
    where BalanceId = #{balanceId,jdbcType=VARCHAR}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.CustBalanceExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from CustBalance
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>