<?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.dao.CitDistributionMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.entity.CitDistribution">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
    <result column="project_id" jdbcType="VARCHAR" property="projectId" />
    <result column="date" jdbcType="TIMESTAMP" property="date" />
    <result column="source" jdbcType="VARCHAR" property="source" />
    <result column="period" jdbcType="INTEGER" property="period" />
    <result column="quarter" jdbcType="INTEGER" property="quarter" />
    <result column="tax_payer_number" jdbcType="VARCHAR" property="taxPayerNumber" />
    <result column="org_name" jdbcType="VARCHAR" property="orgName" />
    <result column="business_income" jdbcType="DECIMAL" property="businessIncome" />
    <result column="employee_remuneration" jdbcType="DECIMAL" property="employeeRemuneration" />
    <result column="total_assets" jdbcType="DECIMAL" property="totalAssets" />
    <result column="distribution_ratio" jdbcType="DECIMAL" property="distributionRatio" />
    <result column="distribution_ratio_formula" jdbcType="VARCHAR" property="distributionRatioFormula" />
    <result column="distribution_amount" jdbcType="DECIMAL" property="distributionAmount" />
    <result column="distribution_amount_formula" jdbcType="VARCHAR" property="distributionAmountFormula" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="period_month" jdbcType="VARCHAR" property="periodMonth" />
  </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.
    -->
    id, organization_id, project_id, date, source, period, quarter, tax_payer_number, 
    org_name, business_income, employee_remuneration, total_assets, distribution_ratio, 
    distribution_ratio_formula, distribution_amount, distribution_amount_formula, create_by, 
    create_time, update_time, code, period_month
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.entity.CitDistributionExample" 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 cit_distribution
    <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.Long" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from cit_distribution
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from cit_distribution
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.entity.CitDistributionExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from cit_distribution
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.entity.CitDistribution">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into cit_distribution (id, organization_id, project_id, 
      date, source, period, 
      quarter, tax_payer_number, org_name, 
      business_income, employee_remuneration, total_assets, 
      distribution_ratio, distribution_ratio_formula, 
      distribution_amount, distribution_amount_formula, 
      create_by, create_time, update_time, 
      code, period_month)
    values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, 
      #{date,jdbcType=TIMESTAMP}, #{source,jdbcType=VARCHAR}, #{period,jdbcType=INTEGER}, 
      #{quarter,jdbcType=INTEGER}, #{taxPayerNumber,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, 
      #{businessIncome,jdbcType=DECIMAL}, #{employeeRemuneration,jdbcType=DECIMAL}, #{totalAssets,jdbcType=DECIMAL}, 
      #{distributionRatio,jdbcType=DECIMAL}, #{distributionRatioFormula,jdbcType=VARCHAR}, 
      #{distributionAmount,jdbcType=DECIMAL}, #{distributionAmountFormula,jdbcType=VARCHAR}, 
      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{code,jdbcType=VARCHAR}, #{periodMonth,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.entity.CitDistribution">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into cit_distribution
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="organizationId != null">
        organization_id,
      </if>
      <if test="projectId != null">
        project_id,
      </if>
      <if test="date != null">
        date,
      </if>
      <if test="source != null">
        source,
      </if>
      <if test="period != null">
        period,
      </if>
      <if test="quarter != null">
        quarter,
      </if>
      <if test="taxPayerNumber != null">
        tax_payer_number,
      </if>
      <if test="orgName != null">
        org_name,
      </if>
      <if test="businessIncome != null">
        business_income,
      </if>
      <if test="employeeRemuneration != null">
        employee_remuneration,
      </if>
      <if test="totalAssets != null">
        total_assets,
      </if>
      <if test="distributionRatio != null">
        distribution_ratio,
      </if>
      <if test="distributionRatioFormula != null">
        distribution_ratio_formula,
      </if>
      <if test="distributionAmount != null">
        distribution_amount,
      </if>
      <if test="distributionAmountFormula != null">
        distribution_amount_formula,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="code != null">
        code,
      </if>
      <if test="periodMonth != null">
        period_month,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="organizationId != null">
        #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="date != null">
        #{date,jdbcType=TIMESTAMP},
      </if>
      <if test="source != null">
        #{source,jdbcType=VARCHAR},
      </if>
      <if test="period != null">
        #{period,jdbcType=INTEGER},
      </if>
      <if test="quarter != null">
        #{quarter,jdbcType=INTEGER},
      </if>
      <if test="taxPayerNumber != null">
        #{taxPayerNumber,jdbcType=VARCHAR},
      </if>
      <if test="orgName != null">
        #{orgName,jdbcType=VARCHAR},
      </if>
      <if test="businessIncome != null">
        #{businessIncome,jdbcType=DECIMAL},
      </if>
      <if test="employeeRemuneration != null">
        #{employeeRemuneration,jdbcType=DECIMAL},
      </if>
      <if test="totalAssets != null">
        #{totalAssets,jdbcType=DECIMAL},
      </if>
      <if test="distributionRatio != null">
        #{distributionRatio,jdbcType=DECIMAL},
      </if>
      <if test="distributionRatioFormula != null">
        #{distributionRatioFormula,jdbcType=VARCHAR},
      </if>
      <if test="distributionAmount != null">
        #{distributionAmount,jdbcType=DECIMAL},
      </if>
      <if test="distributionAmountFormula != null">
        #{distributionAmountFormula,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="periodMonth != null">
        #{periodMonth,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.entity.CitDistributionExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from cit_distribution
    <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 cit_distribution
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.organizationId != null">
        organization_id = #{record.organizationId,jdbcType=VARCHAR},
      </if>
      <if test="record.projectId != null">
        project_id = #{record.projectId,jdbcType=VARCHAR},
      </if>
      <if test="record.date != null">
        date = #{record.date,jdbcType=TIMESTAMP},
      </if>
      <if test="record.source != null">
        source = #{record.source,jdbcType=VARCHAR},
      </if>
      <if test="record.period != null">
        period = #{record.period,jdbcType=INTEGER},
      </if>
      <if test="record.quarter != null">
        quarter = #{record.quarter,jdbcType=INTEGER},
      </if>
      <if test="record.taxPayerNumber != null">
        tax_payer_number = #{record.taxPayerNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.orgName != null">
        org_name = #{record.orgName,jdbcType=VARCHAR},
      </if>
      <if test="record.businessIncome != null">
        business_income = #{record.businessIncome,jdbcType=DECIMAL},
      </if>
      <if test="record.employeeRemuneration != null">
        employee_remuneration = #{record.employeeRemuneration,jdbcType=DECIMAL},
      </if>
      <if test="record.totalAssets != null">
        total_assets = #{record.totalAssets,jdbcType=DECIMAL},
      </if>
      <if test="record.distributionRatio != null">
        distribution_ratio = #{record.distributionRatio,jdbcType=DECIMAL},
      </if>
      <if test="record.distributionRatioFormula != null">
        distribution_ratio_formula = #{record.distributionRatioFormula,jdbcType=VARCHAR},
      </if>
      <if test="record.distributionAmount != null">
        distribution_amount = #{record.distributionAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.distributionAmountFormula != null">
        distribution_amount_formula = #{record.distributionAmountFormula,jdbcType=VARCHAR},
      </if>
      <if test="record.createBy != null">
        create_by = #{record.createBy,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.code != null">
        code = #{record.code,jdbcType=VARCHAR},
      </if>
      <if test="record.periodMonth != null">
        period_month = #{record.periodMonth,jdbcType=VARCHAR},
      </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 cit_distribution
    set id = #{record.id,jdbcType=BIGINT},
      organization_id = #{record.organizationId,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR},
      date = #{record.date,jdbcType=TIMESTAMP},
      source = #{record.source,jdbcType=VARCHAR},
      period = #{record.period,jdbcType=INTEGER},
      quarter = #{record.quarter,jdbcType=INTEGER},
      tax_payer_number = #{record.taxPayerNumber,jdbcType=VARCHAR},
      org_name = #{record.orgName,jdbcType=VARCHAR},
      business_income = #{record.businessIncome,jdbcType=DECIMAL},
      employee_remuneration = #{record.employeeRemuneration,jdbcType=DECIMAL},
      total_assets = #{record.totalAssets,jdbcType=DECIMAL},
      distribution_ratio = #{record.distributionRatio,jdbcType=DECIMAL},
      distribution_ratio_formula = #{record.distributionRatioFormula,jdbcType=VARCHAR},
      distribution_amount = #{record.distributionAmount,jdbcType=DECIMAL},
      distribution_amount_formula = #{record.distributionAmountFormula,jdbcType=VARCHAR},
      create_by = #{record.createBy,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      code = #{record.code,jdbcType=VARCHAR},
      period_month = #{record.periodMonth,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entity.CitDistribution">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update cit_distribution
    <set>
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="date != null">
        date = #{date,jdbcType=TIMESTAMP},
      </if>
      <if test="source != null">
        source = #{source,jdbcType=VARCHAR},
      </if>
      <if test="period != null">
        period = #{period,jdbcType=INTEGER},
      </if>
      <if test="quarter != null">
        quarter = #{quarter,jdbcType=INTEGER},
      </if>
      <if test="taxPayerNumber != null">
        tax_payer_number = #{taxPayerNumber,jdbcType=VARCHAR},
      </if>
      <if test="orgName != null">
        org_name = #{orgName,jdbcType=VARCHAR},
      </if>
      <if test="businessIncome != null">
        business_income = #{businessIncome,jdbcType=DECIMAL},
      </if>
      <if test="employeeRemuneration != null">
        employee_remuneration = #{employeeRemuneration,jdbcType=DECIMAL},
      </if>
      <if test="totalAssets != null">
        total_assets = #{totalAssets,jdbcType=DECIMAL},
      </if>
      <if test="distributionRatio != null">
        distribution_ratio = #{distributionRatio,jdbcType=DECIMAL},
      </if>
      <if test="distributionRatioFormula != null">
        distribution_ratio_formula = #{distributionRatioFormula,jdbcType=VARCHAR},
      </if>
      <if test="distributionAmount != null">
        distribution_amount = #{distributionAmount,jdbcType=DECIMAL},
      </if>
      <if test="distributionAmountFormula != null">
        distribution_amount_formula = #{distributionAmountFormula,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="periodMonth != null">
        period_month = #{periodMonth,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entity.CitDistribution">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update cit_distribution
    set organization_id = #{organizationId,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR},
      date = #{date,jdbcType=TIMESTAMP},
      source = #{source,jdbcType=VARCHAR},
      period = #{period,jdbcType=INTEGER},
      quarter = #{quarter,jdbcType=INTEGER},
      tax_payer_number = #{taxPayerNumber,jdbcType=VARCHAR},
      org_name = #{orgName,jdbcType=VARCHAR},
      business_income = #{businessIncome,jdbcType=DECIMAL},
      employee_remuneration = #{employeeRemuneration,jdbcType=DECIMAL},
      total_assets = #{totalAssets,jdbcType=DECIMAL},
      distribution_ratio = #{distributionRatio,jdbcType=DECIMAL},
      distribution_ratio_formula = #{distributionRatioFormula,jdbcType=VARCHAR},
      distribution_amount = #{distributionAmount,jdbcType=DECIMAL},
      distribution_amount_formula = #{distributionAmountFormula,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      code = #{code,jdbcType=VARCHAR},
      period_month = #{periodMonth,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entity.CitDistributionExample" 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 cit_distribution
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>