diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java index 021a082..46b6ee9 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java @@ -2,6 +2,8 @@ package com.bonus.canteen.core.supermarket.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + import com.bonus.common.log.enums.OperaType; //import com.bonus.canteen.core.supermarket.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; @@ -89,7 +91,7 @@ public class SupermarketInfoController extends BaseController { //@RequiresPermissions("supermarket:info:add") @SysLog(title = "超市", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增超市") @PostMapping - public AjaxResult add(@RequestBody SupermarketInfo supermarketInfo) { + public AjaxResult add(@RequestBody @Valid SupermarketInfo supermarketInfo) { try { return toAjax(supermarketInfoService.insertSupermarketInfo(supermarketInfo)); } catch (Exception e) { @@ -105,7 +107,7 @@ public class SupermarketInfoController extends BaseController { //@RequiresPermissions("supermarket:info:edit") @SysLog(title = "超市", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改超市") @PostMapping("/edit") - public AjaxResult edit(@RequestBody SupermarketInfo supermarketInfo) { + public AjaxResult edit(@RequestBody @Valid SupermarketInfo supermarketInfo) { try { return toAjax(supermarketInfoService.updateSupermarketInfo(supermarketInfo)); } catch (Exception e) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketInfo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketInfo.java index 6dac6b4..cfb45c0 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketInfo.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketInfo.java @@ -7,6 +7,9 @@ import lombok.Data; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import javax.validation.constraints.Max; +import javax.validation.constraints.Size; + /** * 超市对象 supermarket_info * @@ -77,10 +80,12 @@ public class SupermarketInfo extends BaseEntity { /** 最少配送时间(分) */ @Excel(name = "最少配送时间", readConverterExp = "分=") + @Max(value = 9999L, message = "最少配送时间超过限制") private Long minDeliveryTime; /** 选择时间间隔(分) */ @Excel(name = "选择时间间隔", readConverterExp = "分=") + @Max(value = 9999L, message = "时间间隔超过限制") private Long selectTimeInterval; /** 配送费(元) */ @@ -98,6 +103,7 @@ public class SupermarketInfo extends BaseEntity { /** 退单限制时间(分) */ @Excel(name = "退单限制时间", readConverterExp = "分=") + @Max(value = 9999L, message = "退单限制时间超过限制") private Long refundLimitTime; /** 是否关联出入库(1是2否) */ @@ -108,6 +114,7 @@ public class SupermarketInfo extends BaseEntity { /** 流水号前缀 */ @Excel(name = "流水号前缀") @ApiModelProperty(value = "流水号前缀") + @Size(min = 0, max = 20, message = "流水号前缀长度不能超过20个字符") private String mealCode; /** 是否启用收款码(1是2否) */