| | |
| | | package com.ycl.platform.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.platform.domain.entity.Platform; |
| | | import com.ycl.platform.domain.form.PlatformForm; |
| | |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | */ |
| | | @Override |
| | | public Result page(PlatformQuery query) { |
| | | IPage<PlatformVO> page = PageUtil.getPage(query, PlatformVO.class); |
| | | baseMapper.getPage(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | List<PlatformVO> list = baseMapper.getPage(query); |
| | | List<PlatformVO> parentList = list.stream().filter(item -> item.getParentId() == 0).collect(Collectors.toList()); |
| | | List<PlatformVO> resultList = new ArrayList<>(4); |
| | | for (PlatformVO parent : parentList) { |
| | | List<PlatformVO> childList = list.stream().filter(item -> item.getParentId().equals(parent.getId())).collect(Collectors.toList()); |
| | | |
| | | parent.setChildNum(childList.size()); |
| | | resultList.add(parent); |
| | | resultList.addAll(childList); |
| | | } |
| | | // 前端不用展示分页 |
| | | return Result.ok().data(resultList).total(0); |
| | | } |
| | | |
| | | /** |