<?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.CellTemplateConfigMapper"> <select id="getCellTemplateConfigByTemplateId" parameterType="java.lang.Long" resultMap="BaseResultMap"> SELECT B.* FROM CELL_TEMPLATE A JOIN CELL_TEMPLATE_CONFIG B ON A.ID = B.CELL_TEMPLATE_ID WHERE A.REPORT_TEMPLATE_ID = #{TEMPLATEID,JDBCTYPE=VARCHAR} </select> <delete id="deleteCellTemplateConfigByCellTemplate" parameterType="java.lang.Long"> DELETE A . * FROM CELL_TEMPLATE_CONFIG A WHERE ID IN (SELECT ID FROM (SELECT B.ID FROM CELL_TEMPLATE_CONFIG B INNER JOIN CELL_TEMPLATE C ON B.CELL_TEMPLATE_ID = C.ID WHER C.REPORT_TEMPLATE_ID = #{TEMPLATEDBID,JDBCTYPE=VARCHAR}) X) </delete> <insert id="batchInsert" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig"> INSERT INTO TAX_ADMIN.CELL_TEMPLATE_CONFIG (ID, CELL_TEMPLATE_ID, REPORT_TEMPLATE_ID, DATA_SOURCE_TYPE, FORMULA, FORMULA_DESCRIPTION, ACCOUNT_CODES, INVOICE_TYPE, TAX_RATE, INVOICE_AMOUNT_TYPE, MODEL_IDS, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, INVOICE_CATEGORY, FORMULA_DATA_SOURCE, VALIDATION, VALIDATION_DESCRIPTION, VOUCHER_KEYWORD ) VALUES <foreach collection="list" item="item" separator=","> <trim prefix="(" suffix=")" suffixOverrides=","> <choose> <when test="item.id != null"> #{item.id,jdbcType=BIGINT}, </when> </choose> <choose> <when test="item.cellTemplateId != null"> #{item.cellTemplateId,jdbcType=BIGINT}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.reportTemplateId != null"> #{item.reportTemplateId,jdbcType=BIGINT}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.dataSourceType != null"> #{item.dataSourceType,jdbcType=INTEGER}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.formula != null"> #{item.formula,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.formulaDescription != null"> #{item.formulaDescription,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.accountCodes != null"> #{item.accountCodes,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.invoiceType != null"> #{item.invoiceType,jdbcType=INTEGER}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.taxRate != null"> #{item.taxRate,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.invoiceAmountType != null"> #{item.invoiceAmountType,jdbcType=INTEGER}, </when> <otherwise> 0, </otherwise> </choose> <choose> <when test="item.modelIds != null"> #{item.modelIds,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.createBy != null"> #{item.createBy,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.createTime != null"> #{item.createTime,jdbcType=TIMESTAMP}, </when> <otherwise> '1970-01-01 08:00:00', </otherwise> </choose> <choose> <when test="item.updateBy != null"> #{item.updateBy,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.updateTime != null"> #{item.updateTime,jdbcType=TIMESTAMP}, </when> <otherwise> '1970-01-01 08:00:00', </otherwise> </choose> <choose> <when test="item.invoiceCategory != null"> #{item.invoiceCategory,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.formulaDataSource != null"> #{item.formulaDataSource,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.validation != null"> #{item.validation,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.validationDescription != null"> #{item.validationDescription,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> <choose> <when test="item.voucherKeyword != null"> #{item.voucherKeyword,jdbcType=VARCHAR}, </when> <otherwise> '', </otherwise> </choose> </trim> </foreach> </insert> <insert id="batchInsert2" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig"> INSERT INTO TAX_ADMIN.CELL_TEMPLATE_CONFIG (ID, CELL_TEMPLATE_ID, REPORT_TEMPLATE_ID, DATA_SOURCE_TYPE, FORMULA, FORMULA_DESCRIPTION, ACCOUNT_CODES, INVOICE_TYPE, TAX_RATE, INVOICE_AMOUNT_TYPE, MODEL_IDS, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, INVOICE_CATEGORY, FORMULA_DATA_SOURCE, VALIDATION, VALIDATION_DESCRIPTION, VOUCHER_KEYWORD ) VALUES <foreach collection="list" item="item" separator=","> (#{item.id,jdbcType=INTEGER}, #{item.cellTemplateId,jdbcType=INTEGER}, #{item.reportTemplateId,jdbcType=INTEGER}, #{item.dataSourceType,jdbcType=INTEGER}, #{item.formula,jdbcType=VARCHAR}, #{item.formulaDescription,jdbcType=VARCHAR}, #{item.accountCodes,jdbcType=VARCHAR}, #{item.invoiceType,jdbcType=INTEGER}, #{item.taxRate,jdbcType=VARCHAR}, #{item.invoiceAmountType,jdbcType=INTEGER}, #{item.modelIds,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.invoiceCategory,jdbcType=VARCHAR}, #{item.formulaDataSource,jdbcType=VARCHAR}, #{item.validation,jdbcType=VARCHAR}, #{item.validationDescription,jdbcType=VARCHAR}, #{item.voucherKeyword,jdbcType=VARCHAR}) </foreach> </insert> </mapper>