Commit cb11fee3 authored by shangtx's avatar shangtx

fix: 校验信息

parent 307a5fac
...@@ -74,7 +74,7 @@ public class ServiceAddressController { ...@@ -74,7 +74,7 @@ public class ServiceAddressController {
@ApiOperation(value = "根据id删除服务地址") @ApiOperation(value = "根据id删除服务地址")
@DeleteMapping("delete/{id}") @DeleteMapping("delete/{id}")
public Result deleteById(@ApiParam(name = "id", value = "服务地址id") @PathVariable @Positive Long id, @CurrentUserId Long userId) { public Result deleteById(@ApiParam(name = "id", value = "服务地址id") @PathVariable @Positive Long id, @CurrentUserId Long userId) {
return serviceAddressService.delete(id, userId) == 1 ? success() : fail("删除失败"); return serviceAddressService.delete(id, userId) == 1 ? success("删除成功") : fail("删除失败");
} }
} }
...@@ -4,9 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,9 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@Data @Data
@ApiModel("保存服务地址请求模型") @ApiModel("保存服务地址请求模型")
...@@ -17,6 +15,7 @@ public class SaveServiceAddressDTO { ...@@ -17,6 +15,7 @@ public class SaveServiceAddressDTO {
*/ */
@ApiModelProperty(value = "姓名", required = true) @ApiModelProperty(value = "姓名", required = true)
@NotBlank(message = "请输入联系人") @NotBlank(message = "请输入联系人")
@Size(max = 18, message = "姓名不能长于18个字符")
private String name; private String name;
/** /**
...@@ -46,6 +45,7 @@ public class SaveServiceAddressDTO { ...@@ -46,6 +45,7 @@ public class SaveServiceAddressDTO {
*/ */
@ApiModelProperty(value = "地址", required = true) @ApiModelProperty(value = "地址", required = true)
@NotBlank(message = "请输入详细地址") @NotBlank(message = "请输入详细地址")
@Size(max = 72, message = "地址不能长于72个字符")
private String address; private String address;
// @ApiModelProperty(value = "是否默认收货地址", required = true) // @ApiModelProperty(value = "是否默认收货地址", required = true)
......
...@@ -7,6 +7,7 @@ import lombok.Data; ...@@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@Data @Data
@ApiModel("修改服务地址请求模型") @ApiModel("修改服务地址请求模型")
...@@ -21,6 +22,7 @@ public class UpdateServiceAddressDTO { ...@@ -21,6 +22,7 @@ public class UpdateServiceAddressDTO {
*/ */
@ApiModelProperty(value = "姓名", required = true) @ApiModelProperty(value = "姓名", required = true)
@NotBlank(message = "请输入联系人") @NotBlank(message = "请输入联系人")
@Size(max = 18, message = "姓名不能长于18个字符")
private String name; private String name;
/** /**
...@@ -50,6 +52,7 @@ public class UpdateServiceAddressDTO { ...@@ -50,6 +52,7 @@ public class UpdateServiceAddressDTO {
*/ */
@ApiModelProperty(value = "地址", required = true) @ApiModelProperty(value = "地址", required = true)
@NotBlank(message = "请输入详细地址") @NotBlank(message = "请输入详细地址")
@Size(max = 72, message = "地址不能长于72个字符")
private String address; private String address;
// @ApiModelProperty(value = "是否默认收货地址", required = true) // @ApiModelProperty(value = "是否默认收货地址", required = true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment