package com.xolo.core.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@TableName("kpi_user") //此处对应于数据库表名
@NoArgsConstructor
@AllArgsConstructor
@Data //引用这个使得实体中字段外界可获取
@ApiModel("管理员用户信息") //实体名称
public class User implements Serializable {
@TableField("id") //对应于表中字段
@ApiModelProperty("用户id")
@TableId(value = "id",type = IdType.AUTO) //进行插入操作必须设为自增类型
private Integer id;
@TableField("role_id")
@ApiModelProperty("角色id,更新用户角色时传入")
private Integer roleId;
@TableField("group_id")
@ApiModelProperty("组id,更新用户组时传入")
private Integer groupId;
@TableField("username")
@ApiModelProperty("用户名")
private String username;
@TableField("mobile")
@ApiModelProperty("管理员用户手机号")
private String mobile;
@TableField("password")
@ApiModelProperty(hidden = true) //可使密码隐藏
private String password;
@TableField("real_name")
@ApiModelProperty("真实姓名")
private String realName;
@TableField("avatar")
@ApiModelProperty("头像url")
private String avatar;
@TableField("is_delete")
@ApiModelProperty(hidden = true)
private Integer isDelete;
@TableField("create_time")
@ApiModelProperty(hidden = true)
private Date createTime;
@TableField("update_time")
@ApiModelProperty(hidden = true)
private Date updateTime;
@ApiModelProperty("角色名称")
@TableField(exist = false) //另增不在数据库表内的字段
private String roleName;
public String getUsername() {
return username;
}
}
标签:TableField,Java,String,创建,private,ApiModelProperty,注意事项,import,id
来源: https://www.cnblogs.com/bobbycheng/p/11843083.html