Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangkb
indicators
Commits
b6ae7575
Commit
b6ae7575
authored
Mar 03, 2023
by
dengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复删除权重配置时,关联数据未被删除的bug
parent
56646b51
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
132 additions
and
29 deletions
+132
-29
ObjScoreIndWeightDetailMapper.java
...rs/model/mapper/weight/ObjScoreIndWeightDetailMapper.java
+6
-0
WeightExcelIndicatorMapper.java
...ators/model/mapper/weight/WeightExcelIndicatorMapper.java
+7
-0
WeightExcelObjMapper.java
.../indicators/model/mapper/weight/WeightExcelObjMapper.java
+3
-0
WeightExcelTemplateMapper.java
...cators/model/mapper/weight/WeightExcelTemplateMapper.java
+9
-0
WeightIndValueMapper.java
.../indicators/model/mapper/weight/WeightIndValueMapper.java
+2
-6
ObjScoreIndWeightCfgServiceImpl.java
...icators/service/impl/ObjScoreIndWeightCfgServiceImpl.java
+31
-0
WeightExcelTemplateServiceImpl.java
.../weightDataEnter/impl/WeightExcelTemplateServiceImpl.java
+11
-0
ObjScoreIndWeightDetailMapper.xml
...sources/mybatis/mapping/ObjScoreIndWeightDetailMapper.xml
+10
-0
WeightExcelIndicatorMapper.xml
.../resources/mybatis/mapping/WeightExcelIndicatorMapper.xml
+15
-5
WeightExcelObjMapper.xml
src/main/resources/mybatis/mapping/WeightExcelObjMapper.xml
+15
-5
WeightExcelTemplateMapper.xml
...n/resources/mybatis/mapping/WeightExcelTemplateMapper.xml
+7
-0
WeightIndValueMapper.xml
src/main/resources/mybatis/mapping/WeightIndValueMapper.xml
+16
-13
No files found.
src/main/java/com/keymobile/indicators/model/mapper/weight/ObjScoreIndWeightDetailMapper.java
View file @
b6ae7575
...
@@ -22,4 +22,10 @@ public interface ObjScoreIndWeightDetailMapper extends BaseMapper<ObjScoreIndWei
...
@@ -22,4 +22,10 @@ public interface ObjScoreIndWeightDetailMapper extends BaseMapper<ObjScoreIndWei
*/
*/
void
deleteByCfgId
(
@Param
(
"cfgId"
)
Integer
cfgId
);
void
deleteByCfgId
(
@Param
(
"cfgId"
)
Integer
cfgId
);
/**
* 根据权重配置ID集合批量删除权重数据填报
* @param ids 权重配置ID集合
*/
void
batchDeleteByCfgIds
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelIndicatorMapper.java
View file @
b6ae7575
...
@@ -2,6 +2,7 @@ package com.keymobile.indicators.model.mapper.weight;
...
@@ -2,6 +2,7 @@ package com.keymobile.indicators.model.mapper.weight;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,4 +23,10 @@ public interface WeightExcelIndicatorMapper extends BaseMapper<WeightExcelIndica
...
@@ -22,4 +23,10 @@ public interface WeightExcelIndicatorMapper extends BaseMapper<WeightExcelIndica
*/
*/
void
deleteByTempId
(
Integer
tempId
);
void
deleteByTempId
(
Integer
tempId
);
/**
* 根据模板ID集合删除模板关联指标项
* @param ids
*/
void
batchDeleteByTempIds
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelObjMapper.java
View file @
b6ae7575
...
@@ -2,6 +2,7 @@ package com.keymobile.indicators.model.mapper.weight;
...
@@ -2,6 +2,7 @@ package com.keymobile.indicators.model.mapper.weight;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,4 +23,6 @@ public interface WeightExcelObjMapper extends BaseMapper<WeightExcelObj> {
...
@@ -22,4 +23,6 @@ public interface WeightExcelObjMapper extends BaseMapper<WeightExcelObj> {
*/
*/
void
deleteByTempId
(
Integer
tempId
);
void
deleteByTempId
(
Integer
tempId
);
void
batchDeleteByTempIds
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelTemplateMapper.java
View file @
b6ae7575
...
@@ -4,6 +4,8 @@ import com.keymobile.indicators.model.entity.weight.WeightExcelTemplate;
...
@@ -4,6 +4,8 @@ import com.keymobile.indicators.model.entity.weight.WeightExcelTemplate;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
WeightExcelTemplateMapper
extends
BaseMapper
<
WeightExcelTemplate
>
{
public
interface
WeightExcelTemplateMapper
extends
BaseMapper
<
WeightExcelTemplate
>
{
...
@@ -25,4 +27,11 @@ public interface WeightExcelTemplateMapper extends BaseMapper<WeightExcelTemplat
...
@@ -25,4 +27,11 @@ public interface WeightExcelTemplateMapper extends BaseMapper<WeightExcelTemplat
* @param weightId 权重ID
* @param weightId 权重ID
*/
*/
void
deleteByWeightId
(
Integer
weightId
);
void
deleteByWeightId
(
Integer
weightId
);
/**
* 根据权重配置ID获取已废弃的模板ID集合(state = 3)
* @param weightId 权重配置ID
* @return 已废弃的模板ID集合
*/
List
<
Integer
>
selectAllIdByWeightId
(
Integer
weightId
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightIndValueMapper.java
View file @
b6ae7575
...
@@ -17,12 +17,6 @@ public interface WeightIndValueMapper extends BaseMapper<WeightIndValue> {
...
@@ -17,12 +17,6 @@ public interface WeightIndValueMapper extends BaseMapper<WeightIndValue> {
void
batchInsert
(
@Param
(
"valueList"
)
List
<
WeightIndValue
>
valueList
);
void
batchInsert
(
@Param
(
"valueList"
)
List
<
WeightIndValue
>
valueList
);
/**
/**
* 根据 指标id 机构编码 时间维度删除
* @param newValues
**/
void
batchDelete
(
@Param
(
"newValues"
)
List
<
WeightIndValue
>
newValues
);
/**
* 根据权重配置ID删除权重数据填报
* 根据权重配置ID删除权重数据填报
* @param weightId 权重配置ID
* @param weightId 权重配置ID
*/
*/
...
@@ -35,4 +29,6 @@ public interface WeightIndValueMapper extends BaseMapper<WeightIndValue> {
...
@@ -35,4 +29,6 @@ public interface WeightIndValueMapper extends BaseMapper<WeightIndValue> {
*/
*/
List
<
WeightIndValue
>
findByWeightId
(
@Param
(
"weightId"
)
Integer
weightId
);
List
<
WeightIndValue
>
findByWeightId
(
@Param
(
"weightId"
)
Integer
weightId
);
void
batchDeleteByWeightIds
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
}
}
src/main/java/com/keymobile/indicators/service/impl/ObjScoreIndWeightCfgServiceImpl.java
View file @
b6ae7575
...
@@ -5,9 +5,14 @@ import com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg;
...
@@ -5,9 +5,14 @@ import com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper
;
import
com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper
;
import
com.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper
;
import
com.keymobile.indicators.service.ObjScoreIndWeightCfgService
;
import
com.keymobile.indicators.service.ObjScoreIndWeightCfgService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService
;
...
@@ -45,6 +50,14 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
...
@@ -45,6 +50,14 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
private
TaskRuleGroupObjService
taskRuleGroupObjService
;
private
TaskRuleGroupObjService
taskRuleGroupObjService
;
@Autowired
@Autowired
private
WeightIndValueService
weightIndValueService
;
private
WeightIndValueService
weightIndValueService
;
@Autowired
private
WeightExcelObjMapper
excelObjMapper
;
@Autowired
private
WeightExcelIndicatorMapper
excelIndicatorMapper
;
@Autowired
private
ObjScoreIndWeightDetailMapper
weightDetailMapper
;
@Autowired
private
WeightExcelTemplateMapper
excelTemplateMapper
;
@Override
@Override
public
void
deleteById
(
Integer
id
)
{
public
void
deleteById
(
Integer
id
)
{
...
@@ -146,6 +159,24 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
...
@@ -146,6 +159,24 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
@Override
@Override
public
void
delete
(
List
<
Integer
>
ids
)
{
public
void
delete
(
List
<
Integer
>
ids
)
{
weightCfgMapper
.
deleteByIdIn
(
ids
);
weightCfgMapper
.
deleteByIdIn
(
ids
);
deleteCorrelationTableByWeightId
(
ids
);
}
/**
* 根据权重ID删除权重关联表(obj_score_ind_weight_cfg(主表), obj_score_ind_weight_detail, weight_data_excel_ind, weight_data_excel_obj, weight_data_excel_temp, weight_ind_value)中的数据
* @param ids 权重ID集合
*/
private
void
deleteCorrelationTableByWeightId
(
List
<
Integer
>
ids
)
{
weightIndValueMapper
.
batchDeleteByWeightIds
(
ids
);
weightDetailMapper
.
batchDeleteByCfgIds
(
ids
);
List
<
Integer
>
tempIds
=
new
ArrayList
<>();
for
(
Integer
weightId
:
ids
)
{
WeightExcelTemplate
template
=
excelTemplateMapper
.
getByWeightId
(
weightId
);
tempIds
.
add
(
template
.
getId
());
excelTemplateMapper
.
deleteByWeightId
(
weightId
);
}
excelIndicatorMapper
.
batchDeleteByTempIds
(
tempIds
);
excelObjMapper
.
batchDeleteByTempIds
(
tempIds
);
}
}
@Override
@Override
...
...
src/main/java/com/keymobile/indicators/service/weightDataEnter/impl/WeightExcelTemplateServiceImpl.java
View file @
b6ae7575
...
@@ -65,6 +65,7 @@ public class WeightExcelTemplateServiceImpl implements WeightExcelTemplateServic
...
@@ -65,6 +65,7 @@ public class WeightExcelTemplateServiceImpl implements WeightExcelTemplateServic
// 需要保证weight_data_excel_temp表中weight_id关联的数据唯一
// 需要保证weight_data_excel_temp表中weight_id关联的数据唯一
// 先删除(将表数据state修改为3-废弃),再添加
// 先删除(将表数据state修改为3-废弃),再添加
excelTemplateMapper
.
deleteByWeightId
(
template
.
getWeightId
());
excelTemplateMapper
.
deleteByWeightId
(
template
.
getWeightId
());
deleteOldIndAndOldObj
(
template
);
Date
now
=
new
Date
();
Date
now
=
new
Date
();
String
currentUserId
=
SystemUserUtil
.
getCurrentUserId
();
String
currentUserId
=
SystemUserUtil
.
getCurrentUserId
();
template
.
setUpdater
(
currentUserId
);
template
.
setUpdater
(
currentUserId
);
...
@@ -77,6 +78,16 @@ public class WeightExcelTemplateServiceImpl implements WeightExcelTemplateServic
...
@@ -77,6 +78,16 @@ public class WeightExcelTemplateServiceImpl implements WeightExcelTemplateServic
}
}
/**
/**
* 在新增模板前,需要把模板指标关联表和模板对象关联表数据清除(逻辑删除)
* @param template
*/
private
void
deleteOldIndAndOldObj
(
WeightExcelTemplate
template
)
{
List
<
Integer
>
ids
=
excelTemplateMapper
.
selectAllIdByWeightId
(
template
.
getWeightId
());
excelIndicatorMapper
.
batchDeleteByTempIds
(
ids
);
excelObjMapper
.
batchDeleteByTempIds
(
ids
);
}
/**
* 插入指标和对象信息
* 插入指标和对象信息
* @param template
* @param template
* @param now
* @param now
...
...
src/main/resources/mybatis/mapping/ObjScoreIndWeightDetailMapper.xml
View file @
b6ae7575
...
@@ -18,5 +18,14 @@
...
@@ -18,5 +18,14 @@
delete from obj_score_ind_weight_detail where cfg_id = #{cfgId}
delete from obj_score_ind_weight_detail where cfg_id = #{cfgId}
</delete>
</delete>
<delete
id=
"batchDeleteByCfgIds"
parameterType=
"list"
>
delete
from obj_score_ind_weight_detail
where cfg_id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</delete>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelIndicatorMapper.xml
View file @
b6ae7575
...
@@ -10,10 +10,19 @@
...
@@ -10,10 +10,19 @@
</select>
</select>
<delete
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
<update
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
delete
update weight_data_excel_ind
from weight_data_excel_ind
set state = 3
where temp_id = #{tempId}
where temp_id = #{tempId} and state = 1
</delete>
</update>
<update
id=
"batchDeleteByTempIds"
parameterType=
"java.util.List"
>
update weight_data_excel_ind
set state = 3
where state = 1 and temp_id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</update>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelObjMapper.xml
View file @
b6ae7575
...
@@ -10,10 +10,19 @@
...
@@ -10,10 +10,19 @@
</select>
</select>
<delete
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
<update
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
delete
update weight_data_excel_obj
from weight_data_excel_obj
set state = 3
where temp_id = #{tempId}
where state = 1 and temp_id = #{tempId}
</delete>
</update>
<update
id=
"batchDeleteByTempIds"
parameterType=
"java.util.List"
>
update weight_data_excel_obj
set state = 3
where state = 1 and temp_id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</update>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelTemplateMapper.xml
View file @
b6ae7575
...
@@ -20,4 +20,10 @@
...
@@ -20,4 +20,10 @@
where state = 1 and weight_id = #{weightId}
where state = 1 and weight_id = #{weightId}
</update>
</update>
<select
id=
"selectAllIdByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"java.lang.Integer"
>
select id
from weight_data_excel_temp
where state = 3 and weight_id = #{weightId}
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightIndValueMapper.xml
View file @
b6ae7575
...
@@ -15,21 +15,23 @@
...
@@ -15,21 +15,23 @@
</foreach>
</foreach>
</insert>
</insert>
<delete
id=
"batchDelete"
parameterType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
<update
id=
"deleteByWeightId"
parameterType=
"java.lang.Integer"
>
update weight_ind_value
<foreach
collection=
"newValues"
item=
"val"
separator=
";"
>
set state = 3
delete from weight_ind_value
where state = 1 and weight_id = #{weightId}
where weight_id=#{val.weightId} and ind_id = #{val.indId} and obj_id = #{val.objId}
</update>
</foreach>
</delete>
<delete
id=
"deleteByWeightId"
parameterType=
"java.lang.Integer"
>
delete from weight_ind_value where weight_id = #{weightId}
</delete>
<select
id=
"findByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
<select
id=
"findByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
select * from weight_ind_value where weight_id = #{weightId}
select * from weight_ind_value where weight_id = #{weightId}
and state = 1
</select>
</select>
<update
id=
"batchDeleteByWeightIds"
parameterType=
"java.util.List"
>
update weight_ind_value
set state = 3
where state = 1 and weight_id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</update>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment