|
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -63,13 +64,13 @@ public class SystemNoticeServiceImpl extends MyBaseServiceImpl<SystemNoticeMappe
|
|
|
PageHelper.startPage(params.getPageNum(), params.getPageSize());
|
|
PageHelper.startPage(params.getPageNum(), params.getPageSize());
|
|
|
MPJLambdaWrapper<SystemNotice> wrapper = JoinWrappers.lambda(SystemNotice.class)
|
|
MPJLambdaWrapper<SystemNotice> wrapper = JoinWrappers.lambda(SystemNotice.class)
|
|
|
.selectAsClass(SystemNotice.class, NoticeStationVo.class)
|
|
.selectAsClass(SystemNotice.class, NoticeStationVo.class)
|
|
|
- .selectCollection(StationNotice.class, NoticeStationVo::getStationIdList, map ->map.result(StationNotice::getStationId))
|
|
|
|
|
- .leftJoin(StationNotice.class, StationNotice::getNoticeId, StationNotice::getId)
|
|
|
|
|
.eq(CommUtil.isNotEmptyAndNull(params.getStatus()), SystemNotice::getStatus, params.getStatus())
|
|
.eq(CommUtil.isNotEmptyAndNull(params.getStatus()), SystemNotice::getStatus, params.getStatus())
|
|
|
.like(CommUtil.isNotEmptyAndNull(params.getTitle()), SystemNotice::getTitle, params.getTitle())
|
|
.like(CommUtil.isNotEmptyAndNull(params.getTitle()), SystemNotice::getTitle, params.getTitle())
|
|
|
.like(CommUtil.isNotEmptyAndNull(params.getContent()), SystemNotice::getContent, params.getContent())
|
|
.like(CommUtil.isNotEmptyAndNull(params.getContent()), SystemNotice::getContent, params.getContent())
|
|
|
.orderByDesc(SystemNotice::getUpdateTime);
|
|
.orderByDesc(SystemNotice::getUpdateTime);
|
|
|
List<NoticeStationVo> res = this.selectJoinList(NoticeStationVo.class, wrapper);
|
|
List<NoticeStationVo> res = this.selectJoinList(NoticeStationVo.class, wrapper);
|
|
|
|
|
+ var notice2stations = stationNoticeService.lambdaQuery().in(StationNotice::getNoticeId, res.stream().map(NoticeStationVo::getId).toList()).list().stream().collect(Collectors.groupingBy(StationNotice::getNoticeId, Collectors.mapping(StationNotice::getStationId, Collectors.toList())));
|
|
|
|
|
+ res.forEach(item -> item.setStationIdList(notice2stations.get(item.getId())));
|
|
|
return new PageBean<>(res);
|
|
return new PageBean<>(res);
|
|
|
}
|
|
}
|
|
|
|
|
|