This commit is contained in:
2025-07-01 17:54:58 +08:00
commit 57dcd609e2
5136 changed files with 346184 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-business</artifactId>
<version>3.8.7</version>
</parent>
<artifactId>zhwl-notice</artifactId>
<description>消息模块</description>
<dependencies>
</dependencies>
</project>

View File

@@ -0,0 +1,110 @@
package com.zhwl.notice.controller;
import com.zhwl.common.annotation.Log;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.core.page.TableDataInfo;
import com.zhwl.common.enums.BusinessType;
import com.zhwl.common.utils.SecurityUtils;
import com.zhwl.common.utils.poi.ExcelUtil;
import com.zhwl.notice.domain.ZdyNotice;
import com.zhwl.notice.service.IZdyNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 消息Controller
*
* @author ruoyi
* @date 2024-04-17
*/
@RestController
@RequestMapping("/business/notice")
public class ZdyNoticeController extends BaseController {
@Autowired
private IZdyNoticeService zdyNoticeService;
/**
* 查询消息列表
*/
// @PreAuthorize("@ss.hasPermi('business:notice:list')")
@GetMapping("/list")
public TableDataInfo list(ZdyNotice zdyNotice) {
startPage();
List<ZdyNotice> list = zdyNoticeService.selectZdyNoticeList(zdyNotice);
return getDataTable(list);
}
/**
* 导出消息列表
*/
// @PreAuthorize("@ss.hasPermi('business:notice:export')")
@Log(title = "消息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZdyNotice zdyNotice) {
List<ZdyNotice> list = zdyNoticeService.selectZdyNoticeList(zdyNotice);
ExcelUtil<ZdyNotice> util = new ExcelUtil<>(ZdyNotice.class);
util.exportExcel(response, list, "消息数据");
}
/**
* 获取消息详细信息
*/
// @PreAuthorize("@ss.hasPermi('business:notice:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) {
return success(zdyNoticeService.selectZdyNoticeById(id));
}
/**
* 新增消息
*/
// @PreAuthorize("@ss.hasPermi('business:notice:add')")
@Log(title = "消息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZdyNotice zdyNotice) {
return toAjax(zdyNoticeService.insertZdyNotice(zdyNotice));
}
/**
* 修改消息
*/
// @PreAuthorize("@ss.hasPermi('business:notice:edit')")
@Log(title = "消息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZdyNotice zdyNotice) {
return toAjax(zdyNoticeService.updateZdyNotice(zdyNotice));
}
/**
* 删除消息
*/
// @PreAuthorize("@ss.hasPermi('business:notice:remove')")
@Log(title = "消息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids) {
return toAjax(zdyNoticeService.deleteZdyNoticeByIds(ids));
}
/**
* 设置消息已读
*/
@Log(title = "消息", businessType = BusinessType.UPDATE)
@PatchMapping("/noticeRead/{id}")
public AjaxResult noticeRead(@PathVariable Integer id) {
return toAjax(zdyNoticeService.noticeRead(id));
}
/**
* 查询未读消息列表
*/
@GetMapping("/noReadList")
public AjaxResult noReadList() {
return AjaxResult.success(zdyNoticeService.selectZdyNoticeNoRead(SecurityUtils.getUserId()));
}
}

View File

@@ -0,0 +1,53 @@
package com.zhwl.notice.domain;
import com.zhwl.common.annotation.Excel;
import com.zhwl.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 消息对象 zdy_notice
*
* @author ruoyi
* @date 2024-04-17
*/
@EqualsAndHashCode(callSuper = false)
@Data
public class ZdyNotice extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Integer id;
/**
* 发送者
*/
@Excel(name = "发送者")
private Long from;
/**
* 接受者
*/
@Excel(name = "接受者")
private Long userId;
/**
* 关联ID
*/
@Excel(name = "关联ID")
private Long linkId;
/**
* 内容
*/
@Excel(name = "内容")
private String content;
/**
* 是否已读0未读 1已读
*/
@Excel(name = "是否已读", readConverterExp = "0=未读,1=已读")
private Integer isRead;
}

