Commit bcefaafa authored by gary's avatar gary

sql debug

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