From 5461963d5f6039dbaa26cba15eeb9de08340b431 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 18 Apr 2023 14:35:14 +0800 Subject: [PATCH] build: validation --- backend/framework/domain/pom.xml | 5 +++++ .../domain/src/main/java/io/metersphere/domain/User.java | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/framework/domain/pom.xml b/backend/framework/domain/pom.xml index b275d34324..02fc2afe53 100644 --- a/backend/framework/domain/pom.xml +++ b/backend/framework/domain/pom.xml @@ -19,6 +19,11 @@ ${mybatis-plus-starter.version} provided + + org.springframework.boot + spring-boot-starter-validation + provided + diff --git a/backend/framework/domain/src/main/java/io/metersphere/domain/User.java b/backend/framework/domain/src/main/java/io/metersphere/domain/User.java index e0ba975e20..ee71a72ddd 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/domain/User.java +++ b/backend/framework/domain/src/main/java/io/metersphere/domain/User.java @@ -1,6 +1,7 @@ package io.metersphere.domain; import com.baomidou.mybatisplus.annotation.TableName; +import jakarta.validation.constraints.NotBlank; import lombok.Data; import java.io.Serializable; @@ -8,8 +9,9 @@ import java.io.Serializable; @Data @TableName(value = "user", autoResultMap = true) public class User implements Serializable { + @NotBlank(message = "id不能为空") private String id; - + @NotBlank(message = "用户名不能为空") private String name; private String email;