Commit 232359445d021fe8049fa6ce6f8291738101d04a
1 parent
5299d058
用户修改校验
Showing
6 changed files
with
10 additions
and
4 deletions
myapp-common/src/main/java/com/b2c/myapp/common/api/buyerInfo/input/BuyerInfoUpdateInput.java
... | ... | @@ -4,6 +4,7 @@ package com.b2c.myapp.common.api.buyerInfo.input; |
4 | 4 | import io.swagger.annotations.ApiModel; |
5 | 5 | import io.swagger.annotations.ApiModelProperty; |
6 | 6 | import io.swagger.annotations.ApiModelProperty; |
7 | +import org.hibernate.validator.constraints.NotBlank; | |
7 | 8 | |
8 | 9 | import java.io.Serializable; |
9 | 10 | import java.util.Date; |
... | ... | @@ -22,7 +23,8 @@ public class BuyerInfoUpdateInput implements Serializable{ |
22 | 23 | /** |
23 | 24 | * 手机号 |
24 | 25 | */ |
25 | - @ApiModelProperty(value = "手机号") | |
26 | + @ApiModelProperty(value = "手机号",required = true) | |
27 | + @NotBlank(message="手机号不能为空") | |
26 | 28 | private String mobilePhone; |
27 | 29 | /** |
28 | 30 | * 密码 |
... | ... |
myapp-common/src/main/java/com/b2c/myapp/common/api/sellerInfo/input/SellerInfoUpdateInput.java
... | ... | @@ -2,6 +2,7 @@ package com.b2c.myapp.common.api.sellerInfo.input; |
2 | 2 | |
3 | 3 | |
4 | 4 | import io.swagger.annotations.ApiModelProperty; |
5 | +import org.hibernate.validator.constraints.NotBlank; | |
5 | 6 | |
6 | 7 | import javax.validation.constraints.NotNull; |
7 | 8 | import java.io.Serializable; |
... | ... | @@ -26,7 +27,8 @@ public class SellerInfoUpdateInput implements Serializable{ |
26 | 27 | /** |
27 | 28 | * 手机号 |
28 | 29 | */ |
29 | - @ApiModelProperty(value = "手机号") | |
30 | + @ApiModelProperty(value = "手机号",required = true) | |
31 | + @NotBlank(message="手机号不能为空") | |
30 | 32 | private String mobilePhone; |
31 | 33 | /** |
32 | 34 | * 密码 |
... | ... |
myapp-web/src/main/java/com/b2c/myapp/api/BuyerInfoApi.java
... | ... | @@ -83,6 +83,7 @@ public class BuyerInfoApi extends BaseRestFulApi { |
83 | 83 | public BaseOutput<Boolean> modify(@ModelAttribute BuyerInfoUpdateInput buyerInfoUpdateInput){ |
84 | 84 | BaseOutput<Boolean> output = BaseOutput.success(); |
85 | 85 | try { |
86 | + BeanValidator.validator(buyerInfoUpdateInput); | |
86 | 87 | Boolean result = buyerInfoService.update(BeanConver.copeBean(buyerInfoUpdateInput,BuyerInfo.class))>0; |
87 | 88 | output.setData(result); |
88 | 89 | } catch (Exception e) { |
... | ... |
myapp-web/src/main/java/com/b2c/myapp/api/SellerInfoApi.java
... | ... | @@ -83,6 +83,7 @@ public class SellerInfoApi extends BaseRestFulApi { |
83 | 83 | public BaseOutput<Boolean> modify(@ModelAttribute SellerInfoUpdateInput sellerInfoUpdateInput){ |
84 | 84 | BaseOutput<Boolean> output = BaseOutput.success(); |
85 | 85 | try { |
86 | + BeanValidator.validator(sellerInfoUpdateInput); | |
86 | 87 | Boolean result = sellerInfoService.update(BeanConver.copeBean(sellerInfoUpdateInput,SellerInfo.class))>0; |
87 | 88 | output.setData(result); |
88 | 89 | } catch (Exception e) { |
... | ... |
myapp-web/src/main/resources/mybatis/BuyerInfoMapper.xml
myapp-web/src/main/resources/mybatis/SellerInfoMapper.xml