Bladeren bron

增加置顶接口

master
WendyYang 1 jaar geleden
bovenliggende
commit
c16c51e5e6
3 gewijzigde bestanden met toevoegingen van 18 en 4 verwijderingen
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java
  2. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sys/entity/Notice.java
  3. +10
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java Bestand weergeven

@@ -52,6 +52,13 @@ public class NoticeController {
return noticeManage.changeEnabled(req);
}

@PostMapping("/topped")
@ApiOperation("置顶")
@WebLog("置顶")
public void topped(@RequestBody IdVo<Long> id) {
noticeManage.topped(id.getId());
}

@GetMapping("/dashboard/list")
@ApiOperation("工作台公告列表")
public PageVo<NoticeListItemVO> dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit) {


+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sys/entity/Notice.java Bestand weergeven

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -63,6 +62,6 @@ public class Notice implements Serializable {
private Boolean deleted;

@ApiModelProperty("置顶时间")
private LocalDateTime setTopTime;
private LocalDateTime toppedTime;

}

+ 10
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java Bestand weergeven

@@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

/**
@@ -64,6 +65,13 @@ public class NoticeManage {
return noticeService.updateById(notice);
}

public void topped(Long id) {
Notice notice = new Notice();
notice.setId(id);
notice.setToppedTime(LocalDateTime.now());
noticeService.updateById(notice);
}


public PageVo<NoticeListItemVO> dashboardList(Integer limit) {
NoticeListReq req = new NoticeListReq();
@@ -77,7 +85,7 @@ public class NoticeManage {
.eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled())
.like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle())
.eq(req.getType() != null, Notice::getType, req.getType())
.orderByDesc(Notice::getSetTopTime, Notice::getUpdateOn);
.orderByDesc(Notice::getToppedTime, Notice::getUpdateOn);
Page<Notice> page = noticeService.page(req.page(), wrapper);
if (page.getTotal() == 0) {
return PageVo.empty();
@@ -89,7 +97,7 @@ public class NoticeManage {
.title(w.getTitle())
.enabled(w.getEnabled())
.createOn(w.getCreateOn())
.topped(w.getSetTopTime() != null)
.topped(w.getToppedTime() != null)
.build());
return PageVo.of(tempDataList, page.getTotal());
}


Laden…
Annuleren
Opslaan