<?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.RedLetterInfoTableMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.vat.entity.RedLetterInfoTable">
    <!--
      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="period" jdbcType="INTEGER" property="period" />
    <result column="tms_period" jdbcType="INTEGER" property="tmsPeriod" />
    <result column="fill_in_date" jdbcType="TIMESTAMP" property="fillInDate" />
    <result column="subject_num" jdbcType="VARCHAR" property="subjectNum" />
    <result column="subject_name" jdbcType="VARCHAR" property="subjectName" />
    <result column="red_letter_invoice_info_table_num" jdbcType="VARCHAR" property="redLetterInvoiceInfoTableNum" />
    <result column="sales_tax_number" jdbcType="VARCHAR" property="salesTaxNumber" />
    <result column="salesperson_name" jdbcType="VARCHAR" property="salespersonName" />
    <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
    <result column="total_tax_amount" jdbcType="DECIMAL" property="totalTaxAmount" />
    <result column="application_description" jdbcType="VARCHAR" property="applicationDescription" />
    <result column="applicant_manager" jdbcType="VARCHAR" property="applicantManager" />
    <result column="invoice_code" jdbcType="VARCHAR" property="invoiceCode" />
    <result column="invoice_number" jdbcType="VARCHAR" property="invoiceNumber" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </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, period, tms_period, fill_in_date, subject_num, subject_name, 
    red_letter_invoice_info_table_num, sales_tax_number, salesperson_name, total_amount, 
    total_tax_amount, application_description, applicant_manager, invoice_code, invoice_number, 
    create_time, update_time
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTableExample" 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 red_letter_info_table
    <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 red_letter_info_table
    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 red_letter_info_table
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTableExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from red_letter_info_table
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTable">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into red_letter_info_table (id, organization_id, project_id, 
      period, tms_period, fill_in_date, 
      subject_num, subject_name, red_letter_invoice_info_table_num, 
      sales_tax_number, salesperson_name, total_amount, 
      total_tax_amount, application_description, 
      applicant_manager, invoice_code, invoice_number, 
      create_time, update_time)
    values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, 
      #{period,jdbcType=INTEGER}, #{tmsPeriod,jdbcType=INTEGER}, #{fillInDate,jdbcType=TIMESTAMP}, 
      #{subjectNum,jdbcType=VARCHAR}, #{subjectName,jdbcType=VARCHAR}, #{redLetterInvoiceInfoTableNum,jdbcType=VARCHAR}, 
      #{salesTaxNumber,jdbcType=VARCHAR}, #{salespersonName,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, 
      #{totalTaxAmount,jdbcType=DECIMAL}, #{applicationDescription,jdbcType=VARCHAR}, 
      #{applicantManager,jdbcType=VARCHAR}, #{invoiceCode,jdbcType=VARCHAR}, #{invoiceNumber,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTable">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into red_letter_info_table
    <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="period != null">
        period,
      </if>
      <if test="tmsPeriod != null">
        tms_period,
      </if>
      <if test="fillInDate != null">
        fill_in_date,
      </if>
      <if test="subjectNum != null">
        subject_num,
      </if>
      <if test="subjectName != null">
        subject_name,
      </if>
      <if test="redLetterInvoiceInfoTableNum != null">
        red_letter_invoice_info_table_num,
      </if>
      <if test="salesTaxNumber != null">
        sales_tax_number,
      </if>
      <if test="salespersonName != null">
        salesperson_name,
      </if>
      <if test="totalAmount != null">
        total_amount,
      </if>
      <if test="totalTaxAmount != null">
        total_tax_amount,
      </if>
      <if test="applicationDescription != null">
        application_description,
      </if>
      <if test="applicantManager != null">
        applicant_manager,
      </if>
      <if test="invoiceCode != null">
        invoice_code,
      </if>
      <if test="invoiceNumber != null">
        invoice_number,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </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="period != null">
        #{period,jdbcType=INTEGER},
      </if>
      <if test="tmsPeriod != null">
        #{tmsPeriod,jdbcType=INTEGER},
      </if>
      <if test="fillInDate != null">
        #{fillInDate,jdbcType=TIMESTAMP},
      </if>
      <if test="subjectNum != null">
        #{subjectNum,jdbcType=VARCHAR},
      </if>
      <if test="subjectName != null">
        #{subjectName,jdbcType=VARCHAR},
      </if>
      <if test="redLetterInvoiceInfoTableNum != null">
        #{redLetterInvoiceInfoTableNum,jdbcType=VARCHAR},
      </if>
      <if test="salesTaxNumber != null">
        #{salesTaxNumber,jdbcType=VARCHAR},
      </if>
      <if test="salespersonName != null">
        #{salespersonName,jdbcType=VARCHAR},
      </if>
      <if test="totalAmount != null">
        #{totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="totalTaxAmount != null">
        #{totalTaxAmount,jdbcType=DECIMAL},
      </if>
      <if test="applicationDescription != null">
        #{applicationDescription,jdbcType=VARCHAR},
      </if>
      <if test="applicantManager != null">
        #{applicantManager,jdbcType=VARCHAR},
      </if>
      <if test="invoiceCode != null">
        #{invoiceCode,jdbcType=VARCHAR},
      </if>
      <if test="invoiceNumber != null">
        #{invoiceNumber,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTableExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from red_letter_info_table
    <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 red_letter_info_table
    <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.period != null">
        period = #{record.period,jdbcType=INTEGER},
      </if>
      <if test="record.tmsPeriod != null">
        tms_period = #{record.tmsPeriod,jdbcType=INTEGER},
      </if>
      <if test="record.fillInDate != null">
        fill_in_date = #{record.fillInDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.subjectNum != null">
        subject_num = #{record.subjectNum,jdbcType=VARCHAR},
      </if>
      <if test="record.subjectName != null">
        subject_name = #{record.subjectName,jdbcType=VARCHAR},
      </if>
      <if test="record.redLetterInvoiceInfoTableNum != null">
        red_letter_invoice_info_table_num = #{record.redLetterInvoiceInfoTableNum,jdbcType=VARCHAR},
      </if>
      <if test="record.salesTaxNumber != null">
        sales_tax_number = #{record.salesTaxNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.salespersonName != null">
        salesperson_name = #{record.salespersonName,jdbcType=VARCHAR},
      </if>
      <if test="record.totalAmount != null">
        total_amount = #{record.totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.totalTaxAmount != null">
        total_tax_amount = #{record.totalTaxAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.applicationDescription != null">
        application_description = #{record.applicationDescription,jdbcType=VARCHAR},
      </if>
      <if test="record.applicantManager != null">
        applicant_manager = #{record.applicantManager,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceCode != null">
        invoice_code = #{record.invoiceCode,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceNumber != null">
        invoice_number = #{record.invoiceNumber,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>
    </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 red_letter_info_table
    set id = #{record.id,jdbcType=BIGINT},
      organization_id = #{record.organizationId,jdbcType=VARCHAR},
      project_id = #{record.projectId,jdbcType=VARCHAR},
      period = #{record.period,jdbcType=INTEGER},
      tms_period = #{record.tmsPeriod,jdbcType=INTEGER},
      fill_in_date = #{record.fillInDate,jdbcType=TIMESTAMP},
      subject_num = #{record.subjectNum,jdbcType=VARCHAR},
      subject_name = #{record.subjectName,jdbcType=VARCHAR},
      red_letter_invoice_info_table_num = #{record.redLetterInvoiceInfoTableNum,jdbcType=VARCHAR},
      sales_tax_number = #{record.salesTaxNumber,jdbcType=VARCHAR},
      salesperson_name = #{record.salespersonName,jdbcType=VARCHAR},
      total_amount = #{record.totalAmount,jdbcType=DECIMAL},
      total_tax_amount = #{record.totalTaxAmount,jdbcType=DECIMAL},
      application_description = #{record.applicationDescription,jdbcType=VARCHAR},
      applicant_manager = #{record.applicantManager,jdbcType=VARCHAR},
      invoice_code = #{record.invoiceCode,jdbcType=VARCHAR},
      invoice_number = #{record.invoiceNumber,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTable">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update red_letter_info_table
    <set>
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="projectId != null">
        project_id = #{projectId,jdbcType=VARCHAR},
      </if>
      <if test="period != null">
        period = #{period,jdbcType=INTEGER},
      </if>
      <if test="tmsPeriod != null">
        tms_period = #{tmsPeriod,jdbcType=INTEGER},
      </if>
      <if test="fillInDate != null">
        fill_in_date = #{fillInDate,jdbcType=TIMESTAMP},
      </if>
      <if test="subjectNum != null">
        subject_num = #{subjectNum,jdbcType=VARCHAR},
      </if>
      <if test="subjectName != null">
        subject_name = #{subjectName,jdbcType=VARCHAR},
      </if>
      <if test="redLetterInvoiceInfoTableNum != null">
        red_letter_invoice_info_table_num = #{redLetterInvoiceInfoTableNum,jdbcType=VARCHAR},
      </if>
      <if test="salesTaxNumber != null">
        sales_tax_number = #{salesTaxNumber,jdbcType=VARCHAR},
      </if>
      <if test="salespersonName != null">
        salesperson_name = #{salespersonName,jdbcType=VARCHAR},
      </if>
      <if test="totalAmount != null">
        total_amount = #{totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="totalTaxAmount != null">
        total_tax_amount = #{totalTaxAmount,jdbcType=DECIMAL},
      </if>
      <if test="applicationDescription != null">
        application_description = #{applicationDescription,jdbcType=VARCHAR},
      </if>
      <if test="applicantManager != null">
        applicant_manager = #{applicantManager,jdbcType=VARCHAR},
      </if>
      <if test="invoiceCode != null">
        invoice_code = #{invoiceCode,jdbcType=VARCHAR},
      </if>
      <if test="invoiceNumber != null">
        invoice_number = #{invoiceNumber,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTable">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update red_letter_info_table
    set organization_id = #{organizationId,jdbcType=VARCHAR},
      project_id = #{projectId,jdbcType=VARCHAR},
      period = #{period,jdbcType=INTEGER},
      tms_period = #{tmsPeriod,jdbcType=INTEGER},
      fill_in_date = #{fillInDate,jdbcType=TIMESTAMP},
      subject_num = #{subjectNum,jdbcType=VARCHAR},
      subject_name = #{subjectName,jdbcType=VARCHAR},
      red_letter_invoice_info_table_num = #{redLetterInvoiceInfoTableNum,jdbcType=VARCHAR},
      sales_tax_number = #{salesTaxNumber,jdbcType=VARCHAR},
      salesperson_name = #{salespersonName,jdbcType=VARCHAR},
      total_amount = #{totalAmount,jdbcType=DECIMAL},
      total_tax_amount = #{totalTaxAmount,jdbcType=DECIMAL},
      application_description = #{applicationDescription,jdbcType=VARCHAR},
      applicant_manager = #{applicantManager,jdbcType=VARCHAR},
      invoice_code = #{invoiceCode,jdbcType=VARCHAR},
      invoice_number = #{invoiceNumber,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.RedLetterInfoTableExample" 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 red_letter_info_table
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>