View File

@@ -0,0 +1,36 @@
package com.zhwl.notice.domain.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 消息对象 zdy_notice
*
* @author ruoyi
*/
@Data
public class ZdyNoticeVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Integer id;
/**
* 关联ID
*/
private Long linkId;
/**
* 投诉类型
*/
private String typeName;
/**
* 投诉人
*/
private String userName;
}

View File

@@ -0,0 +1,72 @@
package com.zhwl.notice.mapper;
import com.zhwl.notice.domain.ZdyNotice;
import com.zhwl.notice.domain.vo.ZdyNoticeVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 消息Mapper接口
*
* @author ruoyi
* @date 2024-04-17
*/
@Mapper
public interface ZdyNoticeMapper {
/**
* 查询消息
*
* @param id 消息主键
* @return 消息
*/
ZdyNotice selectZdyNoticeById(Integer id);
/**
* 查询消息列表
*
* @param zdyNotice 消息
* @return 消息集合
*/
List<ZdyNotice> selectZdyNoticeList(ZdyNotice zdyNotice);
/**
* 新增消息
*
* @param zdyNotice 消息
* @return 结果
*/
int insertZdyNotice(ZdyNotice zdyNotice);
/**
* 修改消息
*
* @param zdyNotice 消息
* @return 结果
*/
int updateZdyNotice(ZdyNotice zdyNotice);
/**
* 删除消息
*
* @param id 消息主键
* @return 结果
*/
int deleteZdyNoticeById(Integer id);
/**
* 批量删除消息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteZdyNoticeByIds(Integer[] ids);
/**
* 查询未读消息
*
* @param userId 用户消息
* @return 消息集合
*/
List<ZdyNoticeVo> selectZdyNoticeNoRead(Long userId);
}

View File

@@ -0,0 +1,78 @@
package com.zhwl.notice.service;
import com.zhwl.notice.domain.ZdyNotice;
import com.zhwl.notice.domain.vo.ZdyNoticeVo;
import java.util.List;
/**
* 消息Service接口
*
* @author ruoyi
* @date 2024-04-17
*/
public interface IZdyNoticeService {
/**
* 查询消息
*
* @param id 消息主键
* @return 消息
*/
ZdyNotice selectZdyNoticeById(Integer id);
/**
* 查询消息列表
*
* @param zdyNotice 消息
* @return 消息集合
*/
List<ZdyNotice> selectZdyNoticeList(ZdyNotice zdyNotice);
/**
* 新增消息
*
* @param zdyNotice 消息
* @return 结果
*/
int insertZdyNotice(ZdyNotice zdyNotice);
/**
* 修改消息
*
* @param zdyNotice 消息
* @return 结果
*/
int updateZdyNotice(ZdyNotice zdyNotice);
/**
* 批量删除消息
*
* @param ids 需要删除的消息主键集合
* @return 结果
*/
int deleteZdyNoticeByIds(Integer[] ids);
/**
* 删除消息信息
*
* @param id 消息主键
* @return 结果
*/
int deleteZdyNoticeById(Integer id);
/**
* 设置消息已读
*
* @param id 消息主键
* @return 结果
*/
int noticeRead(Integer id);
/**
* 查询未读消息
*
* @param userId 用户消息
* @return 消息集合
*/
List<ZdyNoticeVo> selectZdyNoticeNoRead(Long userId);
}

View File

@@ -0,0 +1,105 @@
package com.zhwl.notice.service.impl;
import com.zhwl.common.utils.DateUtils;
import com.zhwl.notice.domain.ZdyNotice;
import com.zhwl.notice.domain.vo.ZdyNoticeVo;
import com.zhwl.notice.mapper.ZdyNoticeMapper;
import com.zhwl.notice.service.IZdyNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 消息Service业务层处理
*
* @author ruoyi
* @date 2024-04-17
*/
@Service
public class ZdyNoticeServiceImpl implements IZdyNoticeService {
@Autowired
private ZdyNoticeMapper zdyNoticeMapper;
/**
* 查询消息
*
* @param id 消息主键
* @return 消息
*/
@Override
public ZdyNotice selectZdyNoticeById(Integer id) {
return zdyNoticeMapper.selectZdyNoticeById(id);
}
/**
* 查询消息列表
*
* @param zdyNotice 消息
* @return 消息
*/
@Override
public List<ZdyNotice> selectZdyNoticeList(ZdyNotice zdyNotice) {
return zdyNoticeMapper.selectZdyNoticeList(zdyNotice);
}
/**
* 新增消息
*
* @param zdyNotice 消息
* @return 结果
*/
@Override
public int insertZdyNotice(ZdyNotice zdyNotice) {
zdyNotice.setCreateTime(DateUtils.getNowDate());
return zdyNoticeMapper.insertZdyNotice(zdyNotice);
}
/**
* 修改消息
*
* @param zdyNotice 消息
* @return 结果
*/
@Override
public int updateZdyNotice(ZdyNotice zdyNotice) {
zdyNotice.setUpdateTime(DateUtils.getNowDate());
return zdyNoticeMapper.updateZdyNotice(zdyNotice);
}
/**
* 批量删除消息
*
* @param ids 需要删除的消息主键
* @return 结果
*/
@Override
public int deleteZdyNoticeByIds(Integer[] ids) {
return zdyNoticeMapper.deleteZdyNoticeByIds(ids);
}
/**
* 删除消息信息
*
* @param id 消息主键
* @return 结果
*/
@Override
public int deleteZdyNoticeById(Integer id) {
return zdyNoticeMapper.deleteZdyNoticeById(id);
}
@Override
public int noticeRead(Integer id) {
ZdyNotice zdyNotice = new ZdyNotice();
zdyNotice.setId(id);
zdyNotice.setIsRead(1);
zdyNotice.setUpdateTime(DateUtils.getNowDate());
return zdyNoticeMapper.updateZdyNotice(zdyNotice);
}
@Override
public List<ZdyNoticeVo> selectZdyNoticeNoRead(Long userId) {
return zdyNoticeMapper.selectZdyNoticeNoRead(userId);
}
}

View File

@@ -0,0 +1,147 @@
<?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.zhwl.notice.mapper.ZdyNoticeMapper">
<resultMap type="ZdyNotice" id="ZdyNoticeResult">
<result property="id" column="id"/>
<result property="from" column="from"/>
<result property="userId" column="user_id"/>
<result property="linkId" column="link_id"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="isRead" column="is_read"/>
</resultMap>
<sql id="selectZdyNoticeVo">
select id,
`from`,
user_id,
link_id,
content,
create_time,
update_time,
is_read
from zdy_notice
</sql>
<select id="selectZdyNoticeList" parameterType="ZdyNotice" resultMap="ZdyNoticeResult">
<include refid="selectZdyNoticeVo"/>
<where>
<if test="from != null ">
and `from` = #{from}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="linkId != null ">
and link_id = #{linkId}
</if>
<if test="content != null and content != ''">
and content = #{content}
</if>
<if test="isRead != null ">
and is_read = #{isRead}
</if>
</where>
</select>
<select id="selectZdyNoticeById" parameterType="Integer"
resultMap="ZdyNoticeResult">
<include refid="selectZdyNoticeVo"/>
where id = #{id}
</select>
<insert id="insertZdyNotice" parameterType="ZdyNotice" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="from != null">`from`,
</if>
<if test="userId != null">user_id,
</if>
<if test="linkId != null">link_id,
</if>
<if test="content != null">content,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="isRead != null">is_read,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="from != null">#{from},
</if>
<if test="userId != null">#{userId},
</if>
<if test="linkId != null">#{linkId},
</if>
<if test="content != null">#{content},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="isRead != null">#{isRead},
</if>
</trim>
</insert>
<update id="updateZdyNotice" parameterType="ZdyNotice">
update zdy_notice
<trim prefix="SET" suffixOverrides=",">
<if test="from != null">`from` =
#{from},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="linkId != null">link_id =
#{linkId},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="isRead != null">is_read =
#{isRead},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyNoticeById" parameterType="Integer">
delete from zdy_notice where id = #{id}
</delete>
<delete id="deleteZdyNoticeByIds" parameterType="String">
delete from zdy_notice where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyNoticeNoRead" parameterType="Long" resultType="com.zhwl.notice.domain.vo.ZdyNoticeVo">
SELECT ti.id,
ti.link_id AS linkId,
dict.dict_label AS typeName,
IF((ue.`name` IS NOT NULL AND ue.`name` != ''), ue.`name`, ue.nickname) AS userName
FROM zdy_notice ti
LEFT JOIN zdy_cms_report re ON re.id = ti.link_id
LEFT JOIN sys_dict_data dict ON re.type = dict.dict_value
AND dict.dict_type = 'report_type'
LEFT JOIN zdy_user ue ON ue.id = re.user_id
where ti.user_id = #{userId}
and ti.is_read = 0
</select>
</mapper>

