mirror of
https://github.com/BgaSol/sol-cloud
synced 2026-04-21 17:17:16 +00:00
refactor(message): update message envelope controller and service methods
This commit is contained in:
parent
835f68d88c
commit
c0e125d71c
2 changed files with 6 additions and 4 deletions
|
|
@ -10,7 +10,6 @@ import com.bgasol.model.system.message.entity.MessageEnvelopeEntity;
|
|||
import com.bgasol.model.system.message.entity.MessageEnvelopeStatusEnum;
|
||||
import com.bgasol.model.system.user.api.UserApi;
|
||||
import com.bgasol.model.system.user.entity.UserEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
|
@ -41,6 +40,7 @@ public class MessageEnvelopeService extends BaseService<MessageEnvelopeEntity<?>
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void findOtherTable(List<MessageEnvelopeEntity<?>> list) {
|
||||
Set<String> userIds = list.stream()
|
||||
.map(MessageEnvelopeEntity::getUserId)
|
||||
|
|
@ -82,7 +82,8 @@ public class MessageEnvelopeService extends BaseService<MessageEnvelopeEntity<?>
|
|||
}
|
||||
}
|
||||
|
||||
public void read(@Valid List<String> ids) {
|
||||
@Transactional
|
||||
public void toReadById(List<String> ids) {
|
||||
Set<String> idSet = new HashSet<>(ids);
|
||||
MessageEnvelopeEntity<?> messageEnvelopeEntity = new MessageEnvelopeEntity<>();
|
||||
messageEnvelopeEntity.setStatus(MessageEnvelopeStatusEnum.READ);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.bgasol.model.system.message.entity.MessageEnvelopeEntity;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -62,8 +63,8 @@ public class MessageEnvelopeController extends BaseController<
|
|||
@PostMapping("/read")
|
||||
@Operation(summary = "批量已读消息", operationId = "readMessageEnvelope")
|
||||
@SaCheckPermission(value = "messageEnvelope:read", orRole = "admin")
|
||||
public BaseVo<Void> read(@RequestBody @Valid List<String> ids) {
|
||||
messageEnvelopeService.read(ids);
|
||||
public BaseVo<Void> read(@RequestBody @Valid @NotEmpty(message = "ids列表不能为空") List<String> ids) {
|
||||
messageEnvelopeService.toReadById(ids);
|
||||
return BaseVo.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue