|
@@ -132,10 +132,11 @@ public class BandingTaskClassController {
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping
|
|
@PutMapping
|
|
- @ApiOperation(value = "修改新生分班")
|
|
|
|
|
|
+ @ApiOperation(value = "批量新增或者修改新生分班")
|
|
@SaCheckPermission("bandingTaskClass:edit")
|
|
@SaCheckPermission("bandingTaskClass:edit")
|
|
public RT<Boolean> update(@Valid @RequestBody List<UpdateBandingClassDto> dtoList){
|
|
public RT<Boolean> update(@Valid @RequestBody List<UpdateBandingClassDto> dtoList){
|
|
- List<BandingTaskClass> dataList = new ArrayList<>();
|
|
|
|
|
|
+ List<BandingTaskClass> insList = new ArrayList<>();
|
|
|
|
+ List<BandingTaskClass> updList = new ArrayList<>();
|
|
List<String> errorList = new ArrayList<>();
|
|
List<String> errorList = new ArrayList<>();
|
|
for (UpdateBandingClassDto dto : dtoList) {
|
|
for (UpdateBandingClassDto dto : dtoList) {
|
|
if(dto.getSortCode() != null){
|
|
if(dto.getSortCode() != null){
|
|
@@ -143,7 +144,7 @@ public class BandingTaskClassController {
|
|
new QueryWrapper<BandingTaskClass>().lambda()
|
|
new QueryWrapper<BandingTaskClass>().lambda()
|
|
.eq(BandingTaskClass::getSortCode, dto.getSortCode())
|
|
.eq(BandingTaskClass::getSortCode, dto.getSortCode())
|
|
.eq(BandingTaskClass::getBandingTaskId, dto.getBandingTaskId())
|
|
.eq(BandingTaskClass::getBandingTaskId, dto.getBandingTaskId())
|
|
- .ne(BandingTaskClass::getId, dto.getId())
|
|
|
|
|
|
+ .ne(dto.getId() != null,BandingTaskClass::getId, dto.getId())
|
|
);
|
|
);
|
|
if(!list.isEmpty()){
|
|
if(!list.isEmpty()){
|
|
errorList.add(dto.getName());
|
|
errorList.add(dto.getName());
|
|
@@ -151,13 +152,20 @@ public class BandingTaskClassController {
|
|
}
|
|
}
|
|
|
|
|
|
BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
|
|
BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
|
|
- bandingTask.setModifyDate(new Date());
|
|
|
|
|
|
+ if(bandingTask.getId() != null){
|
|
|
|
+ bandingTask.setModifyDate(new Date());
|
|
|
|
+ updList.add(bandingTask);
|
|
|
|
+ }else{
|
|
|
|
+ bandingTask.setCreateDate(new Date());
|
|
|
|
+ insList.add(bandingTask);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
if(!errorList.isEmpty()){
|
|
if(!errorList.isEmpty()){
|
|
return RT.error(errorList.toString().replace("[", "").replace("]", "") + ",分班排序重复");
|
|
return RT.error(errorList.toString().replace("[", "").replace("]", "") + ",分班排序重复");
|
|
}
|
|
}
|
|
-
|
|
|
|
- boolean isSuccess = bandingTaskClassService.updateBatchById(dataList);
|
|
|
|
|
|
+ boolean saveBatch = bandingTaskClassService.saveBatch(insList);
|
|
|
|
+ boolean isSuccess = bandingTaskClassService.updateBatchById(updList);
|
|
return RT.ok(isSuccess);
|
|
return RT.ok(isSuccess);
|
|
}
|
|
}
|
|
|
|
|