提交 a227d90f authored 作者: xc's avatar xc

xc

上级 e8bfb4ee
......@@ -15,5 +15,7 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> {
Page<Notice> findOutBySenderAndType(String sender, int type, Pageable pageable);
Page<Notice> findOutByAddresseeLikeAndType(String addressee, int type, Pageable pageable);
List<Notice> findOutByStatusAndTypeAndLabel(int status, int type, int label);
Page<Notice> findOutByAddresseeLikeAndTypeAndStatus(String addressee, int type, Pageable pageable, int status);
Page<Notice> findOutByAddresseeLikeAndTypeAndStatus(String addressee, int type, int status, Pageable pageable);
}
......@@ -71,13 +71,13 @@ public class NoticeController {
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", required = true, dataType = "int")})
public ResponseEntity<Paging<Notice>> getNoticeList(@RequestParam String user, int type,
int pageNum, int pageSize, int status){
log.info("获取通知列表接口:{},{}", user,type);
log.info("获取通知列表接口:{},{},{}", user,type,status);
Paging<Notice> data = new Paging<>();
if (status == 2){
//全部
data = noticeService.getReceiveList(user, type, pageNum, pageSize);
}else {
data = noticeService.getListByStatus(user, status, pageNum, pageSize);
data = noticeService.getListByStatus(user, status, pageNum, pageSize,type);
}
return ResponseEntity.ok(data);
......
......@@ -68,7 +68,7 @@ public class Notice {
@ApiModelProperty(value = "status", example = "0", dataType = "int" ,name = "通知状态",
notes = "未查看 0,已查看 1,已下载 2,默认 0")
@Column(name = "status")
private Integer status;
private int status;
/**
* 通知类型 接受 0,发送 1,草稿 2
......
......@@ -64,7 +64,7 @@ public interface NoticeService {
* @param pageSize
* @return
*/
Paging<Notice> getListByStatus(String user, int status, int pageNum, int pageSize);
Paging<Notice> getListByStatus(String user, int status, int pageNum, int pageSize,int type);
......
......@@ -118,6 +118,7 @@ public class NoticeServiceImpl implements NoticeService {
private Notice transform(Notice notice){
Notice notice1 = new Notice();
notice1.setId(notice.getId());
notice1.setTitle(notice.getTitle());
notice1.setAddressee(notice.getAddressee());
notice1.setDeadline(notice.getDeadline());
......@@ -286,10 +287,10 @@ public class NoticeServiceImpl implements NoticeService {
}
@Override
public Paging<Notice> getListByStatus(String user, int status, int pageNum, int pageSize) {
public Paging<Notice> getListByStatus(String user, int status, int pageNum, int pageSize,int type) {
try{
Pageable pageable = PageRequest.of(pageNum - 1, pageSize, Sort.Direction.DESC,"updateTime");
Page<Notice> p = noticeDao.findOutByAddresseeLikeAndTypeAndStatus(user, 0, pageable, status);
Page<Notice> p = noticeDao.findOutByAddresseeLikeAndTypeAndStatus("%"+user+"%",type, status, pageable);
Paging<Notice> paging = new Paging<>();
paging.setData(p.getContent());
paging.setPageSize(pageSize);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论