Explorar o código

修改网站用户注册登录

anderx %!s(int64=7) %!d(string=hai) anos
pai
achega
556da08cdc

+ 4 - 4
src/main/java/com/goafanti/user/bo/InputUser.java

@@ -8,16 +8,16 @@ import com.goafanti.common.constant.ErrorConstants;
 
 public class InputUser {
 
-	@Size(min = 1, max = 11, message = "{" + ErrorConstants.MOBILE_SIZE_ERROR + "}")
+	@Size(min = 0, max = 11, message = "{" + ErrorConstants.MOBILE_SIZE_ERROR + "}")
 	private String	mobile;
 
-	@Size(min = 1, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
 	private String	unitName;
 
-	@Size(min = 1, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
 	private String	password;
 
-	@Size(min = 1, max = 32, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	@Size(min = 0, max = 32, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
 	private String	username;
 	@Max(value = 2, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")

+ 3 - 0
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -65,6 +65,9 @@ public class UserRegisterController extends BaseController {
 					UserFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
+		if (null != user.getUnitName()) {
+			res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "用户名不能为空"));
+		}
 		User u = userService.selectByMobieAndType(user.getMobile().trim(),user.getType());
 		if (null != u) {
 			res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "用户已存在"));