This commit is contained in:
lxd 2025-06-17 17:20:46 +08:00
commit 0812471eec
8 changed files with 72 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -64,4 +64,10 @@ public class DoctornoticePageReqVO extends PageParam {
@Schema(description = "是否删除(0:未删除,1:已删除)")
private Integer isdeleted;
@Schema(description = "用户姓名")
private String username;
@Schema(description = "机构ID")
private Integer orgid;
}

View File

@ -76,4 +76,12 @@ public class DoctornoticeRespVO {
@ExcelProperty("是否删除(0:未删除,1:已删除)")
private Integer isdeleted;
@Schema(description = "用户姓名")
@ExcelProperty("用户姓名")
private String username;
@Schema(description = "机构ID")
@ExcelProperty("机构ID")
private Integer orgid;
}

View File

@ -68,4 +68,10 @@ public class DoctornoticeSaveReqVO {
@Schema(description = "是否删除(0:未删除,1:已删除)")
private Integer isdeleted;
@Schema(description = "用户姓名")
private String username;
@Schema(description = "机构ID")
private Integer orgid;
}

View File

@ -17,13 +17,11 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@TableName("tb_doctornotice")
@KeySequence("tb_doctornotice_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DoctornoticeDO extends BaseDO {
public class DoctornoticeDO {
/**
* 主键ID
*/
@ -104,5 +102,15 @@ public class DoctornoticeDO extends BaseDO {
*/
@TableField("isdeleted")
private Integer isdeleted;
/**
* 用户姓名
*/
@TableField("username")
private String username;
/**
* 机构ID
*/
@TableField("orgid")
private Integer orgid;
}

View File

@ -34,7 +34,22 @@ public interface DoctornoticeMapper extends BaseMapperX<DoctornoticeDO> {
.eqIfPresent(DoctornoticeDO::getCreateby, reqVO.getCreateby())
.eqIfPresent(DoctornoticeDO::getUpdateby, reqVO.getUpdateby())
.eqIfPresent(DoctornoticeDO::getIsdeleted, reqVO.getIsdeleted())
.eqIfPresent(DoctornoticeDO::getOrgid, reqVO.getOrgid())
.eqIfPresent(DoctornoticeDO::getUsername, reqVO.getUsername())
.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));
}
}

View File

@ -52,4 +52,12 @@ public interface DoctornoticeService {
*/
PageResult<DoctornoticeDO> getDoctornoticePage(DoctornoticePageReqVO pageReqVO);
/**
* 更新医生通知读取状态
*
* @param userid 用户编号
* @param readstatus 读取状态
*/
void updateReadStatus(Integer userid, Integer readstatus);
}

View File

@ -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);
}
}