mirror of https://gitee.com/stylefeng/roses
【8.1.0】【message】更新获取个人信息列表
parent
9f8c94c4c9
commit
6161e8bd89
|
@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统消息控制器
|
||||
|
@ -30,18 +29,6 @@ public class SysMessageController {
|
|||
@Resource
|
||||
private SysMessageService sysMessageService;
|
||||
|
||||
/**
|
||||
* 添加系统消息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
@PostResource(name = "添加系统消息", path = "/sysMessage/add")
|
||||
public ResponseData<SysMessage> add(@RequestBody @Validated(SysMessageRequest.add.class) SysMessageRequest sysMessageRequest) {
|
||||
sysMessageService.add(sysMessageRequest);
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统消息
|
||||
*
|
||||
|
@ -49,32 +36,19 @@ public class SysMessageController {
|
|||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
@PostResource(name = "删除系统消息", path = "/sysMessage/delete")
|
||||
public ResponseData<?> delete(@RequestBody @Validated(SysMessageRequest.delete.class) SysMessageRequest sysMessageRequest) {
|
||||
public ResponseData<?> delete(@RequestBody @Validated(BaseRequest.detail.class) SysMessageRequest sysMessageRequest) {
|
||||
sysMessageService.del(sysMessageRequest);
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统消息
|
||||
* 设为已读消息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
* @since 2024-01-12 18:12
|
||||
*/
|
||||
@PostResource(name = "批量删除系统消息", path = "/sysMessage/batchDelete")
|
||||
public ResponseData<?> batchDelete(@RequestBody @Validated(BaseRequest.batchDelete.class) SysMessageRequest sysMessageRequest) {
|
||||
sysMessageService.batchDelete(sysMessageRequest);
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑系统消息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
@PostResource(name = "编辑系统消息", path = "/sysMessage/edit")
|
||||
public ResponseData<?> edit(@RequestBody @Validated(SysMessageRequest.edit.class) SysMessageRequest sysMessageRequest) {
|
||||
sysMessageService.edit(sysMessageRequest);
|
||||
@PostResource(name = "设为已读消息", path = "/sysMessage/setRead")
|
||||
public ResponseData<?> setRead(@RequestBody @Validated(BaseRequest.detail.class) SysMessageRequest sysMessageRequest) {
|
||||
return new SuccessResponseData<>();
|
||||
}
|
||||
|
||||
|
@ -90,23 +64,12 @@ public class SysMessageController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取系统消息列表
|
||||
* 获取个人系统消息列表(带分页)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
@GetResource(name = "获取系统消息列表", path = "/sysMessage/list")
|
||||
public ResponseData<List<SysMessage>> list(SysMessageRequest sysMessageRequest) {
|
||||
return new SuccessResponseData<>(sysMessageService.findList(sysMessageRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统消息列表(带分页)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
@GetResource(name = "获取系统消息列表(带分页)", path = "/sysMessage/page")
|
||||
@GetResource(name = "获取个人系统消息列表(带分页)", path = "/sysMessage/page")
|
||||
public ResponseData<PageResult<SysMessage>> page(SysMessageRequest sysMessageRequest) {
|
||||
return new SuccessResponseData<>(sysMessageService.findPage(sysMessageRequest));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SysMessageRequest extends BaseRequest {
|
|||
* 消息发送时间
|
||||
*/
|
||||
@ChineseDescription("消息发送时间")
|
||||
private String messageSendTime;
|
||||
private String messageSendTime;
|
||||
|
||||
/**
|
||||
* 关联业务id
|
||||
|
@ -96,26 +96,6 @@ public class SysMessageRequest extends BaseRequest {
|
|||
@ChineseDescription("阅读状态:0-未读,1-已读")
|
||||
private Integer readFlag;
|
||||
|
||||
/**
|
||||
* 乐观锁
|
||||
*/
|
||||
@ChineseDescription("乐观锁")
|
||||
private Long versionFlag;
|
||||
|
||||
/**
|
||||
* 是否删除:Y-被删除,N-未删除
|
||||
*/
|
||||
@NotBlank(message = "是否删除:Y-被删除,N-未删除不能为空", groups = {add.class, edit.class})
|
||||
@ChineseDescription("是否删除:Y-被删除,N-未删除")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户号
|
||||
*/
|
||||
@ChineseDescription("租户号")
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除用的id集合
|
||||
*/
|
||||
|
|
|
@ -5,8 +5,6 @@ import cn.stylefeng.roses.kernel.sys.modular.message.entity.SysMessage;
|
|||
import cn.stylefeng.roses.kernel.sys.modular.message.pojo.request.SysMessageRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统消息服务类
|
||||
*
|
||||
|
@ -15,15 +13,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysMessageService extends IService<SysMessage> {
|
||||
|
||||
/**
|
||||
* 新增系统消息
|
||||
*
|
||||
* @param sysMessageRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
void add(SysMessageRequest sysMessageRequest);
|
||||
|
||||
/**
|
||||
* 删除系统消息
|
||||
*
|
||||
|
@ -33,24 +22,6 @@ public interface SysMessageService extends IService<SysMessage> {
|
|||
*/
|
||||
void del(SysMessageRequest sysMessageRequest);
|
||||
|
||||
/**
|
||||
* 批量删除系统消息
|
||||
*
|
||||
* @param sysMessageRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
void batchDelete(SysMessageRequest sysMessageRequest);
|
||||
|
||||
/**
|
||||
* 编辑系统消息
|
||||
*
|
||||
* @param sysMessageRequest 请求参数
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
void edit(SysMessageRequest sysMessageRequest);
|
||||
|
||||
/**
|
||||
* 查询详情系统消息
|
||||
*
|
||||
|
@ -60,20 +31,10 @@ public interface SysMessageService extends IService<SysMessage> {
|
|||
*/
|
||||
SysMessage detail(SysMessageRequest sysMessageRequest);
|
||||
|
||||
/**
|
||||
* 获取系统消息列表
|
||||
*
|
||||
* @param sysMessageRequest 请求参数
|
||||
* @return List<SysMessage> 返回结果
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
*/
|
||||
List<SysMessage> findList(SysMessageRequest sysMessageRequest);
|
||||
|
||||
/**
|
||||
* 获取系统消息分页列表
|
||||
*
|
||||
* @param sysMessageRequest 请求参数
|
||||
* @param sysMessageRequest 请求参数
|
||||
* @return PageResult<SysMessage> 返回结果
|
||||
* @author fengshuonan
|
||||
* @since 2024/01/12 17:31
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package cn.stylefeng.roses.kernel.sys.modular.message.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
|
@ -15,9 +15,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统消息业务实现层
|
||||
|
@ -28,32 +25,12 @@ import java.util.List;
|
|||
@Service
|
||||
public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMessage> implements SysMessageService {
|
||||
|
||||
@Override
|
||||
public void add(SysMessageRequest sysMessageRequest) {
|
||||
SysMessage sysMessage = new SysMessage();
|
||||
BeanUtil.copyProperties(sysMessageRequest, sysMessage);
|
||||
this.save(sysMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(SysMessageRequest sysMessageRequest) {
|
||||
SysMessage sysMessage = this.querySysMessage(sysMessageRequest);
|
||||
this.removeById(sysMessage.getMessageId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchDelete(SysMessageRequest sysMessageRequest) {
|
||||
this.removeByIds(sysMessageRequest.getBatchDeleteIdList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SysMessageRequest sysMessageRequest) {
|
||||
SysMessage sysMessage = this.querySysMessage(sysMessageRequest);
|
||||
BeanUtil.copyProperties(sysMessageRequest, sysMessage);
|
||||
this.updateById(sysMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysMessage detail(SysMessageRequest sysMessageRequest) {
|
||||
return this.querySysMessage(sysMessageRequest);
|
||||
|
@ -62,16 +39,14 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||
@Override
|
||||
public PageResult<SysMessage> findPage(SysMessageRequest sysMessageRequest) {
|
||||
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(sysMessageRequest);
|
||||
|
||||
// 查询关键字段
|
||||
wrapper.select(SysMessage::getMessageId, SysMessage::getMessageTitle, SysMessage::getPriorityLevel, SysMessage::getMessageSendTime);
|
||||
|
||||
Page<SysMessage> pageList = this.page(PageFactory.defaultPage(), wrapper);
|
||||
return PageResultFactory.createPageResult(pageList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMessage> findList(SysMessageRequest sysMessageRequest) {
|
||||
LambdaQueryWrapper<SysMessage> wrapper = this.createWrapper(sysMessageRequest);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*
|
||||
|
@ -95,37 +70,23 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||
private LambdaQueryWrapper<SysMessage> createWrapper(SysMessageRequest sysMessageRequest) {
|
||||
LambdaQueryWrapper<SysMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Long messageId = sysMessageRequest.getMessageId();
|
||||
Long receiveUserId = sysMessageRequest.getReceiveUserId();
|
||||
Long sendUserId = sysMessageRequest.getSendUserId();
|
||||
String messageTitle = sysMessageRequest.getMessageTitle();
|
||||
String messageContent = sysMessageRequest.getMessageContent();
|
||||
String messageType = sysMessageRequest.getMessageType();
|
||||
String messageUrl = sysMessageRequest.getMessageUrl();
|
||||
String priorityLevel = sysMessageRequest.getPriorityLevel();
|
||||
String messageSendTime = sysMessageRequest.getMessageSendTime();
|
||||
String businessId = sysMessageRequest.getBusinessId();
|
||||
String businessType = sysMessageRequest.getBusinessType();
|
||||
Integer readFlag = sysMessageRequest.getReadFlag();
|
||||
Long versionFlag = sysMessageRequest.getVersionFlag();
|
||||
String delFlag = sysMessageRequest.getDelFlag();
|
||||
Long tenantId = sysMessageRequest.getTenantId();
|
||||
// 根据标题查询
|
||||
String searchText = sysMessageRequest.getSearchText();
|
||||
if (StrUtil.isNotBlank(searchText)) {
|
||||
queryWrapper.like(SysMessage::getMessageTitle, searchText);
|
||||
}
|
||||
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(messageId), SysMessage::getMessageId, messageId);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(receiveUserId), SysMessage::getReceiveUserId, receiveUserId);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(sendUserId), SysMessage::getSendUserId, sendUserId);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(messageTitle), SysMessage::getMessageTitle, messageTitle);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(messageContent), SysMessage::getMessageContent, messageContent);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(messageType), SysMessage::getMessageType, messageType);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(messageUrl), SysMessage::getMessageUrl, messageUrl);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(priorityLevel), SysMessage::getPriorityLevel, priorityLevel);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(messageSendTime), SysMessage::getMessageSendTime, messageSendTime);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(businessId), SysMessage::getBusinessId, businessId);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(businessType), SysMessage::getBusinessType, businessType);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(readFlag), SysMessage::getReadFlag, readFlag);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(versionFlag), SysMessage::getVersionFlag, versionFlag);
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(delFlag), SysMessage::getDelFlag, delFlag);
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(tenantId), SysMessage::getTenantId, tenantId);
|
||||
// 根据优先级查询
|
||||
String priorityLevel = sysMessageRequest.getPriorityLevel();
|
||||
if (ObjectUtil.isNotEmpty(priorityLevel)) {
|
||||
queryWrapper.eq(SysMessage::getPriorityLevel, priorityLevel);
|
||||
}
|
||||
|
||||
// 根据已读状态
|
||||
Integer readFlag = sysMessageRequest.getReadFlag();
|
||||
if (ObjectUtil.isNotEmpty(readFlag)) {
|
||||
queryWrapper.eq(SysMessage::getReadFlag, readFlag);
|
||||
}
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue