Commit 232359445d021fe8049fa6ce6f8291738101d04a

Authored by jiangchengyong
1 parent 5299d058

用户修改校验

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
... ... @@ -189,7 +189,7 @@
189 189 <update id="update" parameterType="com.b2c.myapp.domain.BuyerInfo" >
190 190 UPDATE t_buyer_info
191 191 <include refid="UPDATE_COLUMN_SET"/>
192   - WHERE id = #{id}
  192 + WHERE mobile_phone = #{mobilePhone}
193 193 </update>
194 194  
195 195  
... ...
myapp-web/src/main/resources/mybatis/SellerInfoMapper.xml
... ... @@ -156,7 +156,7 @@
156 156 <update id="update" parameterType="com.b2c.myapp.domain.SellerInfo" >
157 157 UPDATE t_seller_info
158 158 <include refid="UPDATE_COLUMN_SET"/>
159   - WHERE id = #{id}
  159 + WHERE mobile_phone = #{mobilePhone}
160 160 </update>
161 161  
162 162  
... ...