From ea176a31550a23619b9d632c7dfe47cfcc54ebaf Mon Sep 17 00:00:00 2001 From: wulin Date: Thu, 22 Oct 2020 09:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=B9=E5=88=A4=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FlowChartController.java | 51 +++++++------- .../controller/ResultModelController.java | 63 +++++++++-------- .../flow/EvaluationStartStaffMapper.xml | 18 ++--- .../flow/FlowChartDetailRecordMapper.xml | 68 ++++++++++--------- .../mapper/flow/ResultTagetLibMapper.xml | 43 ++++++------ 5 files changed, 132 insertions(+), 111 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java index f3f6948f..44aacb42 100644 --- a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java @@ -106,32 +106,35 @@ public class FlowChartController { @ApiOperation("保存流程节点小流程列表") @ApiResponses({@ApiResponse(code = 200, message = "成功", response = FlowChartDetailRecord.class)}) public R saveDetailProcs(@RequestBody @ApiParam FlowChartDetailRecordListReq flowChartDetailRecordListReq) { - List inserts = new ArrayList<>(); - List updaes = new ArrayList<>(); - int index = 0; - for (FlowChartDetailRecordSimpleReq req:flowChartDetailRecordListReq.getRecordSimpleDtos() - ) { - FlowChartDetailRecord flowChartDetailRecord = new FlowChartDetailRecord(); - BeanUtils.copyProperties(req, flowChartDetailRecord); - flowChartDetailRecord.setChartId(flowChartDetailRecordListReq.getId()); - flowChartDetailRecord.setEvaluationGroupId(flowChartDetailRecordListReq.getEvaluationGroupId()); - flowChartDetailRecord.setStepIndex(index); - if(flowChartDetailRecord.getId() != null && flowChartDetailRecord.getId().intValue() > 0){ - updaes.add(flowChartDetailRecord); - }else{ - inserts.add(flowChartDetailRecord); - } - if(flowChartDetailRecord.getIsDelete() == null || flowChartDetailRecord.getIsDelete().intValue() == 0){ - index++; - } + if(flowChartDetailRecordListReq.getRecordSimpleDtos() != null && flowChartDetailRecordListReq.getRecordSimpleDtos().size() > 0){ + List inserts = new ArrayList<>(); + List updaes = new ArrayList<>(); + int index = 0; + for (FlowChartDetailRecordSimpleReq req:flowChartDetailRecordListReq.getRecordSimpleDtos() + ) { + FlowChartDetailRecord flowChartDetailRecord = new FlowChartDetailRecord(); + BeanUtils.copyProperties(req, flowChartDetailRecord); + flowChartDetailRecord.setChartId(flowChartDetailRecordListReq.getId()); + flowChartDetailRecord.setEvaluationGroupId(flowChartDetailRecordListReq.getEvaluationGroupId()); + flowChartDetailRecord.setStepIndex(index); + if(flowChartDetailRecord.getId() != null && flowChartDetailRecord.getId().intValue() > 0){ + updaes.add(flowChartDetailRecord); + }else{ + inserts.add(flowChartDetailRecord); + } + if(flowChartDetailRecord.getIsDelete() == null || flowChartDetailRecord.getIsDelete().intValue() == 0){ + index++; + } + } + if(inserts.size() > 0){ + flowChartDetailRecordService.insertFlowChartDetailRecords(inserts); + } + if(updaes.size() > 0){ + flowChartDetailRecordService.updateBatchById(updaes);//.updateCoverFlowChartDetailRecordByIds(updaes); + } } - if(inserts.size() > 0){ - flowChartDetailRecordService.insertFlowChartDetailRecords(inserts); - } - if(updaes.size() > 0){ - flowChartDetailRecordService.updateBatchById(updaes);//.updateCoverFlowChartDetailRecordByIds(updaes); - } + return R.ok(); } diff --git a/src/main/java/com/lz/modules/performance/controller/ResultModelController.java b/src/main/java/com/lz/modules/performance/controller/ResultModelController.java index c7139b1b..49a0edd5 100644 --- a/src/main/java/com/lz/modules/performance/controller/ResultModelController.java +++ b/src/main/java/com/lz/modules/performance/controller/ResultModelController.java @@ -40,16 +40,20 @@ public class ResultModelController { public R getByGroupId(@RequestParam @ApiParam("考核组ID") Long id) { //List resultModels = resultModelService.selectResultModelByGroupId(id); + + return R.ok().put("data",getResultModelDto(id)); + } + + private List getResultModelDto(Long id){ List resultModelDtos = resultModelService.selectResultDtoByGroupId(id); for (ResultModelDto dto:resultModelDtos - ) { + ) { List libDtos = resultTagetLibService.selectResultTagetLibByModelId(dto.getId()); dto.setTagetLibs(libDtos); } - return R.ok().put("data",resultModelDtos); + return resultModelDtos; } - @RequestMapping("/getById") public R getById(@RequestBody ResultModel resultModel) { resultModel = resultModelService.selectResultModelById(resultModel.getId()); @@ -79,6 +83,8 @@ public class ResultModelController { public R saveDetail(@RequestBody @ApiParam ResultModelDetailReq resultModelDetailReq) { + + int resultModelOrderBy = 0; for (ResultModelItemReq itemReq: resultModelDetailReq.getModelItems()) { @@ -94,35 +100,38 @@ public class ResultModelController { }else{ resultModelService.insertResultModel(resultModel); } - int libOrderBy = 0; - List inserts = new ArrayList<>(); - List updates = new ArrayList<>(); - for (ResultTagetLibItemReq req:itemReq.getTagetLibItems() - ) { - ResultTagetLib resultTagetLib = new ResultTagetLib(); - BeanUtils.copyProperties(req, resultTagetLib); - resultTagetLib.setModelId(resultModel.getId()); - resultTagetLib.setOrderBy(libOrderBy); - if(resultTagetLib.getId() != null && resultTagetLib.getId().intValue() > 0){ - updates.add(resultTagetLib); - }else{ - inserts.add(resultTagetLib); + if(itemReq.getTagetLibItems() != null){ + int libOrderBy = 0; + List inserts = new ArrayList<>(); + List updates = new ArrayList<>(); + for (ResultTagetLibItemReq req:itemReq.getTagetLibItems() + ) { + ResultTagetLib resultTagetLib = new ResultTagetLib(); + BeanUtils.copyProperties(req, resultTagetLib); + resultTagetLib.setModelId(resultModel.getId()); + resultTagetLib.setOrderBy(libOrderBy); + if(resultTagetLib.getId() != null && resultTagetLib.getId().intValue() > 0){ + updates.add(resultTagetLib); + }else{ + inserts.add(resultTagetLib); + } + if(resultTagetLib.getIsDelete() == null || resultTagetLib.getIsDelete().intValue() == 0){ + libOrderBy++; + } + } - if(resultTagetLib.getIsDelete() == null || resultTagetLib.getIsDelete().intValue() == 0){ - libOrderBy++; + if(inserts.size() > 0){ + resultTagetLibService.insertResultTagetLibs(inserts); + } + if(updates.size() > 0){ + resultTagetLibService.updateBatchById(updates); } - } - if(inserts.size() > 0){ - resultTagetLibService.insertResultTagetLibs(inserts); - } - if(updates.size() > 0){ - resultTagetLibService.updateBatchById(updates); + if(resultModel.getIsDelete() == null || resultModel.getIsDelete().intValue() == 0){ + resultModelOrderBy++; + } } - if(resultModel.getIsDelete() == null || resultModel.getIsDelete().intValue() == 0){ - resultModelOrderBy++; - } } return R.ok(); diff --git a/src/main/resources/mapper/flow/EvaluationStartStaffMapper.xml b/src/main/resources/mapper/flow/EvaluationStartStaffMapper.xml index 1e1db351..978a3c25 100644 --- a/src/main/resources/mapper/flow/EvaluationStartStaffMapper.xml +++ b/src/main/resources/mapper/flow/EvaluationStartStaffMapper.xml @@ -85,16 +85,18 @@ insert into lz_evaluation_start_staff( - evaluation_id, - start_id, - staff_id, - type + evaluation_id, + start_id, + staff_id, + type, + is_delete )values - #{ item.evaluationId}, - #{ item.startId}, - #{ item.staffId}, - #{ item.type} + #{ item.evaluationId}, + #{ item.startId}, + #{ item.staffId}, + #{ item.type}, + 0 diff --git a/src/main/resources/mapper/flow/FlowChartDetailRecordMapper.xml b/src/main/resources/mapper/flow/FlowChartDetailRecordMapper.xml index f3896936..45b13b85 100644 --- a/src/main/resources/mapper/flow/FlowChartDetailRecordMapper.xml +++ b/src/main/resources/mapper/flow/FlowChartDetailRecordMapper.xml @@ -118,51 +118,55 @@ + insert into lz_flow_chart_detail_record( - chart_id, - evaluation_group_id, - status, - opt_ids, - opt_type, - role_ids, - step_type, - step_index, - weight - )values - - #{ item.chartId}, - #{ item.evaluationGroupId}, - #{ item.status}, - #{ item.optIds}, - #{ item.optType}, - #{ item.roleIds}, - #{ item.stepType}, - #{ item.stepIndex}, - #{ item.weight} + chart_id, + evaluation_group_id, + status, + opt_ids, + opt_type, + role_ids, + step_type, + step_index, + weight, + is_delete + )values( + + #{ item.chartId}, + #{ item.evaluationGroupId}, + #{ item.status}, + #{ item.optIds}, + #{ item.optType}, + #{ item.roleIds}, + #{ item.stepType}, + #{ item.stepIndex}, + #{ item.weight}, + 0 + ) - + update lz_flow_chart_detail_record set is_delete = #{item.isDelete}, - chart_id = #{ item.chartId}, - evaluation_group_id = #{ item.evaluationGroupId}, - status = #{ item.status}, - opt_ids = #{ item.optIds}, - opt_type = #{ item.optType}, - role_ids = #{ item.roleIds}, - step_type = #{ item.stepType}, - step_index = #{ item.stepIndex}, - weight = #{ item.weight} + chart_id = #{ item.chartId}, + evaluation_group_id = #{ item.evaluationGroupId}, + status = #{ item.status}, + opt_ids = #{ item.optIds}, + opt_type = #{ item.optType}, + role_ids = #{ item.roleIds}, + step_type = #{ item.stepType}, + step_index = #{ item.stepIndex}, + weight = #{ item.weight} ,gmt_modified = now() where id = #{item.id} - ; - + + diff --git a/src/main/resources/mapper/flow/ResultTagetLibMapper.xml b/src/main/resources/mapper/flow/ResultTagetLibMapper.xml index 666f0d4c..525b46c7 100644 --- a/src/main/resources/mapper/flow/ResultTagetLibMapper.xml +++ b/src/main/resources/mapper/flow/ResultTagetLibMapper.xml @@ -105,40 +105,43 @@ + insert into lz_result_taget_lib( - name, - model_id, - weight, - key_result, - order_by - )values - + name, + model_id, + weight, + key_result, + order_by, + is_delete + )values( - #{ item.name}, - #{ item.modelId}, - #{ item.weight}, - #{ item.keyResult}, - #{ item.orderBy} + #{ item.name}, + #{ item.modelId}, + #{ item.weight}, + #{ item.keyResult}, + #{ item.orderBy}, + 0 + ) - + update lz_result_taget_lib set is_delete = #{item.isDelete}, - name = #{item.name}, - model_id = #{item.modelId}, - weight = #{item.weight}, - key_result = #{item.keyResult}, - order_by = #{item.orderBy} + name = #{item.name}, + model_id = #{item.modelId}, + weight = #{item.weight}, + key_result = #{item.keyResult}, + order_by = #{item.orderBy} ,gmt_modified = now() where id = #{item.id} - ; - + +