【线路管理非空验证BUG】

This commit is contained in:
weizhihong 2023-06-09 14:32:29 +08:00
parent 55cbaf5aef
commit 4e84442313
3 changed files with 5 additions and 6 deletions

View File

@ -13,14 +13,12 @@ public class PublishedGIDto {
@Schema(description = "发布图形界面名称")
private String name;
@NotNull
@Schema(description = "关联的线路号")
@NotBlank(message = "关联线路不能为空", groups = { Publish.class })
@NotNull(message = "关联线路不能为空", groups = { Publish.class })
private Integer lineId;
@NotNull
@Schema(description = "草稿数据主键")
@NotBlank(message = "请选择草稿数据", groups = { Publish.class })
@NotNull(message = "请选择草稿数据", groups = { Publish.class })
private Integer draftingId;
public interface Publish {

View File

@ -7,6 +7,7 @@ import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@ -35,7 +36,7 @@ public class LineInfo {
private String name;
@Schema(description = "线路号")
@NotBlank(message = "线路号不能为空", groups = {Creation.class, SaveData.class})
@NotNull(message = "线路号不能为空", groups = {Creation.class, SaveData.class})
private Integer lineId;
@Schema(description = "线路配置")

View File

@ -38,7 +38,7 @@ public class LineInfoService {
wrapper.eq(LineInfo::getLineId, lineInfo.getLineId());
long count = lineInfoRepository.count(wrapper);
if (count > 0) {
throw BusinessExceptionAssertEnum.DATA_ALREADY_EXISTS.exception("线路名称已存在");
throw BusinessExceptionAssertEnum.DATA_ALREADY_EXISTS.exception(String.format("线路【%s】已存在", lineInfo.getLineId()));
}
lineInfo.setCreatedAt(LocalDateTime.now());
lineInfo.setUpdateAt(LocalDateTime.now());