优化
This commit is contained in:
parent
e1d6bf6045
commit
07dc224ff0
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -74,7 +75,7 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
|
||||
wrapper.lambda().orderByAsc(ProjectSubItem::getPlanStartTime);
|
||||
Page<ProjectSubItemDto> pageList = PageUtil.copyProperties(baseMapper.selectPage(page, wrapper), ProjectSubItemDto.class);
|
||||
List<ProjectSubItemDto> records = pageList.getRecords();
|
||||
build(records);
|
||||
build(records, null);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@ -93,7 +94,7 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
|
||||
wrapper.lambda().eq(ProjectSubItem::getParentId, 0);
|
||||
wrapper.lambda().orderByAsc(ProjectSubItem::getPlanStartTime);
|
||||
List<ProjectSubItemDto> records = PageUtil.copyProperties(baseMapper.selectList(wrapper), ProjectSubItemDto.class);
|
||||
build(records);
|
||||
build(records, 1);
|
||||
return records;
|
||||
}
|
||||
|
||||
@ -158,10 +159,14 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
|
||||
return false;
|
||||
}
|
||||
|
||||
private void build(List<ProjectSubItemDto> records) {
|
||||
private void build(List<ProjectSubItemDto> records, Integer state) {
|
||||
List<Long> ids = records.stream().map(r -> r.getId()).collect(Collectors.toList());
|
||||
if (ids.size() > 0) {
|
||||
List<ProjectSubItem> children = baseMapper.selectList(Wrappers.<ProjectSubItem>lambdaQuery().in(ProjectSubItem::getParentId, ids));
|
||||
LambdaQueryWrapper<ProjectSubItem> wrapper = Wrappers.<ProjectSubItem>lambdaQuery().in(ProjectSubItem::getParentId, ids);
|
||||
if (state != null) {
|
||||
wrapper.eq(ProjectSubItem::getApprovalStatus, state);
|
||||
}
|
||||
List<ProjectSubItem> children = baseMapper.selectList(wrapper);
|
||||
for (ProjectSubItem child : children) {
|
||||
if (child.getState() != 3) {
|
||||
if (child.getRealEndTime() != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user