Browse Source

notify 代码

master
PoffyZhang 1 year ago
parent
commit
b9303bb01a
7 changed files with 216 additions and 0 deletions
  1. +82
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java
  2. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java
  3. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.java
  4. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml
  5. +54
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java
  6. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INotifyService.java
  7. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NotifyServiceImpl.java

+ 82
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NotifyController.java View File

@@ -0,0 +1,82 @@
package com.ningdatech.pmapi.sys.controller;

import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.sys.manage.NoticeManage;
import com.ningdatech.pmapi.sys.model.req.NoticeListReq;
import com.ningdatech.pmapi.sys.model.req.NoticeSaveReq;
import com.ningdatech.pmapi.sys.model.req.NoticeStatusModifyReq;
import com.ningdatech.pmapi.sys.model.vo.NoticeDetailVO;
import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* 通知消息 前端控制器
* </p>
*
* @author ZPF
* @since 2023-03-22
*/
@RestController
@Api(tags = "通知管理")
@RequiredArgsConstructor
@RequestMapping("/api/v1/notify")
public class NotifyController {

private final NoticeManage noticeManage;

@PostMapping("/save")
@ApiOperation("新增公告")
@WebLog("新增公告")
public IdVo<Long> save(@Valid @RequestBody NoticeSaveReq req) {
return noticeManage.saveOrModify(req);
}

@GetMapping("/detail/{id}")
@ApiOperation("公告详情")
public NoticeDetailVO save(@PathVariable Long id) {
return noticeManage.detail(id);
}

@PostMapping("/enabled")
@ApiOperation("启用/禁用")
@WebLog("启用/禁用")
public Boolean save(@Valid @RequestBody NoticeStatusModifyReq req) {
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,
@RequestParam(required = false) Integer type) {
return noticeManage.dashboardList(limit, type);
}

@GetMapping("/manage/list")
@ApiOperation("公告管理列表")
public PageVo<NoticeListItemVO> listByManager(NoticeListReq req) {
return noticeManage.listByManager(req);
}

@DeleteMapping("/del")
@ApiOperation("删除公告")
@WebLog("删除公告")
public void delNotice(@RequestBody IdVo<Long> req) {
noticeManage.delNotice(req.getId());
}

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.sys.manage;

import com.ningdatech.pmapi.sys.service.INotifyService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
* <p>
* NotifyManage
* </p>
*
* @author ZPF
* @since 21:30 2023/03/21
*/
@Component
@RequiredArgsConstructor
public class NotifyManage {

private final INotifyService notifyService;

}

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.java View File

@@ -0,0 +1,17 @@
package com.ningdatech.pmapi.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.sys.model.entity.Notice;
import com.ningdatech.pmapi.sys.model.entity.Notify;

/**
* <p>
* 通知 Mapper 接口
* </p>
*
* @author zpf
* @since 2023-03-21
*/
public interface NotifyMapper extends BaseMapper<Notify> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/NotifyMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.sys.mapper.NotifyMapperr">

</mapper>

+ 54
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java View File

@@ -0,0 +1,54 @@
package com.ningdatech.pmapi.sys.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 通知
* </p>
*
* @author zpf
* @since 2023-03-21
*/
@Data
@TableName("wflow_notifys")
@ApiModel(value = "消息通知", description = "消息通知")
public class Notify implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("ID")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("消息类型")
private String type;

@ApiModelProperty("标题")
private String title;

@ApiModelProperty("内容")
private String content;

@ApiModelProperty("实例id")
private String instanceId;

@ApiModelProperty("是否已读")
private Boolean readed;

@ApiModelProperty("用户ID")
private Long userId;

@ApiModelProperty("link")
private String link;

@ApiModelProperty("创建时间")
private LocalDateTime createTime;

}

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/INotifyService.java View File

@@ -0,0 +1,17 @@
package com.ningdatech.pmapi.sys.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.sys.model.entity.Notify;

/**
* <p>
* 系统通知 服务类
* </p>
*
* @author zpf
* @since 2023-03-21
*/
public interface INotifyService extends IService<Notify> {


}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/NotifyServiceImpl.java View File

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.sys.mapper.NotifyMapper;
import com.ningdatech.pmapi.sys.model.entity.Notify;
import com.ningdatech.pmapi.sys.service.INotifyService;
import org.springframework.stereotype.Service;

/**
* <p>
* 系统通知 服务实现类
* </p>
*
* @author zof
* @since 2023-03-21
*/
@Service
public class NotifyServiceImpl extends ServiceImpl<NotifyMapper, Notify> implements INotifyService {

}

Loading…
Cancel
Save