From 4db2a9df4bf2e1e5267d09e3eca3ff5ec354bde2 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Fri, 12 May 2023 15:03:14 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3InsertGroup,UpdateGroup=E5=8C=BA=E5=88=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=92=8C=E4=BF=AE=E6=94=B9=EF=BC=8CController?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=A2=9E=E4=B8=8E=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/config/valid/InsertGroup.java | 5 +++++ .../src/main/java/org/jeecg/config/valid/UpdateGroup.java | 5 +++++ .../system/controller/GardsDetectorsController.java | 6 ++++-- .../system/controller/GardsNuclearfacilityController.java | 6 ++++-- .../system/controller/GardsSelfbuiltController.java | 6 ++++-- .../system/controller/GardsStationsController.java | 6 ++++-- .../org/jeecg/modules/system/entity/GardsDetectors.java | 8 +++++++- .../jeecg/modules/system/entity/GardsNuclearfacility.java | 8 +++++++- .../modules/system/entity/GardsSelfbuiltStations.java | 8 +++++++- .../org/jeecg/modules/system/entity/GardsStations.java | 8 +++++++- 10 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java new file mode 100644 index 00000000..fa9b979b --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java @@ -0,0 +1,5 @@ +package org.jeecg.config.valid; + +public interface InsertGroup { + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java new file mode 100644 index 00000000..b6436d48 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java @@ -0,0 +1,5 @@ +package org.jeecg.config.valid; + +public interface UpdateGroup { + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java index 2cf8d3f6..8526be5c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java @@ -5,6 +5,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.jeecg.modules.system.entity.GardsDetectors; import org.jeecg.modules.system.service.IGardsDetectorsService; import org.springframework.beans.factory.annotation.Autowired; @@ -35,14 +37,14 @@ public class GardsDetectorsController { @PostMapping("create") @ApiOperation(value = "新增监测器信息", notes = "新增监测器信息") - public Result create(@RequestBody @Validated GardsDetectors gardsDetectors){ + public Result create(@RequestBody @Validated(value = InsertGroup.class) GardsDetectors gardsDetectors){ Result result = gardsDetectorsService.create(gardsDetectors); return result; } @PutMapping("update") @ApiOperation(value = "修改监测器信息", notes = "修改监测器信息") - public Result update(@RequestBody @Validated GardsDetectors gardsDetectors){ + public Result update(@RequestBody @Validated(value = UpdateGroup.class) GardsDetectors gardsDetectors){ Result result = gardsDetectorsService.update(gardsDetectors); return result; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsNuclearfacilityController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsNuclearfacilityController.java index 9dac78fb..99a10013 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsNuclearfacilityController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsNuclearfacilityController.java @@ -5,6 +5,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.jeecg.modules.system.entity.GardsNuclearfacility; import org.jeecg.modules.system.service.IGardsNuclearfacilityService; import org.springframework.beans.factory.annotation.Autowired; @@ -35,14 +37,14 @@ public class GardsNuclearfacilityController { @PostMapping("create") @ApiOperation(value = "新增核设施信息", notes = "新增核设施信息") - public Result create(@RequestBody @Validated GardsNuclearfacility gardsNuclearfacility){ + public Result create(@RequestBody @Validated(value = InsertGroup.class) GardsNuclearfacility gardsNuclearfacility){ Result result = gardsNuclearfacilityService.create(gardsNuclearfacility); return result; } @PutMapping("update") @ApiOperation(value = "修改核设施信息", notes = "修改核设施信息") - public Result update(@RequestBody @Validated GardsNuclearfacility gardsNuclearfacility){ + public Result update(@RequestBody @Validated(value = UpdateGroup.class) GardsNuclearfacility gardsNuclearfacility){ Result result = gardsNuclearfacilityService.update(gardsNuclearfacility); return result; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSelfbuiltController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSelfbuiltController.java index 7a7d040d..28be7630 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSelfbuiltController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSelfbuiltController.java @@ -5,6 +5,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.jeecg.modules.system.entity.GardsSelfbuiltStations; import org.jeecg.modules.system.service.IGardsSelfbuiltService; import org.springframework.beans.factory.annotation.Autowired; @@ -35,14 +37,14 @@ public class GardsSelfbuiltController { @PostMapping("create") @ApiOperation(value = "新增自建台站信息", notes = "新增自建台站信息") - public Result create(@RequestBody @Validated GardsSelfbuiltStations gardsSelfbuiltStations){ + public Result create(@RequestBody @Validated(value = InsertGroup.class) GardsSelfbuiltStations gardsSelfbuiltStations){ Result result = gardsSelfbuiltService.create(gardsSelfbuiltStations); return result; } @PutMapping("update") @ApiOperation(value = "修改自建台站信息", notes = "修改自建台站信息") - public Result update(@RequestBody @Validated GardsSelfbuiltStations gardsSelfbuiltStations){ + public Result update(@RequestBody @Validated(value = UpdateGroup.class) GardsSelfbuiltStations gardsSelfbuiltStations){ Result result = gardsSelfbuiltService.update(gardsSelfbuiltStations); return result; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsStationsController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsStationsController.java index c66209b4..40399c82 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsStationsController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsStationsController.java @@ -5,6 +5,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.jeecg.modules.system.entity.GardsStations; import org.jeecg.modules.system.service.IGardsStationsService; import org.springframework.beans.factory.annotation.Autowired; @@ -49,7 +51,7 @@ public class GardsStationsController { */ @PostMapping("create") @ApiOperation(value = "新增台站管理信息", notes = "新增台站管理信息") - public Result create(@RequestBody @Validated GardsStations gardsStations){ + public Result create(@RequestBody @Validated(value = InsertGroup.class) GardsStations gardsStations){ Result result = gardsStationsService.create(gardsStations); return result; } @@ -59,7 +61,7 @@ public class GardsStationsController { */ @PutMapping("update") @ApiOperation(value = "修改台站管理信息", notes = "修改台站管理信息") - public Result update(@RequestBody @Validated GardsStations gardsStations){ + public Result update(@RequestBody @Validated(value = UpdateGroup.class) GardsStations gardsStations){ Result result = gardsStationsService.update(gardsStations); return result; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java index 9615dc49..883cd839 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java @@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; @@ -15,10 +19,12 @@ import java.util.Date; public class GardsDetectors implements Serializable { @TableField(value = "DETECTOR_ID") + @Null(message = "必须为空", groups = InsertGroup.class) + @NotNull(message = "不能为空", groups = UpdateGroup.class) private Integer detectorId; @TableField(value = "DETECTOR_CODE") - @NotBlank(message = "不能为空") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private String detectorCode; @TableField(value = "LON") diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java index 9eb4ccca..29243f94 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java @@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; @@ -15,10 +19,12 @@ import java.util.Date; public class GardsNuclearfacility implements Serializable { @TableField(value = "FACILITY_ID") + @Null(message = "必须为空", groups = InsertGroup.class) + @NotNull(message = "不能为空", groups = UpdateGroup.class) private Integer facilityId; @TableField(value = "FACILITY_NAME") - @NotBlank(message = "不能为空") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private String facilityName; @TableField(value = "TYPE") diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSelfbuiltStations.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSelfbuiltStations.java index b10ca5a7..ea473c4e 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSelfbuiltStations.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSelfbuiltStations.java @@ -6,9 +6,13 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; @@ -17,10 +21,12 @@ import java.util.Date; public class GardsSelfbuiltStations implements Serializable { @TableId(value = "ID", type = IdType.ASSIGN_ID) + @Null(message = "必须为空", groups = InsertGroup.class) + @NotNull(message = "不能为空", groups = UpdateGroup.class) private Integer id; @TableField(value = "CODE") - @NotBlank(message = "不能为空") + @NotBlank(message = "不能为空" , groups = {InsertGroup.class, UpdateGroup.class}) private String code; @TableField(value = "NAME") diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java index 39865b27..a824a74b 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java @@ -5,9 +5,13 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.config.valid.UpdateGroup; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; import java.io.Serializable; import java.sql.Timestamp; import java.util.Date; @@ -17,10 +21,12 @@ import java.util.Date; public class GardsStations implements Serializable { @TableField(value = "STATION_ID") + @Null(message = "必须为空", groups = InsertGroup.class) + @NotNull(message = "不能为空", groups = UpdateGroup.class) private Integer stationId; @TableField(value = "STATION_CODE") - @NotBlank(message = "不能为空") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private String stationCode; @TableField(value = "COUNTRY_CODE")