forked from fdzcxy212206413/jty
parent
c202b4f240
commit
bdaec402ed
@ -0,0 +1,19 @@
|
|||||||
|
package jty.expressdistributionsystem.DTO;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendMessageDTO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package jty.expressdistributionsystem.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import jty.expressdistributionsystem.entity.Message;
|
||||||
|
|
||||||
|
public interface MessageMapper extends BaseMapper<Message> {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package jty.expressdistributionsystem.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jty.expressdistributionsystem.entity.Message;
|
||||||
|
|
||||||
|
public interface MessageService extends IService<Message> {
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package jty.expressdistributionsystem.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jty.expressdistributionsystem.entity.Message;
|
||||||
|
import jty.expressdistributionsystem.mapper.MessageMapper;
|
||||||
|
import jty.expressdistributionsystem.service.MessageService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package jty.expressdistributionsystem.utils;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jty.expressdistributionsystem.DTO.SendMessageDTO;
|
||||||
|
import jty.expressdistributionsystem.entity.Message;
|
||||||
|
import jty.expressdistributionsystem.service.MessageService;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class SendMessage {
|
||||||
|
@Resource
|
||||||
|
private static MessageService messageService;
|
||||||
|
|
||||||
|
public static void sendMessage(@NotNull SendMessageDTO sendMessageDTO) {
|
||||||
|
Long sendId = GetIdUtil.getId();
|
||||||
|
Message message = new Message();
|
||||||
|
message.setSendUserId(sendId);
|
||||||
|
message.setGetUserId(sendMessageDTO.getId());
|
||||||
|
message.setContent(sendMessageDTO.getContent());
|
||||||
|
messageService.save(message);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue