build: validation

This commit is contained in:
CaptainB 2023-04-18 14:35:14 +08:00
parent ec4bfe6515
commit 5461963d5f
2 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,11 @@
<version>${mybatis-plus-starter.version}</version> <version>${mybatis-plus-starter.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,6 +1,7 @@
package io.metersphere.domain; package io.metersphere.domain;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -8,8 +9,9 @@ import java.io.Serializable;
@Data @Data
@TableName(value = "user", autoResultMap = true) @TableName(value = "user", autoResultMap = true)
public class User implements Serializable { public class User implements Serializable {
@NotBlank(message = "id不能为空")
private String id; private String id;
@NotBlank(message = "用户名不能为空")
private String name; private String name;
private String email; private String email;