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,26 +21,25 @@
)
</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
<trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
......@@ -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,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>
......
......@@ -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