master:公告列表返回noticeType字段添加;

pull/1121/head
liujiang 2025-12-01 16:55:52 +08:00
parent 46d9afaffa
commit 3be17eda0f
2 changed files with 10 additions and 7 deletions

View File

@ -24,6 +24,8 @@ public class NoticeResDTO {
private Long id;
@ApiModelProperty(value = "公告标题")
private String noticeTitle;
@ApiModelProperty(value = "公告类型1通知 2公告")
private Integer noticeType;
@ApiModelProperty(value = "公告内容")
private String noticeContent;
@ApiModelProperty(value = "谁发的公告 1 档口 2 系统")

View File

@ -158,14 +158,15 @@ public class NoticeServiceImpl implements INoticeService {
}
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
List<Notice> noticeList = this.noticeMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(noticeList)) {
List<Long> userIdList = noticeList.stream().map(Notice::getUserId).collect(Collectors.toList());
List<SysUser> userList = this.userMapper.selectList(new LambdaQueryWrapper<SysUser>()
.in(SysUser::getUserId, userIdList).eq(SysUser::getDelFlag, Constants.UNDELETED));
Map<Long, SysUser> userMap = userList.stream().collect(Collectors.toMap(SysUser::getUserId, x -> x));
noticeList.forEach(x -> x.setCreateBy(userMap.containsKey(x.getUserId()) ?
userMap.get(x.getUserId()).getUserName() : ""));
if (CollectionUtils.isEmpty(noticeList)) {
return Page.empty(pageDTO.getPageSize(), pageDTO.getPageNum());
}
List<Long> userIdList = noticeList.stream().map(Notice::getUserId).collect(Collectors.toList());
List<SysUser> userList = this.userMapper.selectList(new LambdaQueryWrapper<SysUser>()
.in(SysUser::getUserId, userIdList).eq(SysUser::getDelFlag, Constants.UNDELETED));
Map<Long, SysUser> userMap = userList.stream().collect(Collectors.toMap(SysUser::getUserId, x -> x));
noticeList.forEach(x -> x.setCreateBy(userMap.containsKey(x.getUserId()) ?
userMap.get(x.getUserId()).getUserName() : ""));
return Page.convert(new PageInfo<>(noticeList), BeanUtil.copyToList(noticeList, NoticeResDTO.class));
}