更新读取状态
This commit is contained in:
parent
03a993f5f8
commit
e3da9f0a66
@ -86,4 +86,14 @@ public class DoctornoticeController {
|
||||
BeanUtils.toBean(list, DoctornoticeRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/updateReadStatus")
|
||||
@Operation(summary = "更新医生通知读取状态")
|
||||
@Parameter(name = "userid", description = "用户编号", required = true)
|
||||
@Parameter(name = "readstatus", description = "读取状态", required = true)
|
||||
public CommonResult<Boolean> updateReadStatus(@RequestParam("userid") Integer userid,
|
||||
@RequestParam("readstatus") Integer readstatus) {
|
||||
doctornoticeService.updateReadStatus(userid, readstatus);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -39,4 +39,17 @@ public interface DoctornoticeMapper extends BaseMapperX<DoctornoticeDO> {
|
||||
.orderByDesc(DoctornoticeDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID更新读取状态
|
||||
*
|
||||
* @param userid 用户ID
|
||||
* @param readstatus 读取状态
|
||||
* @return 更新的记录数
|
||||
*/
|
||||
default int updateReadStatusByUserId(Integer userid, Integer readstatus) {
|
||||
return update(new DoctornoticeDO().setReadstatus(readstatus),
|
||||
new LambdaQueryWrapperX<DoctornoticeDO>()
|
||||
.eq(DoctornoticeDO::getUserid, userid));
|
||||
}
|
||||
|
||||
}
|
||||
@ -52,4 +52,12 @@ public interface DoctornoticeService {
|
||||
*/
|
||||
PageResult<DoctornoticeDO> getDoctornoticePage(DoctornoticePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 更新医生通知读取状态
|
||||
*
|
||||
* @param userid 用户编号
|
||||
* @param readstatus 读取状态
|
||||
*/
|
||||
void updateReadStatus(Integer userid, Integer readstatus);
|
||||
|
||||
}
|
||||
@ -71,4 +71,11 @@ public class DoctornoticeServiceImpl implements DoctornoticeService {
|
||||
return doctornoticeMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateReadStatus(Integer userid, Integer readstatus) {
|
||||
// 更新该用户所有未读通知的读取状态
|
||||
doctornoticeMapper.updateReadStatusByUserId(userid, readstatus);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user