Reference blog: https://www.cnblogs.com/quan-coder/p/8387040.html
A: install the plug-in development tools:
Eclipse:
Download: https://projectlombok.org/download
Lombok.jar the downloaded file into eclipse installation path, the jar package is a jar file lombok plug, as shown below
Eclipse.ini then open the file, add the following:
-javaagent: lombok.jar
-Xbootclasspath/a:lombok.jar
Restart eclipse
IDEA:
You can install plug-ins online lombok
settings -> plugins -> input in the search box lombok -> install
II: in pom.xml introduced dependence
|
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional> true </optional>
</dependency>
|
Then you can properly developed, the use of @Data lombok notes, you can simplify the Java code that can help us to automatically generate a set, get, toString () method
Create a java class, the final results are as follows:
package io.renren.modules.sys.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonProperty; import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.UpdateGroup; import lombok.Data; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; Import java.util.Date; Import java.util.List; / ** * User * * / @Data @tablename ( "sys_user" ) public class SysUserEntity the implements the Serializable { Private static Final Long serialVersionUID = 1L ; / ** * user ID * / @TableId Private Long the userId; / ** * username * / @NotBlank (Message = "user name can not empty", = {Groups. the AddGroup class ., UpdateGroup class }) PrivateUsername String; / ** * Password * / @NotBlank (Message = "password is not blank", the AddGroup = Groups. Class ) @JsonProperty (Access = JsonProperty.Access.WRITE_ONLY) Private String password; / ** * Salt * / Private String Salt; / ** * mailbox * / @NotBlank (Message = "E-mail can not be empty", groups = {. the AddGroup class ., UpdateGroup class }) @email (Message = "mailbox format is incorrect", groups = { the AddGroup. class , UpdateGroup. class }) PrivateEmail String; / ** * phone number * / Private String Mobile; / ** * Status 0: Disable 1: Normal * / Private Integer Status; / ** * Role ID list * / @TableField (exist = false ) Private List <Long> roleIdList; / ** * creation time * / Private a Date createTime; / ** * sector ID * / @NotNull (Message = "sector not empty", the AddGroup Groups = {. class , UpdateGroup. class }) Private deptId Long; / ** * Department Name * / @TableField (exist = false ) Private String the DeptName; }