结组作业02
任务看板
我负责部分后端的代码,主要是对数据库数据进行操作
实体类
1 package org.test.tongyuzhe.Pojo; 2 3 import com.baomidou.mybatisplus.annotation.IdType; 4 import com.baomidou.mybatisplus.annotation.TableId; 5 import java.io.Serializable; 6 import lombok.Data; 7 import lombok.EqualsAndHashCode; 8 import lombok.experimental.Accessors; 9 10 /** 11 * <p> 12 * 13 * </p> 14 * 15 * @author ${author} 16 * @since 2024-05-21 17 */ 18 @Data 19 @EqualsAndHashCode(callSuper = false) 20 @Accessors(chain = true) 21 public class Chat implements Serializable { 22 23 private static final long serialVersionUID=1L; 24 25 /** 26 * 问题id 27 */ 28 @TableId(value = "chat_id", type = IdType.AUTO) 29 private Integer chatId; 30 31 /** 32 * 用户id 33 */ 34 private Integer userId; 35 36 /** 37 * 问题 38 */ 39 private String request; 40 41 /** 42 * 回答 43 */ 44 private String response; 45 46 /** 47 * 回答时间 48 */ 49 private String time; 50 51 52 }
1 package org.test.tongyuzhe.Pojo; 2 3 import lombok.AllArgsConstructor; 4 import lombok.Data; 5 import lombok.NoArgsConstructor; 6 7 @Data 8 @NoArgsConstructor 9 @AllArgsConstructor 10 public class Result<T> { 11 private Integer code;//业务状态码 0-成功 1-失败 12 private String message;//提示信息 13 private T data;//响应数据 14 15 //快速返回操作成功响应结果(带响应数据) 16 public static <E> Result<E> success(E data) { 17 return new Result<>(0, "操作成功", data); 18 } 19 public static <E> Result<E> success(String message,E data) { 20 return new Result<>(0, message, data); 21 } 22 //快速返回操作成功响应结果 23 public static Result success() { 24 return new Result(0, "操作成功", null); 25 } 26 27 public static Result error(String message) { 28 return new Result(1, message, null); 29 } 30 31 }
1 package org.test.tongyuzhe.Pojo; 2 3 import lombok.AllArgsConstructor; 4 import lombok.Data; 5 import lombok.NoArgsConstructor; 6 7 @Data 8 @AllArgsConstructor 9 @NoArgsConstructor 10 11 public class User { 12 13 int userId; 14 String username; 15 String password; 16 int role; 17 int childId; 18 19 }