refactor: 修改客户端消息功能实现;移除不再需要的实体和相关数据库访问层类
This commit is contained in:
parent
f802ee3375
commit
39bf80baad
|
|
@ -9,7 +9,7 @@ import com.nflg.mobilebroken.common.pojo.request.MessageConfigRequest;
|
||||||
import com.nflg.mobilebroken.common.pojo.request.MessageSearchRequest;
|
import com.nflg.mobilebroken.common.pojo.request.MessageSearchRequest;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.MessageConfigVO;
|
import com.nflg.mobilebroken.common.pojo.vo.MessageConfigVO;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
||||||
import com.nflg.mobilebroken.repository.service.IMessageService;
|
import com.nflg.mobilebroken.repository.service.IAppMessageService;
|
||||||
import org.springframework.data.redis.core.HashOperations;
|
import org.springframework.data.redis.core.HashOperations;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -33,7 +33,7 @@ public class MessageController {
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMessageService messageService;
|
private IAppMessageService appMessageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索消息
|
* 搜索消息
|
||||||
|
|
@ -45,7 +45,7 @@ public class MessageController {
|
||||||
IPage<MessageVO> page=new Page<>();
|
IPage<MessageVO> page=new Page<>();
|
||||||
page.setCurrent(request.getPageNum());
|
page.setCurrent(request.getPageNum());
|
||||||
page.setSize(request.getPageSize());
|
page.setSize(request.getPageSize());
|
||||||
messageService.search(Constant.USER_ID,request.getTitle(),page);
|
appMessageService.search(Constant.USER_ID, request.getTitle(), page);
|
||||||
PageData<MessageVO> pageData=new PageData<>();
|
PageData<MessageVO> pageData=new PageData<>();
|
||||||
pageData.setPage(page.getCurrent());
|
pageData.setPage(page.getCurrent());
|
||||||
pageData.setPageSize(page.getSize());
|
pageData.setPageSize(page.getSize());
|
||||||
|
|
@ -61,7 +61,7 @@ public class MessageController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("getNotReadMessages")
|
@GetMapping("getNotReadMessages")
|
||||||
public ApiResult<List<MessageVO>> getNotReadMessages(@RequestParam(defaultValue = "10") Integer num){
|
public ApiResult<List<MessageVO>> getNotReadMessages(@RequestParam(defaultValue = "10") Integer num){
|
||||||
return ApiResult.success(messageService.getNotReadMessage(Constant.USER_ID,num));
|
return ApiResult.success(appMessageService.getNotReadMessage(Constant.USER_ID, num));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 后台-用户权限
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-17
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("admin_user_permission")
|
|
||||||
public class AdminUserPermission implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 菜单id
|
|
||||||
*/
|
|
||||||
private Integer menuId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人
|
|
||||||
*/
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后更新人
|
|
||||||
*/
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后更新时间
|
|
||||||
*/
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 消息
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-20
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class Message implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工单id
|
|
||||||
*/
|
|
||||||
private Integer ticketId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提醒事项
|
|
||||||
*/
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已读
|
|
||||||
*/
|
|
||||||
private Boolean isRead;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.mapper;
|
|
||||||
|
|
||||||
import com.nflg.mobilebroken.repository.entity.AdminUserPermission;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 后台-用户权限 Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-03
|
|
||||||
*/
|
|
||||||
public interface AdminUserPermissionMapper extends BaseMapper<AdminUserPermission> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
|
||||||
import com.nflg.mobilebroken.repository.entity.Message;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-14
|
|
||||||
*/
|
|
||||||
public interface MessageMapper extends BaseMapper<Message> {
|
|
||||||
|
|
||||||
List<MessageVO> getNotReadMessage(Integer userId, Integer num);
|
|
||||||
|
|
||||||
void search(Integer userId, String title, IPage<MessageVO> page);
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.service;
|
|
||||||
|
|
||||||
import com.nflg.mobilebroken.repository.entity.AdminUserPermission;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 后台-用户权限 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-03
|
|
||||||
*/
|
|
||||||
public interface IAdminUserPermissionService extends IService<AdminUserPermission> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
|
||||||
import com.nflg.mobilebroken.repository.entity.Message;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-14
|
|
||||||
*/
|
|
||||||
public interface IMessageService extends IService<Message> {
|
|
||||||
|
|
||||||
List<MessageVO> getNotReadMessage(Integer userId, Integer num);
|
|
||||||
|
|
||||||
void search(Integer userId, String title, IPage<MessageVO> page);
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
|
||||||
|
|
||||||
import com.nflg.mobilebroken.repository.entity.AdminUserPermission;
|
|
||||||
import com.nflg.mobilebroken.repository.mapper.AdminUserPermissionMapper;
|
|
||||||
import com.nflg.mobilebroken.repository.service.IAdminUserPermissionService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 后台-用户权限 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-03
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class AdminUserPermissionServiceImpl extends ServiceImpl<AdminUserPermissionMapper, AdminUserPermission> implements IAdminUserPermissionService {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.MessageVO;
|
|
||||||
import com.nflg.mobilebroken.repository.entity.Message;
|
|
||||||
import com.nflg.mobilebroken.repository.mapper.MessageMapper;
|
|
||||||
import com.nflg.mobilebroken.repository.service.IMessageService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author 曹鹏飞
|
|
||||||
* @since 2025-01-14
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements IMessageService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MessageVO> getNotReadMessage(Integer userId, Integer num) {
|
|
||||||
return baseMapper.getNotReadMessage(userId,num);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void search(Integer userId, String title, IPage<MessageVO> page) {
|
|
||||||
baseMapper.search(userId,title,page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?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.nflg.mobilebroken.repository.mapper.AdminUserPermissionMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
|
|
@ -4,16 +4,16 @@
|
||||||
|
|
||||||
<select id="getNotReadMessage" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
<select id="getNotReadMessage" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
||||||
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
||||||
FROM message m
|
FROM app_message m
|
||||||
INNER JOIN ticket t ON m.ticket_id=t.id
|
INNER JOIN ticket t ON m.ticket_id=t.id
|
||||||
INNER JOIN app_user u ON t.user_id=u.id
|
INNER JOIN app_user u ON t.user_id=u.id
|
||||||
WHERE m.is_read=0 AND m.user_id=#{userId}
|
WHERE m.is_read=0 AND m.user_id=#{userId}
|
||||||
ORDER BY m.id
|
ORDER BY m.id
|
||||||
LIMIT #{num}
|
LIMIT #{num}
|
||||||
</select>
|
</select>
|
||||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
<select id="search">
|
||||||
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
||||||
FROM message m
|
FROM app_message m
|
||||||
INNER JOIN ticket t ON m.ticket_id=t.id
|
INNER JOIN ticket t ON m.ticket_id=t.id
|
||||||
INNER JOIN app_user u ON t.user_id=u.id
|
INNER JOIN app_user u ON t.user_id=u.id
|
||||||
WHERE m.user_id=#{userId}
|
WHERE m.user_id=#{userId}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<?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.nflg.mobilebroken.repository.mapper.MessageMapper">
|
|
||||||
|
|
||||||
<select id="getNotReadMessage" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
|
||||||
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
|
||||||
FROM message m
|
|
||||||
INNER JOIN ticket t ON m.ticket_id=t.id
|
|
||||||
INNER JOIN app_user u ON t.user_id=u.id
|
|
||||||
WHERE m.is_read=0 AND m.user_id=#{userId}
|
|
||||||
ORDER BY m.id
|
|
||||||
LIMIT #{num}
|
|
||||||
</select>
|
|
||||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.MessageVO">
|
|
||||||
SELECT t.id AS 'ticketId',t.`no` AS 'ticketNo',t.title AS 'ticketTitle',m.content,m.create_time AS 'createTime',u.`name` AS 'ticketCreateBy',t.create_time AS 'ticketCreateTime',t.handle AS 'ticketHandleBy',m.is_read AS 'isRead'
|
|
||||||
FROM message m
|
|
||||||
INNER JOIN ticket t ON m.ticket_id=t.id
|
|
||||||
INNER JOIN app_user u ON t.user_id=u.id
|
|
||||||
WHERE m.user_id=#{userId}
|
|
||||||
<if test="title != null and title != ''">
|
|
||||||
AND (t.title LIKE CONCAT('%',#{title},'%') OR t.no LIKE CONCAT('%',#{title},'%'))
|
|
||||||
</if>
|
|
||||||
ORDER BY m.id
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Loading…
Reference in New Issue