feat:新增接口InsertGroup,UpdateGroup区分新增和修改,Controller增加新增与修改时的判断
This commit is contained in:
parent
1561b06977
commit
4db2a9df4b
|
@ -0,0 +1,5 @@
|
|||
package org.jeecg.config.valid;
|
||||
|
||||
public interface InsertGroup {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package org.jeecg.config.valid;
|
||||
|
||||
public interface UpdateGroup {
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user