View File

@@ -0,0 +1,147 @@
<?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.zhwl.notice.mapper.ZdyNoticeMapper">
<resultMap type="ZdyNotice" id="ZdyNoticeResult">
<result property="id" column="id"/>
<result property="from" column="from"/>
<result property="userId" column="user_id"/>
<result property="linkId" column="link_id"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="isRead" column="is_read"/>
</resultMap>
<sql id="selectZdyNoticeVo">
select id,
`from`,
user_id,
link_id,
content,
create_time,
update_time,
is_read
from zdy_notice
</sql>
<select id="selectZdyNoticeList" parameterType="ZdyNotice" resultMap="ZdyNoticeResult">
<include refid="selectZdyNoticeVo"/>
<where>
<if test="from != null ">
and `from` = #{from}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="linkId != null ">
and link_id = #{linkId}
</if>
<if test="content != null and content != ''">
and content = #{content}
</if>
<if test="isRead != null ">
and is_read = #{isRead}
</if>
</where>
</select>
<select id="selectZdyNoticeById" parameterType="Integer"
resultMap="ZdyNoticeResult">
<include refid="selectZdyNoticeVo"/>
where id = #{id}
</select>
<insert id="insertZdyNotice" parameterType="ZdyNotice" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="from != null">`from`,
</if>
<if test="userId != null">user_id,
</if>
<if test="linkId != null">link_id,
</if>
<if test="content != null">content,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="isRead != null">is_read,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="from != null">#{from},
</if>
<if test="userId != null">#{userId},
</if>
<if test="linkId != null">#{linkId},
</if>
<if test="content != null">#{content},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="isRead != null">#{isRead},
</if>
</trim>
</insert>
<update id="updateZdyNotice" parameterType="ZdyNotice">
update zdy_notice
<trim prefix="SET" suffixOverrides=",">
<if test="from != null">`from` =
#{from},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="linkId != null">link_id =
#{linkId},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="isRead != null">is_read =
#{isRead},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyNoticeById" parameterType="Integer">
delete from zdy_notice where id = #{id}
</delete>
<delete id="deleteZdyNoticeByIds" parameterType="String">
delete from zdy_notice where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyNoticeNoRead" parameterType="Long" resultType="com.zhwl.notice.domain.vo.ZdyNoticeVo">
SELECT ti.id,
ti.link_id AS linkId,
dict.dict_label AS typeName,
IF((ue.`name` IS NOT NULL AND ue.`name` != ''), ue.`name`, ue.nickname) AS userName
FROM zdy_notice ti
LEFT JOIN zdy_cms_report re ON re.id = ti.link_id
LEFT JOIN sys_dict_data dict ON re.type = dict.dict_value
AND dict.dict_type = 'report_type'
LEFT JOIN zdy_user ue ON ue.id = re.user_id
where ti.user_id = #{userId}
and ti.is_read = 0
</select>
</mapper>