src/main/java/org/springblade/modules/desk/entity/Notice.java
@@ -78,4 +78,10 @@ */ private Integer type; /** * 接收人ids */ @TableField("received_ids") private String receivedIds; } src/main/java/org/springblade/modules/desk/mapper/NoticeMapper.xml
@@ -37,19 +37,18 @@ <select id="selectNoticePage" resultMap="noticeVOResultMap"> SELECT n.*, d.dict_value AS categoryName d.dict_value AS categoryName, bd.dept_name deptName FROM blade_notice n left join blade_dept bd on bd.id = n.dept_id LEFT JOIN ( SELECT * FROM blade_dict WHERE code = 'notice' ) d ( SELECT * FROM blade_dict WHERE code = 'notice' ) d ON n.category = d.dict_key <if test="notice.deptId!=null and notice.jurisdiction!=null"> left join blade_user bu on bu.dept_id = n.dept_id </if> n.category = d.dict_key WHERE n.is_deleted = 0 <if test="notice.title!=null"> @@ -58,15 +57,11 @@ <if test="notice.category!=null"> and n.category = #{notice.category} </if> <if test="notice.deptId!=null and notice.jurisdiction!=null"> and (n.dept_id = #{notice.deptId} or bu.jurisdiction = #{notice.jurisdiction} or n.dept_id = 1123598813738675201 ) <if test="notice.type!=null"> and n.type = #{notice.type} </if> <if test="notice.deptId!=null and notice.jurisdiction==null"> and (n.dept_id = #{notice.deptId} and n.category=2 or n.dept_id = 1123598813738675201 ) <if test="notice.deptId!=null and notice.deptId!=''"> and n.dept_id = #{notice.deptId} </if> <if test="notice.startTime!=null and notice.startTime!=''"> and n.release_time >= #{notice.startTime} src/main/java/org/springblade/modules/desk/service/impl/NoticeServiceImpl.java
@@ -17,13 +17,19 @@ package org.springblade.modules.desk.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.AllArgsConstructor; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.modules.desk.entity.Notice; import org.springblade.modules.desk.mapper.NoticeMapper; import org.springblade.modules.desk.service.INoticeService; import org.springblade.modules.desk.vo.NoticeVO; import org.springblade.modules.system.entity.User; import org.springblade.modules.system.service.IUserService; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; /** * 服务实现类 @@ -31,13 +37,34 @@ * @author Chill */ @Service @AllArgsConstructor public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, Notice> implements INoticeService { private IUserService userService; @Override public IPage<NoticeVO> selectNoticePage(IPage<NoticeVO> page, NoticeVO notice) { // 若不使用mybatis-plus自带的分页方法,则不会自动带入tenantId,所以我们需要自行注入 notice.setTenantId(AuthUtil.getTenantId()); return page.setRecords(baseMapper.selectNoticePage(page, notice)); List<NoticeVO> noticeVOS = baseMapper.selectNoticePage(page, notice); if (noticeVOS.size()>0){ noticeVOS.forEach(noticeVO -> { if (null!=noticeVO.getReceivedIds()){ List<String> receivedIds = Arrays.asList(noticeVO.getReceivedIds().split(",")); //查询用户信息 StringBuilder replyRealNameInfo = new StringBuilder(); for (String userId : receivedIds) { User user = userService.getById(userId); if (null!=user){ replyRealNameInfo = replyRealNameInfo.append(user.getRealName()).append(","); } } //截取 noticeVO.setReceivedName(replyRealNameInfo.substring(0, replyRealNameInfo.length() - 1)); } }); } return page.setRecords(noticeVOS); } } src/main/java/org/springblade/modules/desk/vo/NoticeVO.java
@@ -40,4 +40,15 @@ */ private Long userId; /** * 部门名称 */ private String deptName; /** * 接收人名称 */ private String receivedName; } src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -1858,7 +1858,7 @@ where 1=1 and (stats = 2 or stats = 4) <if test="information.jurisdiction!=null and information.jurisdiction!=''"> and sj.id = #{information.jurisdiction} and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction}) </if> </select> @@ -1912,7 +1912,7 @@ where 1=1 and (si.stats = 2 or si.stats = 4) <if test="information.jurisdiction!=null and information.jurisdiction!=''"> and sj.id = #{information.jurisdiction} and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction}) </if> </select> @@ -1960,7 +1960,7 @@ and (c.stats = 2 or c.stats = 4) and pnum < #{information.proportion} <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'"> and sj.id = #{information.jurisdiction} and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction}) </if> <if test="information.departmentid!=null and information.departmentid!=''"> and c.departmentid = #{information.departmentid} @@ -2056,7 +2056,7 @@ and (d.stats = 2 or d.stats = 4) and pnum < #{information.proportion} <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'"> and sj.id = #{information.jurisdiction} and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction}) </if> </select> @@ -2191,7 +2191,7 @@ a.dept_id = si.departmentid where 1=1 <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'"> and sj.id = #{information.jurisdiction} and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction}) </if> ) b where b.znum < 2