Browse Source

# 接口批量已读

zhongwei
haungxing 2 years ago
parent
commit
3206464a2d
  1. 5
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

5
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -16,6 +16,7 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -67,7 +68,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/readMessage/{id}") @GetMapping("/readMessage/{id}")
@ApiOperation("读取消息") @ApiOperation("读取消息")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") Long id) { public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") String id) {
MessagePushRecordEntity record = messagePushRecordService.getById(id); MessagePushRecordEntity record = messagePushRecordService.getById(id);
if(!record.getPusher().equals(AuthUtil.getUserId())) { if(!record.getPusher().equals(AuthUtil.getUserId())) {
return R.fail("当前登录人不是消息推送人,修改状态失败"); return R.fail("当前登录人不是消息推送人,修改状态失败");
@ -75,7 +76,7 @@ public class MessagePushRecordController extends BladeController {
LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate() LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM)
.set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now()) .set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now())
.eq(MessagePushRecordEntity::getId, id); .in(MessagePushRecordEntity::getId, Func.toLongList(",",id));
return R.status(messagePushRecordService.update(eq)); return R.status(messagePushRecordService.update(eq));
} }

Loading…
Cancel
Save