Commit bcefaafa authored by gary's avatar gary

sql debug

parent 8100abcc
......@@ -106,13 +106,13 @@ public class EnterpriseAccountDao {
"CASE WHEN Acct_Prop<>Std_Acct_Prop THEN 1 ELSE 0 END Is_Acct_Prop_Diff," +
"CASE WHEN Std_Account_Code IS NULL THEN 0 ELSE 1 END Mapping_Status, " +
"CASE WHEN Std_Account_Code IS NULL THEN Acct_Prop ELSE Std_Acct_Prop END Acct_Prop, Parent_Code, Acct_Level, Std_Account_Code Acct_Std_Code, Is_Leaf " +
" FROM (SELECT id,Code,\"NAME\",Full_Name,Direction,Acct_Prop,Parent_Code,Acct_Level,Is_Leaf FROM Enterprise_Account WHERE Enterprise_Account_Set_Id=?) ea " +
"LEFT JOIN (SELECT Enterprise_Account_Code ,Standard_Account_Code FROM Account_Mapping WHERE Organization_Id=? AND Industry_Id=?) am ON ea.Code=am.Enterprise_Account_Code " +
"LEFT JOIN (SELECT id as Std_Id, Code as Std_Account_Code, \"NAME\" as Std_Name, Full_Name as Std_Full_Name,Direction Std_Direction,Acct_Prop Std_Acct_Prop FROM Standard_Account WHERE Industry_Id=?) sa ON am.Standard_Account_Code=sa.Std_Account_Code ) T";
" FROM (SELECT id as id,code as Code,name as NAME,full_name as Full_Name,direction as Direction,acct_prop as Acct_Prop,parent_code as Parent_Code,acct_level as Acct_Level,is_leaf as Is_Leaf FROM enterprise_account WHERE enterprise_account_set_id=?) ea " +
"LEFT JOIN (SELECT enterprise_account_code as Enterprise_Account_Code,standard_account_code as Standard_Account_Code FROM account_mapping WHERE organization_id=? AND industry_id=?) am ON ea.Code=am.Enterprise_Account_Code " +
"LEFT JOIN (SELECT id as Std_Id, code as Std_Account_Code, name as Std_Name, full_name as Std_Full_Name,direction as Std_Direction,acct_prop as Std_Acct_Prop FROM standard_account WHERE industry_id=?) sa ON am.Standard_Account_Code=sa.Std_Account_Code ) T";
List<Object> params = Lists.newArrayList(accountSetId, organizationId, industryId, industryId);
if (iAcctProp != EnterpriseAccountConstant.InvalidId) {
sql += "Acct_Prop = ?";
sql += "acct_prop = ?";
params.add(iAcctProp);
}
if (iIsMapped == AccountMappingConstant.Status.UNMAPPED.getCode()) {
......@@ -125,11 +125,11 @@ public class EnterpriseAccountDao {
sql += "Std_Code IS NOT NULL AND Is_Acct_Prop_Diff=1";
}
if (iLevel != EnterpriseAccountConstant.InvalidId) {
sql += "Acct_Level = ?";
sql += "acct_level = ?";
params.add(iLevel);
}
sql += " ORDER BY Code";
sql += " ORDER BY code";
return jdbcTemplate.queryForList(sql, params.toArray());
}
......
......@@ -108,6 +108,8 @@ public interface AssetsListMapper extends MyVatMapper {
*/
int updateByPrimaryKey(AssetsList record);
// todo 26/12/2018 缺少Oracle中的TAX_PROJECT.ASSETS_LIST表 未修改
List<AssetDetailResultDto> getAssetDetialResult(@Param("dbName") String dbName, @Param("assetType") Integer assetType,
@Param("assetDetailType") Integer assetDetailType);
}
\ No newline at end of file
......@@ -108,6 +108,7 @@ public interface BalanceMapper extends MyVatMapper {
*/
int updateByPrimaryKey(Balance record);
// todo 26/12/2018 缺少Oracle中的TAX_PROJECT.BALANCE 未修改
BigDecimal getSumOfBalance(@Param("acctCode") String acctCode, @Param("direction") int direction, @Param("period") int period);
BigDecimal getFirstOfBalance(@Param("acctCode") String acctCode, @Param("direction") int direction, @Param("period") int period);
......
......@@ -110,5 +110,6 @@ public interface BalanceStdManualMapper extends MyVatMapper {
BalanceStdManual selectOneWithAccountCodeAndDBName(@Param("accountCode") String accountCode, @Param("dbName") String dbName,
@Param("period") int period);
// todo 26/12/2018 缺少Oracle中的TAX_PROJECT.BALANCE_STD_MANUAL 未修改
BalanceStdManual selectOneWithAccountCode(@Param("accountCode") String accountCode, @Param("period") int period);
}
\ No newline at end of file
......@@ -107,5 +107,6 @@ public interface CompanyBalanceMapper extends MyVatMapper {
*/
int updateByPrimaryKey(CompanyBalance record);
// todo 26/12/2018 缺少Oracle中的TAX_PROJECT.COMPANY_BALANCE 未修改
List<TrialBalanceDto> companyBalanceLeftJoinEnterpriseAccount(@Param("fromMonth") String fromMonth, @Param("toMonth") String toMonth);
}
\ No newline at end of file
......@@ -5,33 +5,34 @@
SELECT
B.*
FROM
CellTemplate_20180622 A
cell_template A
JOIN
CellTemplateConfig_20180622 B ON A.ID = B.CellTemplateID
cell_template_config B ON A.id = B.cell_template_id
WHERE
A.ReportTemplateID = #{templateId,jdbcType=VARCHAR}
A.report_template_id = #{templateId,jdbcType=VARCHAR}
</select>
<delete id="deleteCellTemplateConfigByCellTemplate" parameterType="java.lang.Long">
DELETE FROM CellTemplateConfig_20180622 A
DELETE FROM cell_template_config A
WHERE
ID IN (SELECT
ID
id IN (SELECT
id
FROM
(SELECT
B.ID
B.id
FROM
CellTemplateConfig_20180622 B
INNER JOIN CellTemplate_20180622 C ON B.CellTemplateID = C.ID
cell_template_config B
INNER JOIN cell_template C ON B.cell_template_id = C.id
WHERE
C.ReportTemplateID = #{templateId,jdbcType=VARCHAR}) X)
C.report_template_id = #{templateId,jdbcType=VARCHAR}) X)
</delete>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig">
INSERT ALL
<foreach collection="list" item="item">
INTO CellTemplateConfig_20180622 VALUES
INSERT INTO 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" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">
......@@ -75,7 +76,7 @@
#{item.formulaDescription,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -131,7 +132,7 @@
#{item.createTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
CURRENT_TIMESTAMP,
</otherwise>
</choose>
<choose>
......@@ -147,7 +148,7 @@
#{item.updateTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
CURRENT_TIMESTAMP,
</otherwise>
</choose>
<choose>
......@@ -191,14 +192,15 @@
</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
<insert id="batchInsert2" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig">
INSERT ALL
<foreach collection="list" item="item" >
INTO CellTemplateConfig_20180622 VALUES
INSERT INTO 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" index="index" separator=",">
(#{item.id,jdbcType=INTEGER}, #{item.cellTemplateId,jdbcType=INTEGER},
#{item.reportTemplateId,jdbcType=INTEGER},
#{item.dataSourceType,jdbcType=INTEGER}, #{item.formula,jdbcType=VARCHAR},
......@@ -212,7 +214,7 @@
#{item.invoiceCategory,jdbcType=VARCHAR}, #{item.formulaDataSource,jdbcType=VARCHAR},
#{item.validation,jdbcType=VARCHAR},
#{item.validationDescription,jdbcType=VARCHAR}, #{item.voucherKeyword,jdbcType=VARCHAR})
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
......@@ -2,11 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.dao.CellTemplateMapper">
<insert id="batchInsert2">
INSERT ALL
<foreach collection="list" item="item">
INTO CellTemplate_20180622 VALUES
(
#{item.id,jdbcType=INTEGER},
INSERT INTO cell_template (id,report_template_id,row_index,row_name,column_index,column_name,comment,create_time,update_time,copy_from_id,data_type,is_read_only,create_by,update_by)
VALUES <foreach collection="list" item="item" index="index" separator=",">
(#{item.id,jdbcType=INTEGER},
#{item.reportTemplateId,jdbcType=INTEGER},
#{item.rowIndex,jdbcType=INTEGER},
#{item.rowName,jdbcType=VARCHAR},
......@@ -19,10 +17,9 @@
#{item.dataType,jdbcType=INTEGER},
#{item.isReadOnly,jdbcType=SMALLINT},
#{item.createBy,jdbcType=VARCHAR},
#{item.updateBy,jdbcType=VARCHAR}
)
</foreach>
SELECT 1 FROM DUAL
#{item.updateBy,jdbcType=VARCHAR})
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
......@@ -4,66 +4,52 @@
<select id="getInputVATInvoiceCountByCondition" parameterType="pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam" resultType="java.lang.Long">
SELECT
COUNT (
1
)
COUNT (1)
FROM
INPUT_VAT_INVOICE
input_vat_invoice
WHERE
1=1
<if test="paras.periodStart">
AND PERIOD_ID &gt;= #{paras.periodStart,jdbcType=VARCHAR}
AND period_id &gt;= #{paras.periodStart,jdbcType=VARCHAR}
</if>
<if test="paras.periodEnd">
AND PERIOD_ID &lt;= #{paras.periodEnd,jdbcType=VARCHAR}
AND period_id &lt;= #{paras.periodEnd,jdbcType=VARCHAR}
</if>
<if test="paras.certificationDateStart != null">
AND CERTIFICATION_DATE &gt;= #{paras.certificationDateStart,jdbcType=VARCHAR}
AND certification_date &gt;= #{paras.certificationDateStart,jdbcType=VARCHAR}
</if>
<if test="paras.certificationDateEnd != null">
AND CERTIFICATION_DATE &lt;= #{paras.certificationDateEnd,jdbcType=VARCHAR}
AND certification_date &lt;= #{paras.certificationDateEnd,jdbcType=VARCHAR}
</if>
<if test="paras.invoiceCode != null and paras.invoiceCode!=''">
AND INVOICE_CODE LIKE concat (
'%',
#{paras.invoiceCode,jdbcType=VARCHAR},
'%'
)
AND invoice_code LIKE concat ("%",#{paras.invoiceCode,jdbcType=VARCHAR},"%")
</if>
<if test="paras.invoiceNumber!=null and paras.invoiceNumber!=''">
AND INVOICE_NUMBER LIKE concat (
'%',
#{paras.invoiceNumber,jdbcType=VARCHAR},
'%'
)
AND invoice_number LIKE concat ("%",#{paras.invoiceNumber,jdbcType=VARCHAR},"%")
</if>
<if test="paras.sellerTaxNumber!=null and paras.sellerTaxNumber!=''">
AND SELLER_TAX_NUMBER LIKE concat (
'%',
#{paras.sellerTaxNumber,jdbcType=VARCHAR},
'%'
)
AND seller_tax_number LIKE concat ("%",#{paras.sellerTaxNumber,jdbcType=VARCHAR},"%")
</if>
<if test="paras.amountStart != null">
AND AMOUNT &gt;= #{paras.amountStart,jdbcType=DECIMAL}
AND amount &gt;= #{paras.amountStart,jdbcType=DECIMAL}
</if>
<if test="paras.amountEnd != null">
AND AMOUNT &lt;= #{paras.amountEnd,jdbcType=DECIMAL}
AND amount &lt;= #{paras.amountEnd,jdbcType=DECIMAL}
</if>
<if test="paras.taxAmountStart != null">
AND TAX_AMOUNT &gt;= #{paras.taxAmountStart,jdbcType=DECIMAL}
AND tax_amount &gt;= #{paras.taxAmountStart,jdbcType=DECIMAL}
</if>
<if test="paras.taxAmountEnd != null">
AND TAX_AMOUNT &lt;= #{paras.taxAmountEnd,jdbcType=DECIMAL}
AND tax_amount &lt;= #{paras.taxAmountEnd,jdbcType=DECIMAL}
</if>
<if test="paras.invoiceType!=null and paras.invoiceType!=999">
AND INVOICE_TYPE_= #{param.invoiceType,jdbcType=INTEGER}
AND invoice_type= #{param.invoiceType,jdbcType=INTEGER}
</if>
<if test="paras.certificationStatus==1">
AND CERTIFICATION_RESULT LIKE '%1%'
AND certification_result LIKE "%1%"
</if>
<if test="paras.certificationStatus==2">
AND CERTIFICATION_RESULT LIKE '%2%'
AND certification_result LIKE "%2%"
</if>
</select>
......@@ -88,23 +74,23 @@
</if>
<if test="paras.invoiceCode != null and paras.invoiceCode!=''">
AND INVOICE_CODE LIKE concat (
'%',
"%",
#{paras.invoiceCode,jdbcType=VARCHAR},
'%'
"%"
)
</if>
<if test="paras.invoiceNumber!=null and paras.invoiceNumber!=''">
AND INVOICE_NUMBER LIKE concat (
'%',
"%",
#{paras.invoiceNumber,jdbcType=VARCHAR},
'%'
"%"
)
</if>
<if test="paras.sellerTaxNumber!=null and paras.sellerTaxNumber!=''">
AND SELLER_TAX_NUMBER LIKE concat (
'%',
"%",
#{paras.sellerTaxNumber,jdbcType=VARCHAR},
'%'
"%"
)
</if>
<if test="paras.amountStart != null">
......
<?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.PeriodCellDataMapper">
<insert id="batchInsert2" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellData">
<!--<insert id="batchInsert2" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellData">
INSERT ALL
<foreach collection="list" item="item">
INTO PERIOD_CELL_DATA VALUES
......@@ -21,25 +21,24 @@
)
</foreach>
SELECT 1 FROM DUAL
</insert>
</insert>-->
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellData">
INSERT ALL
<foreach collection="list" item="item">
INTO PERIOD_CELL_DATA (
ID,
PERIOD,
REPORT_ID,
CELL_TEMPLATE_ID,
"DATA",
KEYIN_DATA,
FORMULA_EXP,
CREATE_TIME,
UPDATE_TIME,
CREATE_BY,
UPDATE_BY,
PROJECT_ID
INSERT INTO period_cell_data (
id,
period,
report_id,
cell_template_id,
data,
keyin_data,
formula_exp,
create_time,
update_time,
create_by,
update_by,
project_id
) VALUES
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
......@@ -59,38 +58,38 @@
</choose>
<choose>
<when test="item.data != null">#{item.data,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.formulaExp != null">#{item.formulaExp,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<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>
<otherwise>CURRENT_TIMESTAMP,</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>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">#{item.updateBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.keyinData != null">#{item.keyinData,jdbcType=VARCHAR},</when>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
......@@ -3,36 +3,34 @@
<mapper namespace="pwc.taxtech.atms.vat.dao.PeriodCellTemplateConfigMapper">
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig">
INSERT ALL
<foreach collection="list" item="item">
INTO PERIOD_CELL_TEMPLATE_CONFIG (
ID,
PERIOD,
CELL_TEMPLATE_ID,
REPORT_TEMPLATE_ID,
DATA_SOURCE_TYPE,
FORMULA,
PARSED_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,
PARSED_VALIDATION,
VALIDATION_DESCRIPTION,
VOUCHER_KEYWORD,
CELL_TEMPLATE_CONFIG_ID,
KEY_VALUE_PARSED_FORMULA,
PROJECT_ID
) VALUES
INSERT INTO period_cell_template_config(
id,
period,
cell_template_id,
report_template_id,
data_source_type,
formula,
parsed_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,
parsed_validation,
validation_description,
voucher_keyword,
cell_template_config_id,
key_value_parsed_formula,
project_id) VALUES
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
......@@ -56,19 +54,19 @@
</choose>
<choose>
<when test="item.formula != null">#{item.formula,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.parsedFormula != null">#{item.parsedFormula,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.formulaDescription != null">#{item.formulaDescription,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.accountCodes != null">#{item.accountCodes,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.invoiceType != null">#{item.invoiceType,jdbcType=INTEGER},</when>
......@@ -76,7 +74,7 @@
</choose>
<choose>
<when test="item.taxRate != null">#{item.taxRate,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.invoiceAmountType != null">#{item.invoiceAmountType,jdbcType=INTEGER},</when>
......@@ -84,48 +82,48 @@
</choose>
<choose>
<when test="item.modelIds != null">#{item.modelIds,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<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>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">#{item.updateBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<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>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.invoiceCategory != null">#{item.invoiceCategory,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.formulaDataSource != null">#{item.formulaDataSource,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.validation != null">#{item.validation,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.parsedValidation != null">#{item.parsedValidation,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.validationDescription != null">#{item.validationDescription,jdbcType=VARCHAR},
</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.voucherKeyword != null">#{item.voucherKeyword,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.cellTemplateConfigId != null">#{item.cellTemplateConfigId,jdbcType=INTEGER},</when>
......@@ -134,15 +132,15 @@
<choose>
<when test="item.keyValueParsedFormula != null">#{item.keyValueParsedFormula,jdbcType=VARCHAR},
</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
<resultMap extends="BaseResultMap" id="periodCellTemplateConfigExtendDtoMap"
......@@ -160,78 +158,78 @@
<select id="getPeriodCellTemplateConfigExtendDtos" resultMap="periodCellTemplateConfigExtendDtoMap">
SELECT
CONFIG.ID,
CONFIG.PERIOD,
CONFIG.CELL_TEMPLATE_ID,
CONFIG.REPORT_TEMPLATE_ID,
CONFIG.DATA_SOURCE_TYPE,
CONFIG.FORMULA,
CONFIG.PARSED_FORMULA,
CONFIG.FORMULA_DESCRIPTION,
CONFIG.ACCOUNT_CODES,
CONFIG.INVOICE_TYPE,
CONFIG.TAX_RATE,
CONFIG.INVOICE_AMOUNT_TYPE,
CONFIG.MODEL_IDS,
CONFIG.CREATE_BY,
CONFIG.CREATE_TIME,
CONFIG.UPDATE_BY,
CONFIG.UPDATE_TIME,
CONFIG.INVOICE_CATEGORY,
CONFIG.FORMULA_DATA_SOURCE,
CONFIG.VALIDATION,
CONFIG.PARSED_VALIDATION,
CONFIG.VALIDATION_DESCRIPTION,
CONFIG.VOUCHER_KEYWORD,
CONFIG.CELL_TEMPLATE_CONFIG_ID,
CONFIG.KEY_VALUE_PARSED_FORMULA,
CELL_TEMPLATE.COLUMN_INDEX,
CELL_TEMPLATE.ROW_INDEX,
CELL_TEMPLATE.COLUMN_NAME,
CELL_TEMPLATE.ROW_NAME,
CELL_TEMPLATE.DATA_TYPE,
CELL_TEMPLATE.IS_READ_ONLY,
CELL_TEMPLATE.ID AS CELL_TEMPLATE_ID,
CELL_TEMPLATE.REPORT_TEMPLATE_ID,
CELL_TEMPLATE."COMMENT"
config.id as ID,
config.period as PERIOD,
config.cell_template_id as CELL_TEMPLATE_ID,
config.report_template_id as REPORT_TEMPLATE_ID,
config.data_source_type as DATA_SOURCE_TYPE,
config.formula as FORMULA,
config.parsed_formula as PARSED_FORMULA,
config.formula_description as FORMULA_DESCRIPTION,
config.account_codes as ACCOUNT_CODES,
config.invoice_type as INVOICE_TYPE,
config.tax_rate as TAX_RATE,
config.invoice_amount_type as INVOICE_AMOUNT_TYPE,
config.model_ids as MODEL_IDS,
config.create_by as CREATE_BY,
config.create_time as CREATE_TIME,
config.update_by as UPDATE_BY,
config.update_time as UPDATE_TIME,
config.invoice_category as INVOICE_CATEGORY,
config.formula_data_source as FORMULA_DATA_SOURCE,
config.validation as VALIDATION,
config.parsed_validation as PARSED_VALIDATION,
config.validation_description as VALIDATION_DESCRIPTION,
config.voucher_keyword as VOUCHER_KEYWORD,
config.cell_template_config_id as CELL_TEMPLATE_CONFIG_ID,
config.key_value_parsed_formula as KEY_VALUE_PARSED_FORMULA,
ct.column_index as COLUMN_INDEX,
ct.row_index as ROW_INDEX,
ct.column_name as COLUMN_NAME,
ct.row_name as ROW_NAME,
ct.data_type as DATA_TYPE,
ct.is_read_only as IS_READ_ONLY,
ct.id AS CELL_TEMPLATE_ID,
ct.report_template_id as REPORT_TEMPLATE_ID,
ct.comment as COMMENT
FROM
PERIOD_CELL_TEMPLATE CELL_TEMPLATE
period_cell_template ct
JOIN
PERIOD_CELL_TEMPLATE_CONFIG CONFIG
period_cell_template_config config
ON
(
CELL_TEMPLATE.CELL_TEMPLATE_ID = CONFIG.CELL_TEMPLATE_ID
AND CELL_TEMPLATE.PERIOD = CONFIG.PERIOD
AND CELL_TEMPLATE.PROJECT_ID = CONFIG.PROJECT_ID
ct.cell_template_id = config.cell_template_id
AND ct.period = config.period
AND ct.project_id = config.project_id
)
WHERE
CELL_TEMPLATE.REPORT_TEMPLATE_ID IN
ct.report_template_id IN
<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
AND CELL_TEMPLATE.PERIOD = #{period,jdbcType=INTEGER}
AND CELL_TEMPLATE.PROJECT_ID = #{projectId,jdbcType=VARCHAR}
AND ct.period = #{period,jdbcType=INTEGER}
AND ct.project_id = #{projectId,jdbcType=VARCHAR}
</select>
<select id="getConfigWithReportTemplateId" resultType="pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig">
SELECT
CTC.ID,
CTC.ACCOUNT_CODES,
CTC.VOUCHER_KEYWORD
ctc.id as ID,
ctc.account_codes as ACCOUNT_CODES,
ctc.voucher_keyword as VOUCHER_KEYWORD
FROM
PERIOD_CELL_TEMPLATE CT
period_cell_template ct
JOIN
PERIOD_CELL_TEMPLATE_CONFIG CTC
period_cell_template_config ctc
ON
CT.CELL_TEMPLATE_ID = CTC.CELL_TEMPLATE_ID AND CT.PROJECT_ID=CTC.PROJECT_ID
ct.cell_template_id = ctc.cell_template_id AND ct.project_id=ctc.project_id
WHERE
CT.REPORT_TEMPLATE_ID = #{reportTemplateId,jdbcType=BIGINT}
AND CT.ROW_INDEX = #{rowIndex,jdbcType = INTEGER}
AND CT.COLUMN_INDEX = #{columnIndex,jdbcType = INTEGER}
AND CT.PERIOD = #{period,jdbcType = INTEGER}
AND CTC.DATA_SOURCE_TYPE = 2
AND CTC.PERIOD= #{period,jdbcType = INTEGER}
AND CT.PROJECT_ID = #{projectId,jdbcType=VARCHAR}
ct.report_template_id = #{reportTemplateId,jdbcType=BIGINT}
AND ct.row_index = #{rowIndex,jdbcType = INTEGER}
AND ct.column_index = #{columnIndex,jdbcType = INTEGER}
AND ct.period = #{period,jdbcType = INTEGER}
AND ctc.data_source_type = 2
AND ctc.period= #{period,jdbcType = INTEGER}
AND ct.project_id = #{projectId,jdbcType=VARCHAR}
LIMIT 1
</select>
......
......@@ -3,9 +3,26 @@
<mapper namespace="pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper">
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodCellTemplate">
INSERT ALL
INSERT INTO period_cell_template
(id,
period,
report_template_id,
row_index,
row_name,
column_index,
column_name,
comment,
create_time,
update_time,
cell_template_id,
data_type,
is_read_only,
copy_from_id,
create_by,
update_by,
project_id)
VALUES
<foreach collection="list" item="item">
INTO PERIOD_CELL_TEMPLATE VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
......@@ -25,7 +42,7 @@
</choose>
<choose>
<when test="item.rowName != null">#{item.rowName,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.columnIndex != null">#{item.columnIndex,jdbcType=INTEGER},</when>
......@@ -33,19 +50,19 @@
</choose>
<choose>
<when test="item.columnName != null">#{item.columnName,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.comment != null">#{item.comment,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<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>
<otherwise>CURRENT_TIMESTAMP,</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>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.cellTemplateId != null">#{item.cellTemplateId,jdbcType=INTEGER},</when>
......@@ -65,54 +82,54 @@
</choose>
<choose>
<when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">#{item.updateBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
<select id="getCellTemplateIdWithMap" resultType="java.lang.Long">
SELECT
A.CELL_TEMPLATE_ID
A.cell_template_id as CELL_TEMPLATE_ID
FROM
PERIOD_CELL_TEMPLATE A
period_cell_template A
JOIN
PERIOD_TEMPLATE B
period_template B
ON
A.REPORT_TEMPLATE_ID = B.TEMPLATE_ID
A.report_template_id = B.template_id
WHERE
B.CODE = #{code,jdbcType=VARCHAR}
AND B.TEMPLATE_GROUP_ID = #{templateGroupId,jdbcType=INTEGER}
AND B.PERIOD = #{period,jdbcType=INTEGER}
AND A.COLUMN_INDEX = #{columnIndex,jdbcType=INTEGER}
AND A.ROW_INDEX = #{rowIndex,jdbcType=INTEGER}
AND A.PERIOD = #{period,jdbcType=INTEGER}
AND A.PROJECT_ID=#{projectId,jdbcType=VARCHAR}
AND B.PROJECT_ID=#{projectId,jdbcType=VARCHAR}
B.code = #{code,jdbcType=VARCHAR}
AND B.template_group_id = #{templateGroupId,jdbcType=INTEGER}
AND B.period = #{period,jdbcType=INTEGER}
AND A.column_index = #{columnIndex,jdbcType=INTEGER}
AND A.row_index = #{rowIndex,jdbcType=INTEGER}
AND A.period = #{period,jdbcType=INTEGER}
AND A.project_id=#{projectId,jdbcType=VARCHAR}
AND B.project_id=#{projectId,jdbcType=VARCHAR}
</select>
<select id="getDataType" resultType="java.lang.Integer">
SELECT
CT.DATA_TYPE
CT.data_type as DATA_TYPE
FROM
PERIOD_CELL_TEMPLATE CT
period_cell_template CT
JOIN
PERIOD_REPORT R
period_report R
ON
CT.REPORT_TEMPLATE_ID = R.TEMPLATE_ID
AND CT.PERIOD = R.PERIOD
CT.report_template_id = R.template_id
AND CT.period = R.period
WHERE
CT.CELL_TEMPLATE_ID = #{cellTemplateId,jdbcType=BIGINT}
AND R.ID = #{reportId,jdbcType=BIGINT}
CT.cell_template_id = #{cellTemplateId,jdbcType=BIGINT}
AND R.id = #{reportId,jdbcType=BIGINT}
LIMIT 1
</select>
......
......@@ -84,25 +84,25 @@
<delete id="clearCellDataSourceDataWithPeriod">
DELETE
D FROM
CELL_DATA_SOURCE D
cell_data_source D
JOIN
DATA_SOURCE F
data_source F
ON
D.DATA_SOURCE_ID = F.ID
D.data_source_id = F.id
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
F.period = #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearCellDataWithPeriod">
DELETE
C FROM
CELL_DATA C
cell_data C
JOIN
REPORT R
report R
ON
C.REPORT_ID=R.ID
C.report_id=R.id
WHERE
R.PERIOD = #{period,jdbcType=INTEGER} ;
R.period = #{period,jdbcType=INTEGER} ;
<!--&amp;lt;if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"&amp;gt;-->
......@@ -113,7 +113,7 @@
<delete id="clearReportWithPeriod">
DELETE FROM
REPORT
report
WHERE
period= #{period,jdbcType=INTEGER} ;
</delete>
......@@ -121,107 +121,107 @@
<delete id="clearDataWithPeriod">
DELETE
FROM
PERIOD_FORMULA_BLOCK
period_formula_block
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
PERIOD_TAX_RULE_SETTING
period_tax_rule_setting
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
PERIOD_CELL_TEMPLATE
period_cell_template
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND REPORT_TEMPLATE_ID NOT IN (${exceptReportTemplateIDs})
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND report_template_id NOT IN (${exceptReportTemplateIDs})
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
PERIOD_CELL_TEMPLATE_CONFIG
period_cell_template_config
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND REPORT_TEMPLATE_ID NOT IN (${exceptReportTemplateIDs})
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND report_template_id NOT IN (${exceptReportTemplateIDs})
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
PERIOD_TEMPLATE
period_template
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND TEMPLATE_ID NOT IN (${exceptReportTemplateIDs})
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND template_id NOT IN (${exceptReportTemplateIDs})
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
PERIOD_TAX_PAYER_REPORT_RULE
period_tax_payer_report_rule
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
PERIOD_DATA_SOURCE_DETAIL D
period_data_source_detail D
WHERE
D .DATA_SOURCE_ID IN (
D .data_source_id IN (
SELECT
DATA_SOURCE_ID
data_source_id
FROM
PERIOD_DATA_SOURCE_DETAIL E
JOIN Period_DATA_SOURCE F ON E .DATA_SOURCE_ID = F. ID
period_data_source_detail E
JOIN period_data_source F ON E .data_source_id = F. id
WHERE
F.PERIOD = #{period,jdbcType=INTEGER}
F.period = #{period,jdbcType=INTEGER}
)
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
Period_CELL_DATA_SOURCE D
period_cell_data_source D
WHERE
D .DATA_SOURCE_ID IN (
D .data_source_id IN (
SELECT
DATA_SOURCE_ID
data_source_id
FROM
Period_CELL_DATA_SOURCE E
JOIN period_DATA_SOURCE F ON E .DATA_SOURCE_ID = F. ID
period_cell_data_source E
JOIN period_data_source F ON E .data_source_id = F. id
WHERE
F.PERIOD = #{period,jdbcType=INTEGER}
F.period = #{period,jdbcType=INTEGER}
)
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
period_DATA_SOURCE D
period_data_source D
WHERE
D .PERIOD = #{period,jdbcType=INTEGER}
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
D .period = #{period,jdbcType=INTEGER}
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
period_CELL_DATA C
period_cell_data C
WHERE
REPORT_ID IN (
report_id IN (
SELECT
report_id
FROM
PERIOD_CELL_DATA E
JOIN period_REPORT R ON E .REPORT_ID = R. ID
period_cell_data E
JOIN period_report R ON E .report_id = R. id
WHERE
R.PERIOD = #{period,jdbcType=INTEGER}
R.period = #{period,jdbcType=INTEGER}
)
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
AND project_id = #{projectId,jdbcType=NVARCHAR};
DELETE
FROM
period_REPORT
period_report
WHERE
PERIOD = #{period,jdbcType=INTEGER}
AND PROJECT_ID = #{projectId,jdbcType=NVARCHAR};
period = #{period,jdbcType=INTEGER}
AND project_id = #{projectId,jdbcType=NVARCHAR};
</delete>
<resultMap id="DataSourceExtendDtoMap" type="pwc.taxtech.atms.vat.dpo.DataSourceExtendDto">
......@@ -249,63 +249,79 @@
<select id="getFormulaDataSource" parameterType="java.lang.Long" resultMap="DataSourceExtendDtoMap">
SELECT
DS.*,
CDS.OPERATION_TYPE AS OPERATION_TYPE,
CD.CELL_TEMPLATE_ID AS CELL_TEMPLATE_ID,
CD.ID AS CELL_DATA_ID,
RPT.TEMPLATE_ID AS REPORT_TEMPLATE_ID
DS.id as ID,
DS.type as TYPE,
DS.name as NAME,
DS.amount as AMOUNT,
DS.description as DESCRIPTION,
DS.key_value_data_id as KEY_VALUE_DATA_ID,
DS.create_by as CREATE_BY,
DS.create_time as CREATE_TIME,
DS.update_by as UPDATE_BY,
DS.update_time as UPDATE_TIME,
DS.row_name as ROW_NAME,
DS.column_name as COLUMN_NAME,
DS.row_index as ROW_INDEX,
DS.remap_batch_id as REMAP_BATCH_ID,
DS.column_index as COLUMN_INDEX,
DS.cell_template_id as CELL_TEMPLATE_ID,
DS.period as PERIOD,
DS.project_id as PROJECT_ID,
DS.keyin_data as KEYIN_DATA,
CDS.operation_type AS OPERATION_TYPE,
CD.cell_template_id AS CELL_TEMPLATE_ID,
CD.id AS CELL_DATA_ID,
RPT.template_id AS REPORT_TEMPLATE_ID
FROM
PERIOD_DATA_SOURCE DS
period_data_source DS
JOIN
PERIOD_CELL_DATA_SOURCE CDS
period_cell_data_source CDS
ON
DS.ID = CDS.DATA_SOURCE_ID AND DS.PROJECT_ID=CDS.PROJECT_ID
DS.id = CDS.data_source_id AND DS.project_id=CDS.project_id
JOIN
PERIOD_CELL_DATA CD
period_cell_data CD
ON
CDS.CELL_DATA_ID = CD.ID
AND CDS.PROJECT_ID=CD.PROJECT_ID
CDS.cell_data_id = CD.id
AND CDS.project_id=CD.project_id
JOIN
PERIOD_REPORT RPT
period_report RPT
ON
CD.REPORT_ID= RPT.ID
AND CD.PROJECT_ID=RPT.PROJECT_ID
CD.report_id= RPT.id
AND CD.project_id=RPT.project_id
WHERE
CD.REPORT_ID = #{reportID,jdbcType=BIGINT}
<!--AND <![CDATA[ ds.type <> 1]]>-->
CD.report_id = #{reportID,jdbcType=BIGINT}
</select>
<select id="getManualDataSource" parameterType="java.lang.Long" resultMap="DataSourceExtendDtoMap">
SELECT
CDS.CELL_DATA_ID,
DS.ID,
DS.TYPE,
DS.NAME,
DS.AMOUNT,
DS.KEYIN_DATA,
DS.DESCRIPTION,
DS.KEY_VALUE_DATA_ID,
DS.CREATE_BY,
DS.CREATE_TIME,
DS.UPDATE_BY,
DS.UPDATE_TIME,
DS.ROW_NAME,
DS.COLUMN_NAME,
DS.ROW_INDEX,
DS.REMAP_BATCH_ID,
DS.COLUMN_INDEX,
DS.CELL_TEMPLATE_ID,
DS.PERIOD
CDS.cell_data_id as CELL_DATA_ID,
DS.id as ID,
DS.type as TYPE,
DS.name as NAME,
DS.amount as AMOUNT,
DS.keyin_data as KEYIN_DATA,
DS.description as DESCRIPTION,
DS.key_value_data_id as KEY_VALUE_DATA_ID,
DS.create_by as CREATE_BY,
DS.create_time as CREATE_TIME,
DS.update_by as UPDATE_BY,
DS.update_time as UPDATE_TIME,
DS.row_name as ROW_NAME,
DS.column_name as COLUMN_NAME,
DS.row_index as ROW_INDEX,
DS.remap_batch_id as REMAP_BATCH_ID,
DS.column_index as COLUMN_INDEX,
DS.cell_template_id as CELL_TEMPLATE_ID,
DS.period as PERIOD
FROM
PERIOD_CELL_DATA_SOURCE CDS
period_cell_data_source CDS
JOIN
PERIOD_DATA_SOURCE DS
period_data_source DS
ON
CDS.DATA_SOURCE_ID = DS.ID AND CDS.PROJECT_ID = DS.PROJECT_ID
CDS.data_source_id = DS.id AND CDS.project_id = DS.project_id
WHERE
DS.TYPE = 10
AND CDS.CELL_DATA_ID = #{cellDataID,jdbcType=BIGINT}
DS.type = 10
AND CDS.cell_data_id = #{cellDataID,jdbcType=BIGINT}
</select>
<resultMap id="dataSourceCellDataDto" type="pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto">
......@@ -325,29 +341,48 @@
<select id="getManualDataSource2" parameterType="java.lang.Long" resultMap="dataSourceCellDataDto">
SELECT
CELLDATASOURCE.ID AS ID,
CELLDATA.ID AS CELL_DATA_ID,
CELLDATA.DATA AS CELL_DATA_DATA,
CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID,
CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID,
CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID,
CELLDATASOURCE.OPERATION_TYPE AS OPERATION_TYPE
pcds.id AS ID,
pcd.id AS CELL_DATA_ID,
pcd.data AS CELL_DATA_DATA,
pcd.cell_template_id AS CELL_DATA_TEMPLATE_ID,
pcd.report_id AS CELL_DATA_REPORT_ID,
pcds.id AS CELL_DATA_SOURCE_ID,
pcds.operation_type AS OPERATION_TYPE
FROM
PERIOD_CELL_DATA CELLDATA
period_cell_data pcd
JOIN
PERIOD_CELL_DATA_SOURCE CELLDATASOURCE
period_cell_data_source pcds
ON
CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID AND CELLDATA.PROJECT_ID = CELLDATASOURCE.PROJECT_ID
pcd.id = pcds.cell_data_id AND pcd.project_id = pcds.project_id
WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT}
pcds.data_source_id = #{dataSourceID,jdbcType=BIGINT}
LIMIT 1
</select>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodDataSource">
INSERT ALL
<foreach collection="list" item="item">
INTO PERIOD_DATA_SOURCE VALUES
INSERT INTO period_data_source
(id,
type,
name,
amount,
description,
key_value_data_id,
create_by,
create_time,
update_by,
update_time,
row_name,
column_name,
row_index,
remap_batch_id,
column_index,
cell_template_id,
period,
project_id,
keyin_data)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">
......@@ -368,7 +403,7 @@
#{item.name,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -385,7 +420,7 @@
#{item.description,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -401,7 +436,7 @@
#{item.createBy,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -409,7 +444,7 @@
#{item.createTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
CURRENT_TIMESTAMP,
</otherwise>
</choose>
<choose>
......@@ -417,7 +452,7 @@
#{item.updateBy,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -425,7 +460,7 @@
#{item.updateTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
CURRENT_TIMESTAMP,
</otherwise>
</choose>
<choose>
......@@ -433,7 +468,7 @@
#{item.rowName,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -441,7 +476,7 @@
#{item.columnName,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -458,7 +493,7 @@
#{item.remapBatchId,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -490,7 +525,7 @@
#{item.projectId,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
<choose>
......@@ -498,11 +533,11 @@
#{item.keyinData,jdbcType=VARCHAR},
</when>
<otherwise>
'',
"",
</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
......@@ -2,7 +2,32 @@
<!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.PeriodEnterpriseAccountMapper">
<select id="getListWithAccountCode" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT * FROM PERIOD_ENTERPRISE_ACCOUNT WHERE STD_CODE IS NOT NULL AND STD_CODE LIKE '${accountCode}%'
AND IS_LEAF=1 AND PROJECT_ID=#{projectId,jdbcType=VARCHAR} and PERIOD=#{period,jdbcType=INTEGER}
SELECT
(
id as ID,
acct_code as ACCT_CODE,
name as NAME,
parent_code as PARENT_CODE,
full_name as FULL_NAME,
acct_prop as ACCT_PROP,
sub_prop as SUB_PROP,
acct_level as ACCT_LEVEL,
direction as DIRECTION,
is_leaf as IS_LEAF,
is_active as IS_ACTIVE,
english_name as ENGLISH_NAME,
std_code as STD_CODE,
enterprise_account_set_id as ENTERPRISE_ACCOUNT_SET_ID,
is_dummy as IS_DUMMY,
is_in_voucher as IS_IN_VOUCHER,
creator_id as CREATOR_ID,
updator_id as UPDATOR_ID,
create_time as CREATE_TIME,
update_time as UPDATE_TIME,
project_id as PROJECT_ID,
period as PERIOD
)
FROM period_enterprise_account WHERE std_code IS NOT NULL AND std_code LIKE "${accountCode}%"
AND is_leaf=1 AND project_id=#{projectId,jdbcType=VARCHAR} and period=#{period,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
......@@ -4,13 +4,13 @@
<update id="updateReportId">
UPDATE
PERIOD_FORMULA_BLOCK
period_formula_block
SET
REPORT_ID= #{reportId,jdbcType=BIGINT}
report_id= #{reportId,jdbcType=BIGINT}
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND PROJECT_ID= #{projectId,jdbcType=INTEGER}
AND CELL_TEMPLATE_ID IN
period= #{period,jdbcType=INTEGER}
AND project_id= #{projectId,jdbcType=INTEGER}
AND cell_template_id IN
<foreach collection="cellTemplateConfigIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
......
......@@ -25,59 +25,68 @@
<select id="selectProjectStandardAccountLeftJoinBalanceStdManual" resultMap="TrialBalanceDto">
SELECT DISTINCT
B.PERIOD_ID,
B.ACCT_CODE,
'' AS CUSTOMER_CODE,
B.BEG_DEBIT_BAL,
B.BEG_CREDIT_BAL,
B.BEG_BAL,
B.END_BAL,
B.END_DEBIT_BAL,
B.END_CREDIT_BAL,
B.DEBIT_BAL,
B.CREDIT_BAL,
B.PERIOD_ID AS MONTH_ID,
B.YEAR_DEBIT_BAL,
B.YEAR_CREDIT_BAL,
IF (
ISNULL (
A.PARENT_CODE
)
|| A.PARENT_CODE = '',
'0',
A.PARENT_CODE
)
AS PARENT_CODE,
A.`_NAME_` AS ACCOUNT_NAME,
A.ACCT_PROP,
A.DIRECTION
B.period_id as PERIOD_ID,
B.acct_code as ACCT_CODE,
"" AS CUSTOMER_CODE,
B.beg_debit_bal as BEG_DEBIT_BAL,
B.beg_credit_bal as BEG_CREDIT_BAL,
B.beg_bal as BEG_BAL,
B.end_bal as END_BAL,
B.end_debit_bal as END_DEBIT_BAL,
B.end_credit_bal as END_CREDIT_BAL,
B.debit_bal as DEBIT_BAL,
B.credit_bal as CREDIT_BAL,
B.period_id AS MONTH_ID,
B.year_debit_bal as YEAR_DEBIT_BAL,
B.year_credit_bal as YEAR_CREDIT_BAL,
IF (ISNULL (A.parent_code)|| A.parent_code = "","0",A.parent_code) AS PARENT_CODE,
A.name AS ACCOUNT_NAME,
A.acct_prop as ACCT_PROP,
A.direction as DIRECTION
FROM
PERIOD_STANDARD_ACCOUNT A
period_standard_account A
JOIN
PERIOD_BALANCE_STD_MANUAL B
period_balance_std_manual B
ON
A.`CODE` = B.ACCT_CODE
A.code = B.acct_code
WHERE
1=1
AND A.PROJECT_ID= #{projectId,jdbcType=VARCHAR}
AND A.project_id= #{projectId,jdbcType=VARCHAR}
<if test="fromMonth!=null">
AND B.PERIOD_ID &gt;= #{fromMonth,jdbcType=VARCHAR}
AND B.period_id &gt;= #{fromMonth,jdbcType=VARCHAR}
</if>
<if test="toMonth!=null">
AND B.PERIOD_ID &lt;= #{toMonth,jdbcType=VARCHAR}
AND B.period_id &lt;= #{toMonth,jdbcType=VARCHAR}
</if>
ORDER BY
B.PERIOD_ID
B.period_id
</select>
<select id="selectOneByAccountCode" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
*
(
A.id as ID,
A.code as CODE,
A.name as NAME,
A.parent_code as PARENT_CODE,
A.full_name as FULL_NAME,
A.acct_prop as ACCT_PROP,
A.sub_prop as SUB_PROP,
A.acct_level as ACCT_LEVEL,
A.direction as DIRECTION,
A.is_leaf as IS_LEAF,
A.rule_type as RULE_TYPE,
A.is_active as IS_ACTIVE,
A.english_name as ENGLISH_NAME,
A.industry_id as INDUSTRY_ID,
A.project_id as PROJECT_ID,
A.period as PERIOD
)
FROM
PERIOD_STANDARD_ACCOUNT A
period_standard_account A
WHERE
A.CODE= #{accountCode,jdbcType=VARCHAR}
AND A.PROJECT_ID= #{projectId,jdbcType=VARCHAR}
A.code= #{accountCode,jdbcType=VARCHAR}
AND A.project_id= #{projectId,jdbcType=VARCHAR}
LIMIT 1
</select>
......
......@@ -4,23 +4,23 @@
<select id="getTaxRuleSetting" resultMap="BaseResultMap">
SELECT
TRS.IS_DEFAULT AS IS_DEFAULT,
TRS.TAX_BASE AS TAX_BASE,
TRS.TAX_RATE AS TAX_RATE
TRS.is_default AS IS_DEFAULT,
TRS.tax_base AS TAX_BASE,
TRS.tax_rate AS TAX_RATE
FROM
PERIOD_TAX_RULE_SETTING TRS
period_tax_rule_setting TRS
LEFT JOIN
PERIOD_TAX_RULE_SETTING_ORG TRSO
period_tax_rule_setting_org TRSO
ON
TRS.TAX_RULE_SETTING_ID = TRSO.TAX_SETTING_ID
TRS.tax_rule_setting_id = TRSO.tax_setting_id
WHERE
(
TRS.IS_DEFAULT = 1
OR TRSO.ORGANIZATION_ID = #{organizationId,jdbcType=VARCHAR}
TRS.is_default = 1
OR TRSO.organization_id = #{organizationId,jdbcType=VARCHAR}
)
AND TRS.NAME = #{taxName,jdbcType=VARCHAR}
AND TRS.PERIOD = #{period,jdbcType=INTEGER}
AND TRS.PROJECT_ID = #{projectId,jdbcType=INTEGER}
AND TRS.name = #{taxName,jdbcType=VARCHAR}
AND TRS.period = #{period,jdbcType=INTEGER}
AND TRS.project_id = #{projectId,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
......@@ -2,27 +2,25 @@
<!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">
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodTemplate">
INSERT ALL
<foreach collection="list" item="item">
INTO PERIOD_TEMPLATE (
ID,
PERIOD,
"NAME",
"CODE",
PATH,
REPORT_TYPE,
TEMPLATE_GROUP_ID,
ORDER_INDEX,
CREATE_TIME,
UPDATE_TIME,
IS_SYSTEM_TYPE,
IS_ACTIVE_ASSOCIATION,
PARENT_ID,
TEMPLATE_ID,
CREATE_BY,
UPDATE_BY,
PROJECT_ID
) VALUES
INSERT INTO period_template (
id,
period,
name,
code,
path,
report_type,
template_group_id,
order_index,
create_time,
update_time,
is_system_type,
is_active_association,
parent_id,
template_id,
create_by,
update_by,
project_id) VALUES
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
......@@ -34,15 +32,15 @@
</choose>
<choose>
<when test="item.name != null">#{item.name,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.code != null">#{item.code,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.path != null">#{item.path,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.reportType != null">#{item.reportType,jdbcType=INTEGER},</when>
......@@ -58,11 +56,11 @@
</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>
<otherwise>CURRENT_TIMESTAMP,</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>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.isSystemType != null">#{item.isSystemType,jdbcType=INTEGER},</when>
......@@ -74,7 +72,7 @@
</choose>
<choose>
<when test="item.parentId != null">#{item.parentId,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.templateId != null">#{item.templateId,jdbcType=INTEGER},</when>
......@@ -82,19 +80,19 @@
</choose>
<choose>
<when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">#{item.updateBy,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>' ',</otherwise>
<otherwise>"",</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</foreach>;
SELECT 1 FROM DUAL;
</insert>
<resultMap id="cellTemplatePerGroupDto" type="pwc.taxtech.atms.dpo.CellTemplatePerGroupDto">
......@@ -102,37 +100,33 @@
<select id="getCellTemplatePerGroup" resultMap="cellTemplatePerGroupDto">
SELECT
CELLTEMPLATE.ID AS CELL_TEMPLATE_ID,
TEMPLATE.ID AS REPORT_TEMPLATE_ID,
TEMPLATE.TEMPLATE_GROUP_ID AS REPORT_TEMPLATE_GROUP_ID,
IFNULL (
CELLTEMPLATECONFIG.FORMULA,
' '
)
AS FORMULA,
CELLTEMPLATE.ROW_INDEX AS ROW_INDEX,
CELLTEMPLATE.COLUMN_INDEX AS COLUMN_INDEX,
TEMPLATE.CODE AS REPORT_CODE,
CELLTEMPLATE.COLUMN_NAME AS COLUMN_NAME,
CELLTEMPLATE.ROW_NAME AS ROW_NAME,
CELLTEMPLATE.DATA_TYPE AS RESULT_TYPE
pct.id AS CELL_TEMPLATE_ID,
pt.id AS REPORT_TEMPLATE_ID,
pt.template_group_id AS REPORT_TEMPLATE_GROUP_ID,
IFNULL (pctc.formula,"") AS FORMULA,
pct.row_index AS ROW_INDEX,
pct.column_index AS COLUMN_INDEX,
pt.code AS REPORT_CODE,
pct.column_name AS COLUMN_NAME,
pct.row_name AS ROW_NAME,
pct.data_type AS RESULT_TYPE
FROM
PERIOD_TEMPLATE TEMPLATE
period_template pt
JOIN
PERIOD_CELL_TEMPLATE CELLTEMPLATE
period_cell_template pct
ON
TEMPLATE.ID = CELLTEMPLATE.REPORT_TEMPLATE_ID
pt.id = pct.report_template_id
LEFT JOIN
PERIOD_CELL_TEMPLATE_CONFIG CELLTEMPLATECONFIG
period_cell_template_config pctc
ON
CELLTEMPLATECONFIG.CELL_TEMPLATE_ID = CELLTEMPLATE.ID
pctc.cell_template_id = pct.ID
WHERE
TEMPLATE.PERIOD= #{period,jdbcType=INTEGER}
AND CELLTEMPLATE.PERIOD= #{period,jdbcType=INTEGER}
AND CELLTEMPLATECONFIG.PERIOD= #{period,jdbcType=INTEGER}
AND CELLTEMPLATECONFIG.DATA_SOURCE_TYPE=1
AND TEMPLATE.TEMPLATE_GROUP_ID= #{reportTemplateGroupID,jdbcType=VARCHAR}
AND TEMPLATE.IS_ACTIVE_ASSOCIATION=1
pt.period= #{period,jdbcType=INTEGER}
AND pct.period= #{period,jdbcType=INTEGER}
AND pctc.period= #{period,jdbcType=INTEGER}
AND pctc.data_source_type=1
AND pt.template_group_id= #{reportTemplateGroupID,jdbcType=VARCHAR}
AND pt.is_active_association=1
</select>
</mapper>
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