消息通知

This commit is contained in:
liang.chao 2024-12-20 19:45:24 +08:00
parent accc93b0a6
commit af018df883
6 changed files with 206 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package com.bonus.material.notice.controller;
import com.bonus.common.core.constant.SecurityConstants;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.InnerAuth;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
import com.bonus.material.notice.entity.Notice;
import com.bonus.material.notice.service.NoticeService;
import com.bonus.system.api.RemoteNoticeService;
import com.bonus.system.api.domain.SysNotice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/12/20 - 19:12
*/
@RestController
@RequestMapping("/notice")
@Api(value = "消息通知", tags = "消息通知")
@Slf4j
public class NoticeController extends BaseController {
@Resource
private NoticeService noticeService;
@GetMapping("/list")
@ApiOperation(value = "消息列表")
public AjaxResult list(Notice notice) {
startPage();
List<Notice> sysNotices = noticeService.selectNoticeList(notice);
return AjaxResult.success(getDataTable(sysNotices));
}
}

View File

@ -0,0 +1,73 @@
package com.bonus.material.notice.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @Authorliang.chao
* @Date2024/12/20 - 19:35
*/
@Data
public class Notice {
/**
* 公告ID
*/
private Integer noticeId;
/**
* 公告标题
*/
private String noticeTitle;
/**
* 公告类型1通知 2公告 3质检到期提醒
*/
private String noticeType;
/**
* 公告内容
*/
private String noticeContent;
/**
* 公告状态0正常 1关闭
*/
private String status;
/**
* 创建者
*/
private String createBy;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date updateTime;
/**
* 备注
*/
private String remark;
/**
* 装备质检到期所属公司
*/
private Integer ownCo;
}

View File

@ -0,0 +1,14 @@
package com.bonus.material.notice.mapper;
import com.bonus.material.notice.entity.Notice;
import com.bonus.system.api.domain.SysNotice;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/12/20 - 19:25
*/
public interface NoticeMapper {
List<Notice> selectNoticeList(Notice notice);
}

View File

@ -0,0 +1,14 @@
package com.bonus.material.notice.service;
import com.bonus.material.notice.entity.Notice;
import com.bonus.system.api.domain.SysNotice;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/12/20 - 19:22
*/
public interface NoticeService {
List<Notice> selectNoticeList(Notice notice);
}

View File

@ -0,0 +1,25 @@
package com.bonus.material.notice.service.impl;
import com.bonus.material.notice.entity.Notice;
import com.bonus.material.notice.mapper.NoticeMapper;
import com.bonus.material.notice.service.NoticeService;
import com.bonus.system.api.domain.SysNotice;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/12/20 - 19:23
*/
@Service
public class NoticeServiceImpl implements NoticeService {
@Resource
private NoticeMapper noticeMapper;
@Override
public List<Notice> selectNoticeList(Notice notice) {
return noticeMapper.selectNoticeList(notice);
}
}

View File

@ -0,0 +1,33 @@
<?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.bonus.material.notice.mapper.NoticeMapper">
<select id="selectNoticeList" resultType="com.bonus.material.notice.entity.Notice">
select
notice_id,
notice_title,
notice_type,
notice_content,
status,
create_by,
create_time,
update_by,
update_time,
remark
from sys_notice
<where>
(own_co is null or own_co = #{ownCo})
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
</mapper>