grs
yjxx 2 weeks ago
parent 59db863195
commit c97c4a15db

@ -4,8 +4,10 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
@Data
public class SendMessageDTO {
public class SendMessageDTO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
private Long Id;

@ -77,12 +77,6 @@ public class AdminController {
// 管理员发送消息
@PostMapping("/sendMessage")
public Result<String> sendMessage(@RequestBody @NotNull SendMessageDTO sendMessageDTO) {
LambdaQueryWrapper<User> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
userLambdaQueryWrapper.eq(User::getId, sendMessageDTO.getId());
User user = userService.getOne(userLambdaQueryWrapper);
if(user == null) {
return new Result<>(404, "用户不存在", "");
}
Message message = SendMessageUtil.sendMessage(sendMessageDTO);
messageService.save(message);
return new Result<>(200, "发送成功", "");

Loading…
Cancel
Save