package com.duxiang.backgroundmanagement.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; 1.mybatis import javax.persistence.*; @Data @AllArgsConstructor @NoArgsConstructor @Table(name="m_chat") /** * 多人聊天实体 */ public class Chat { /** 自动编号 */ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "chat_id") private Integer chat_id; @Column(name = "username") private String username; @Column(name = "agree") private String agree; @Column(name = "content") private String content; @Column(name = "avatar_url") private String avatar_url; @Column(name = "time") private String time; /** 类型 */ @Column(name = "type") private String type; } 2.mybatis-plus package du.xd.xiang.demo.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; @Data @AllArgsConstructor @NoArgsConstructor @TableName("d_user") //Serializable具备序列化和反序列化 public class User implements Serializable { @TableId(type = IdType.AUTO) @TableField("user_id") private Integer userId; @TableField("user_name") private String userName; @TableField("pass_word") private String passWord; @TableField("nick_name") private String nickName; @TableField("salt") private String salt; @TableField("verCode") private String verCode; @TableField("avatar_url") private String avatarUrl; @TableField("md5") private String md5; }
标签:TableField,String,映射,Column,private,plus,mybatis,import,name From: https://www.cnblogs.com/stevenduxiang/p/18194283