修改预警通知相关接口
This commit is contained in:
parent
0c4818bec2
commit
1b68e6538e
@ -60,7 +60,11 @@ public class AlertMessageController {
|
||||
alertMessageService.deleteAlertMessage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getAlerMsgList")
|
||||
@Operation(summary = "获得预警信息")
|
||||
public CommonResult<List<AlertMessageDO>> getAlertMessageList(@RequestParam("deptid") Integer deptid) {
|
||||
return success(alertMessageService.getAlertMessageList(deptid));
|
||||
}
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预警信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
@ -16,14 +16,12 @@ public class AlertMessageSaveReqVO {
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "预警类型:1 SOS/ 2 分析预警", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "预警类型:1 SOS/ 2 分析预警不能为空")
|
||||
private Integer alerttype;
|
||||
|
||||
@Schema(description = "预警内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20700")
|
||||
@NotNull(message = "用户ID不能为空")
|
||||
private Integer userid;
|
||||
|
||||
@Schema(description = "状态:0-未读 1-已读", example = "1")
|
||||
|
||||
@ -29,6 +29,10 @@ public interface AlertMessageService {
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAlertMessage(@Valid AlertMessageSaveReqVO updateReqVO);
|
||||
/*
|
||||
* 根据机构ID查询所有未读预警信息
|
||||
* */
|
||||
List<AlertMessageDO> getAlertMessageList(Integer deptid);
|
||||
|
||||
/**
|
||||
* 删除预警信息
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package cn.iocoder.yudao.module.system.service.alertmessage;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.alertmessage.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.alertmessage.AlertMessageDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.alertmessage.AlertMessageMapper;
|
||||
@ -16,7 +15,6 @@ import cn.iocoder.yudao.module.system.dal.mysql.alertmessage.AlertMessageMapper;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 预警信息 Service 实现类
|
||||
@ -47,7 +45,18 @@ public class AlertMessageServiceImpl implements AlertMessageService {
|
||||
AlertMessageDO updateObj = BeanUtils.toBean(updateReqVO, AlertMessageDO.class);
|
||||
alertMessageMapper.updateById(updateObj);
|
||||
}
|
||||
@Override
|
||||
public List<AlertMessageDO> getAlertMessageList(Integer deptid) {
|
||||
// 创建 LambdaQueryWrapper 实例
|
||||
LambdaQueryWrapper<AlertMessageDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 添加查询条件
|
||||
queryWrapper.eq(AlertMessageDO::getOrgid, deptid)
|
||||
.eq(AlertMessageDO::getStatus, 0); // status = 0
|
||||
|
||||
// 执行查询
|
||||
return alertMessageMapper.selectList(queryWrapper);
|
||||
}
|
||||
@Override
|
||||
public void deleteAlertMessage(Integer id) {
|
||||
// 校验存在
|
||||
|
||||
Loading…
Reference in New Issue
Block a user