Commit 705fa1c9 authored by neo.wang's avatar neo.wang

Merge branch 'dev_oracle_neo' into 'dev_oracle'

Dev oracle neo

See merge request root/atms!132
parents db1e59fc 5e27a921
...@@ -69,6 +69,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -69,6 +69,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
int period = periodParam != null ? periodParam : 0; int period = periodParam != null ? periodParam : 0;
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
if(templateIds.isEmpty())templateIds.add(Long.MAX_VALUE);
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andIdIn(templateIds); periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andIdIn(templateIds);
...@@ -80,6 +81,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -80,6 +81,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
Long templateGroupId = periodTemplateList.size() > 0 ? periodTemplateList.get(0).getTemplateGroupId() : 0; Long templateGroupId = periodTemplateList.size() > 0 ? periodTemplateList.get(0).getTemplateGroupId() : 0;
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample(); PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
if(periodTemplateIdList.isEmpty())periodTemplateIdList.add(Long.MAX_VALUE);
periodCellTemplateExample.createCriteria().andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period); periodCellTemplateExample.createCriteria().andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
List<PeriodCellTemplate> periodCellTemplateList = periodCellTemplateMapper.selectByExample(periodCellTemplateExample); List<PeriodCellTemplate> periodCellTemplateList = periodCellTemplateMapper.selectByExample(periodCellTemplateExample);
......
package pwc.taxtech.atms.vat.service.impl; package pwc.taxtech.atms.vat.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
...@@ -25,6 +27,8 @@ import pwc.taxtech.atms.dto.vatdto.VatEnterpriseAccountResultDto; ...@@ -25,6 +27,8 @@ import pwc.taxtech.atms.dto.vatdto.VatEnterpriseAccountResultDto;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.NotSupportedException; import pwc.taxtech.atms.exception.NotSupportedException;
import pwc.taxtech.atms.service.impl.CellConfigTranslater; import pwc.taxtech.atms.service.impl.CellConfigTranslater;
import pwc.taxtech.atms.vat.dao.PeriodTaxPayerReportRuleMapper;
import pwc.taxtech.atms.vat.dao.PeriodTaxRuleSettingMapper;
import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto; import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto; import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto;
import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto; import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto;
...@@ -44,10 +48,13 @@ import java.util.regex.Matcher; ...@@ -44,10 +48,13 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.SpringContextUtil.periodEnterpriseAccountMapper;
@Component @Component
public class ReportServiceImpl extends VatAbstractService implements ReportService { public class ReportServiceImpl extends VatAbstractService implements ReportService {
@Autowired
private PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper;
@Autowired
private PeriodTaxPayerReportRuleMapper periodTaxPayerReportRuleMapper;
@Override @Override
public OperationResultDto<List<ReportDto>> getReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) { public OperationResultDto<List<ReportDto>> getReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
int period = periodParam != null ? periodParam : 0; int period = periodParam != null ? periodParam : 0;
...@@ -116,6 +123,63 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -116,6 +123,63 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
return operationResult; return operationResult;
} }
private void clearPeriodData(String projectId, Integer period, List<Long> templateIds) {
if (templateIds.isEmpty()) templateIds.add(Long.MAX_VALUE);
PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
periodFormulaBlockExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodFormulaBlockMapper.deleteByExample(periodFormulaBlockExample);
PeriodTaxRuleSettingExample periodTaxRuleSettingExample = new PeriodTaxRuleSettingExample();
periodTaxRuleSettingExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodTaxRuleSettingMapper.deleteByExample(periodTaxRuleSettingExample);
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
periodCellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportTemplateIdIn(templateIds);
periodCellTemplateMapper.deleteByExample(periodCellTemplateExample);
PeriodCellTemplateConfigExample periodCellTemplateConfigExample = new PeriodCellTemplateConfigExample();
periodCellTemplateConfigExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportTemplateIdIn(templateIds);
periodCellTemplateConfigMapper.deleteByExample(periodCellTemplateConfigExample);
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andTemplateIdIn(templateIds);
periodTemplateMapper.deleteByExample(periodTemplateExample);
PeriodTaxPayerReportRuleExample periodTaxPayerReportRuleExample = new PeriodTaxPayerReportRuleExample();
periodTaxPayerReportRuleExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodTaxPayerReportRuleMapper.deleteByExample(periodTaxPayerReportRuleExample);
PeriodDataSourceExample periodDataSourceExample = new PeriodDataSourceExample();
periodDataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
List<PeriodDataSource> periodDataSources = periodDataSourceMapper.selectByExample(periodDataSourceExample);
List<Long> periodDsIds = Lists.newArrayList(Long.MAX_VALUE);
periodDsIds.addAll(periodDataSources.stream().map(m -> m.getId()).collect(Collectors.toList()));
PeriodDataSourceDetailExample periodDataSourceDetailExample = new PeriodDataSourceDetailExample();
periodDataSourceDetailExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andDataSourceIdIn(periodDsIds);
periodDataSourceDetailMapper.deleteByExample(periodDataSourceDetailExample);
PeriodCellDataSourceExample periodCellDataSourceExample = new PeriodCellDataSourceExample();
periodCellDataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andDataSourceIdIn(periodDsIds);
periodCellDataSourceMapper.deleteByExample(periodCellDataSourceExample);
periodDataSourceMapper.deleteByExample(periodDataSourceExample);
PeriodReportExample periodReportExample = new PeriodReportExample();
periodReportExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
List<PeriodReport> reports = periodReportMapper.selectByExample(periodReportExample);
List<Long> reportIds = Lists.newArrayList(Long.MAX_VALUE);
reportIds.addAll(reports.stream().map(m -> m.getId()).collect(Collectors.toList()));
PeriodCellDataExample periodCellDataExample = new PeriodCellDataExample();
periodCellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportIdIn(
reportIds);
periodCellDataMapper.deleteByExample(periodCellDataExample);
periodReportMapper.deleteByExample(periodReportExample);
}
@Override @Override
public OperationResultDto updateConfig(String projectId, Integer period, Boolean ifDeleteManualDataSource, String generator) { public OperationResultDto updateConfig(String projectId, Integer period, Boolean ifDeleteManualDataSource, String generator) {
OperationResultDto result = new OperationResultDto(); OperationResultDto result = new OperationResultDto();
...@@ -157,7 +221,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -157,7 +221,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// dataSourceMapper.clearDataSourceWithPeriod(period); // dataSourceMapper.clearDataSourceWithPeriod(period);
// dataSourceMapper.clearCellDataWithPeriod(strExceptTemplateIds, period); // dataSourceMapper.clearCellDataWithPeriod(strExceptTemplateIds, period);
// dataSourceMapper.clearReportWithPeriod(period); // dataSourceMapper.clearReportWithPeriod(period);
periodDataSourceMapper.clearDataWithPeriod(strExceptTemplateIds, period);
clearPeriodData(projectId, period, exceptTemplateIds);
// 根据templategroupid 把 template 插入到 periodTemplate // 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId); example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId);
...@@ -248,7 +313,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -248,7 +313,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// periodCellTemplateConfig.setReportTemplateId(cellTemplateConfig.getReportTemplateId()); // periodCellTemplateConfig.setReportTemplateId(cellTemplateConfig.getReportTemplateId());
// periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType()); // periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
// periodCellTemplateConfig.setFormula(cellTemplateConfig.getFormula()); // periodCellTemplateConfig.setFormula(cellTemplateConfig.getFormula());
periodCellTemplateConfig.setParsedFormula(StringUtils.EMPTY); periodCellTemplateConfig.setParsedFormula(null);
// periodCellTemplateConfig.setFormulaDescription(cellTemplateConfig.getFormulaDescription()); // periodCellTemplateConfig.setFormulaDescription(cellTemplateConfig.getFormulaDescription());
// periodCellTemplateConfig.setAccountCodes(cellTemplateConfig.getAccountCodes()); // periodCellTemplateConfig.setAccountCodes(cellTemplateConfig.getAccountCodes());
// periodCellTemplateConfig.setInvoiceType(cellTemplateConfig.getInvoiceType()); // periodCellTemplateConfig.setInvoiceType(cellTemplateConfig.getInvoiceType());
...@@ -262,13 +327,13 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -262,13 +327,13 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// periodCellTemplateConfig.setInvoiceCategory(cellTemplateConfig.getInvoiceCategory()); // periodCellTemplateConfig.setInvoiceCategory(cellTemplateConfig.getInvoiceCategory());
// periodCellTemplateConfig.setFormulaDataSource(cellTemplateConfig.getFormulaDataSource()); // periodCellTemplateConfig.setFormulaDataSource(cellTemplateConfig.getFormulaDataSource());
// periodCellTemplateConfig.setValidation(cellTemplateConfig.getValidation()); // periodCellTemplateConfig.setValidation(cellTemplateConfig.getValidation());
periodCellTemplateConfig.setParsedValidation(StringUtils.EMPTY); periodCellTemplateConfig.setParsedValidation(null);
// periodCellTemplateConfig.setValidationDescription(cellTemplateConfig.getValidationDescription()); // periodCellTemplateConfig.setValidationDescription(cellTemplateConfig.getValidationDescription());
// periodCellTemplateConfig.setVoucherKeyword(cellTemplateConfig.getVoucherKeyword()); // periodCellTemplateConfig.setVoucherKeyword(cellTemplateConfig.getVoucherKeyword());
periodCellTemplateConfig.setCellTemplateConfigId(cellTemplateConfig.getId()); periodCellTemplateConfig.setCellTemplateConfigId(cellTemplateConfig.getId());
periodCellTemplateConfig.setKeyValueParsedFormula(StringUtils.EMPTY); periodCellTemplateConfig.setKeyValueParsedFormula(null);
periodCellTemplateConfig.setProjectId(projectId); periodCellTemplateConfig.setProjectId(projectId);
if (cellTemplateConfig.getFormula().contains("@")) { if (cellTemplateConfig.getFormula() != null && cellTemplateConfig.getFormula().contains("@")) {
String regex = "@[0-9A-Z.]+"; String regex = "@[0-9A-Z.]+";
Pattern pp = Pattern.compile(regex); Pattern pp = Pattern.compile(regex);
Matcher mm = pp.matcher(cellTemplateConfig.getFormula()); Matcher mm = pp.matcher(cellTemplateConfig.getFormula());
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.PeriodCellTemplateConfigMapper"> <mapper namespace="pwc.taxtech.atms.vat.dao.PeriodCellTemplateConfigMapper">
<insert id="batchInsert"> <insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig">
INSERT INTO INSERT ALL
PERIOD_CELL_TEMPLATE_CONFIG ( <foreach collection="list" item="item">
INTO PERIOD_CELL_TEMPLATE_CONFIG (
ID, ID,
PERIOD, PERIOD,
CELL_TEMPLATE_ID, CELL_TEMPLATE_ID,
...@@ -30,40 +31,117 @@ ...@@ -30,40 +31,117 @@
VOUCHER_KEYWORD, VOUCHER_KEYWORD,
CELL_TEMPLATE_CONFIG_ID, CELL_TEMPLATE_CONFIG_ID,
KEY_VALUE_PARSED_FORMULA KEY_VALUE_PARSED_FORMULA
) ) VALUES
VALUES <trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="list" item="item" separator=","> <choose>
( <when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
#{item.id,jdbcType=INTEGER}, <otherwise>0,</otherwise>
#{item.period,jdbcType=INTEGER}, </choose>
#{item.cellTemplateId,jdbcType=INTEGER}, <choose>
#{item.reportTemplateId,jdbcType=INTEGER}, <when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
#{item.dataSourceType,jdbcType=INTEGER}, <otherwise>0,</otherwise>
#{item.formula,jdbcType=VARCHAR}, </choose>
#{item.parsedFormula,jdbcType=VARCHAR}, <choose>
#{item.formulaDescription,jdbcType=VARCHAR}, <when test="item.cellTemplateId != null">#{item.cellTemplateId,jdbcType=INTEGER},</when>
#{item.accountCodes,jdbcType=VARCHAR}, <otherwise>0,</otherwise>
#{item.invoiceType,jdbcType=INTEGER}, </choose>
#{item.taxRate,jdbcType=VARCHAR}, <choose>
#{item.invoiceAmountType,jdbcType=INTEGER}, <when test="item.reportTemplateId != null">#{item.reportTemplateId,jdbcType=INTEGER},</when>
#{item.modelIds,jdbcType=VARCHAR}, <otherwise>0,</otherwise>
#{item.createBy,jdbcType=VARCHAR}, </choose>
#{item.createTime,jdbcType=TIMESTAMP}, <choose>
#{item.updateBy,jdbcType=VARCHAR}, <when test="item.dataSourceType != null">#{item.dataSourceType,jdbcType=INTEGER},</when>
#{item.updateTime,jdbcType=TIMESTAMP}, <otherwise>0,</otherwise>
#{item.invoiceCategory,jdbcType=VARCHAR}, </choose>
#{item.formulaDataSource,jdbcType=VARCHAR}, <choose>
#{item.validation,jdbcType=VARCHAR}, <when test="item.formula != null">#{item.formula,jdbcType=VARCHAR},</when>
#{item.parsedValidation,jdbcType=VARCHAR}, <otherwise>' ',</otherwise>
#{item.validationDescription,jdbcType=VARCHAR}, </choose>
#{item.voucherKeyword,jdbcType=VARCHAR}, <choose>
#{item.cellTemplateConfigId,jdbcType=INTEGER}, <when test="item.parsedFormula != null">#{item.parsedFormula,jdbcType=VARCHAR},</when>
#{item.keyValueParsedFormula,jdbcType=VARCHAR} <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>to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),</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>to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),</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.parsedValidation != null">#{item.parsedValidation,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>
<choose>
<when test="item.cellTemplateConfigId != null">#{item.cellTemplateConfigId,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.keyValueParsedFormula != null">#{item.keyValueParsedFormula,jdbcType=VARCHAR}
</when>
<otherwise>' ',</otherwise>
</choose>
</trim>
</foreach> </foreach>
SELECT 1 FROM DUAL
</insert> </insert>
<resultMap extends="BaseResultMap" id="periodCellTemplateConfigExtendDtoMap" type="pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto"> <resultMap extends="BaseResultMap" id="periodCellTemplateConfigExtendDtoMap"
type="pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto">
<result column="COLUMN_INDEX" jdbcType="INTEGER" property="columnIndex"/> <result column="COLUMN_INDEX" jdbcType="INTEGER" property="columnIndex"/>
<result column="ROW_INDEX" jdbcType="INTEGER" property="rowIndex"/> <result column="ROW_INDEX" jdbcType="INTEGER" property="rowIndex"/>
<result column="COLUMN_NAME" jdbcType="VARCHAR" property="columnName"/> <result column="COLUMN_NAME" jdbcType="VARCHAR" property="columnName"/>
......
...@@ -2,17 +2,18 @@ ...@@ -2,17 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.PeriodCellTemplateMapper"> <mapper namespace="pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper">
<insert id="batchInsert"> <insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellTemplate">
INSERT INTO INSERT ALL
PERIOD_CELL_TEMPLATE ( <foreach collection="list" item="item">
INTO PERIOD_CELL_TEMPLATE (
ID, ID,
PERIOD, PERIOD,
REPORT_TEMPLATE_ID, REPORT_TEMPLATE_ID,
ROW_INDEX, ROW_INDEX,
ROW_NAME, ROW_NAME,
COLUMN_INDEX, COLUMN_INDEX,
`COLUMN_NAME`, "COLUMN_NAME",
`COMMENT`, "COMMENT",
CREATE_TIME, CREATE_TIME,
UPDATE_TIME, UPDATE_TIME,
CELL_TEMPLATE_ID, CELL_TEMPLATE_ID,
...@@ -21,28 +22,75 @@ ...@@ -21,28 +22,75 @@
COPY_FROM_ID, COPY_FROM_ID,
CREATE_BY, CREATE_BY,
UPDATE_BY UPDATE_BY
) ) VALUES
VALUES <trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="list" item="item" separator=","> <choose>
( <when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
#{item.id,jdbcType=INTEGER}, <otherwise>0,</otherwise>
#{item.period,jdbcType=INTEGER}, </choose>
#{item.reportTemplateId,jdbcType=INTEGER}, <choose>
#{item.rowIndex,jdbcType=INTEGER}, <when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
#{item.rowName,jdbcType=VARCHAR}, <otherwise>0,</otherwise>
#{item.columnIndex,jdbcType=INTEGER}, </choose>
#{item.columnName,jdbcType=VARCHAR}, <choose>
#{item.comment,jdbcType=VARCHAR}, <when test="item.reportTemplateId != null">#{item.reportTemplateId,jdbcType=INTEGER},</when>
#{item.createTime,jdbcType=TIMESTAMP}, <otherwise>0,</otherwise>
#{item.updateTime,jdbcType=TIMESTAMP}, </choose>
#{item.cellTemplateId,jdbcType=INTEGER}, <choose>
#{item.dataType,jdbcType=INTEGER}, <when test="item.rowIndex != null">#{item.rowIndex,jdbcType=INTEGER},</when>
#{item.isReadOnly,jdbcType=INTEGER}, <otherwise>0,</otherwise>
#{item.copyFromId,jdbcType=INTEGER}, </choose>
#{item.createBy,jdbcType=VARCHAR}, <choose>
#{item.updateBy,jdbcType=VARCHAR} <when test="item.rowName != null">#{item.rowName,jdbcType=VARCHAR},</when>
) <otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.columnIndex != null">#{item.columnIndex,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.columnName != null">#{item.columnName,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.comment != null">#{item.comment,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.createTime != null">#{item.createTime,jdbcType=TIMESTAMP},</when>
<otherwise>to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),</otherwise>
</choose>
<choose>
<when test="item.updateTime != null">#{item.updateTime,jdbcType=TIMESTAMP},</when>
<otherwise>to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),</otherwise>
</choose>
<choose>
<when test="item.cellTemplateId != null">#{item.cellTemplateId,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.dataType != null">#{item.dataType,jdbcType=INTEGER},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.isReadOnly != null">#{item.isReadOnly,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.copyFromId != null">#{item.copyFromId,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">#{item.updateBy,jdbcType=VARCHAR}</when>
<otherwise>' ',</otherwise>
</choose>
</trim>
</foreach> </foreach>
SELECT 1 FROM DUAL
</insert> </insert>
<select id="getCellTemplateIdWithMap" resultType="java.lang.Long"> <select id="getCellTemplateIdWithMap" resultType="java.lang.Long">
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.PeriodTemplateMapper"> <mapper namespace="pwc.taxtech.atms.vat.dao.PeriodTemplateMapper">
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodTemplate">
<insert id="batchInsert"> INSERT ALL
INSERT INTO <foreach collection="list" item="item">
PERIOD_TEMPLATE ( INTO PERIOD_TEMPLATE (
ID, ID,
PERIOD, PERIOD,
`NAME`, "NAME",
`CODE`, "CODE",
PATH, PATH,
REPORT_TYPE, REPORT_TYPE,
TEMPLATE_GROUP_ID, TEMPLATE_GROUP_ID,
...@@ -21,28 +21,75 @@ ...@@ -21,28 +21,75 @@
TEMPLATE_ID, TEMPLATE_ID,
CREATE_BY, CREATE_BY,
UPDATE_BY UPDATE_BY
) ) VALUES
VALUES <trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="list" item="item" separator=","> <choose>
( <when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
#{item.id,jdbcType=INTEGER}, <otherwise>0,</otherwise>
#{item.period,jdbcType=INTEGER}, </choose>
#{item.name,jdbcType=VARCHAR}, <choose>
#{item.code,jdbcType=VARCHAR}, <when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
#{item.path,jdbcType=VARCHAR}, <otherwise>0,</otherwise>
#{item.reportType,jdbcType=INTEGER}, </choose>
#{item.templateGroupId,jdbcType=INTEGER}, <choose>
#{item.orderIndex,jdbcType=INTEGER}, <when test="item.name != null">#{item.name,jdbcType=VARCHAR},</when>
#{item.createTime,jdbcType=TIMESTAMP}, <otherwise>' ',</otherwise>
#{item.updateTime,jdbcType=TIMESTAMP}, </choose>
#{item.isSystemType,jdbcType=INTEGER}, <choose>
#{item.isActiveAssociation,jdbcType=INTEGER}, <when test="item.code != null">#{item.code,jdbcType=VARCHAR},</when>
#{item.parentId,jdbcType=VARCHAR}, <otherwise>' ',</otherwise>
#{item.templateId,jdbcType=INTEGER}, </choose>
#{item.createBy,jdbcType=VARCHAR}, <choose>
#{item.updateBy,jdbcType=VARCHAR} <when test="item.path != null">#{item.path,jdbcType=VARCHAR},</when>
) <otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.reportType != null">#{item.reportType,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.templateGroupId != null">#{item.templateGroupId,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.orderIndex != null">#{item.orderIndex,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.createTime != null">#{item.createTime,jdbcType=TIMESTAMP},</when>
<otherwise>to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),</otherwise>
</choose>
<choose>
<when test="item.updateTime != null">#{item.updateTime,jdbcType=TIMESTAMP},</when>
<otherwise>to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),</otherwise>
</choose>
<choose>
<when test="item.isSystemType != null">#{item.isSystemType,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.isActiveAssociation != null">#{item.isActiveAssociation,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.parentId != null">#{item.parentId,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.templateId != null">#{item.templateId,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">#{item.updateBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
</choose>
</trim>
</foreach> </foreach>
SELECT 1 FROM DUAL
</insert> </insert>
<resultMap id="cellTemplatePerGroupDto" type="pwc.taxtech.atms.dpo.CellTemplatePerGroupDto"> <resultMap id="cellTemplatePerGroupDto" type="pwc.taxtech.atms.dpo.CellTemplatePerGroupDto">
...@@ -55,7 +102,7 @@ ...@@ -55,7 +102,7 @@
TEMPLATE.TEMPLATE_GROUP_ID AS REPORT_TEMPLATE_GROUP_ID, TEMPLATE.TEMPLATE_GROUP_ID AS REPORT_TEMPLATE_GROUP_ID,
IFNULL ( IFNULL (
CELLTEMPLATECONFIG.FORMULA, CELLTEMPLATECONFIG.FORMULA,
'' ' '
) )
AS FORMULA, AS FORMULA,
CELLTEMPLATE.ROW_INDEX AS ROW_INDEX, CELLTEMPLATE.ROW_INDEX AS ROW_INDEX,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment