1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

add the post of selectLimitByUserId

This commit is contained in:
cccccyb
2023-05-30 23:15:00 +08:00
parent 55126b913f
commit 2f5b1e4fbc
5 changed files with 49 additions and 0 deletions

View File

@@ -156,4 +156,11 @@ public class NoticeController {
return ResponseResult.build(code, msg, noticePageList.getRecords()); return ResponseResult.build(code, msg, noticePageList.getRecords());
} }
@GetMapping("/limit")
public ResponseResult<List<Notice>> selectLimitByUserId(){
List<Notice> selectLimitByUserId = noticeReceiveService.selectLimitByUserId();
String msg = (null!=selectLimitByUserId) ? "" : "数据查询失败,请重试!";
return ResponseResult.build((null!=selectLimitByUserId) ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, selectLimitByUserId);
}
} }

View File

@@ -18,5 +18,6 @@ import java.util.List;
@Mapper @Mapper
public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> { public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> {
List<Notice> selectByUserId(Long userId,Integer readStatus); List<Notice> selectByUserId(Long userId,Integer readStatus);
List<Notice> selectLimitByUserId(Long userId);
} }

View File

@@ -17,5 +17,8 @@ import java.util.List;
public interface INoticeReceiveService extends IService<NoticeReceive> { public interface INoticeReceiveService extends IService<NoticeReceive> {
List<Notice> selectByUserId(Integer readStatus); List<Notice> selectByUserId(Integer readStatus);
List<Notice> selectLimitByUserId();
Boolean modifyNoticeIsRead(Notice notice); Boolean modifyNoticeIsRead(Notice notice);
} }

View File

@@ -30,6 +30,12 @@ public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, N
return noticeReceiveMapper.selectByUserId(userId,readStatus); return noticeReceiveMapper.selectByUserId(userId,readStatus);
} }
@Override
public List<Notice> selectLimitByUserId() {
Long userId = WebUtil.getLoginUser().getUser().getId();
return noticeReceiveMapper.selectLimitByUserId(userId);
}
@Override @Override
public Boolean modifyNoticeIsRead(Notice notice) { public Boolean modifyNoticeIsRead(Notice notice) {
Integer readStatus = null; Integer readStatus = null;

View File

@@ -45,4 +45,36 @@
<id property="id" column="uid"/> <id property="id" column="uid"/>
</association> </association>
</resultMap> </resultMap>
<!-- 所接收到公告的前五条公告 -->
<select id="selectLimitByUserId" resultMap="selectAllMap">
select u.id uid,
u.username,
n.id nid,
n.title,
n.content,
n.type_id,
n.sender_id,
n.create_time,
n.send_time,
n.end_time,
n.priority,
n.top,
n.modify_time,
n.origin_id,
type.id typeId,
type.name,
type.enable,
notice_receive.id receiveId,
notice_receive.already_read receiveRead
from t_notice_receive notice_receive
left join t_notice n on n.id = notice_receive.notice_id
left join t_notice_type type on type.id = n.type_id
left join t_user u on n.sender_id = u.id
<where>
and notice_receive.user_id=#{userId}
and notice_receive.deleted=0
</where>
order by n.top desc, n.create_time desc
limit 5;
</select>
</mapper> </mapper>