重构代码生成器 95%

v1.4.1
hiparker 4 years ago
parent 235ffba0f1
commit 00af5c6303

File diff suppressed because it is too large Load Diff

@ -1,5 +1,5 @@
超级管理员 -
system Bb123456
system Bb123456.
演示账户 -
demo Aa123456
demo Aa123456.

@ -59,7 +59,7 @@ public class TestUserModel extends ApiWrapper {
@ApiModelProperty(value = "年龄")
@ExcelProperty(value = "年龄", order = 3)
@ExcelInfo
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_NUMBER})
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_INTEGER})
@ValidationArgsLenMax(5)
private Integer age;

@ -47,7 +47,7 @@ public class SysAreaModel extends ApiWrapper {
@ApiModelProperty(value = "地域编号")
@ExcelProperty(value = "地域编号", order = 2)
@ExcelInfo
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_NUMBER})
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_INTEGER})
@ValidationArgsLenMax(40)
private String areaCode;

@ -78,7 +78,7 @@ public class DictDetailModel extends ApiWrapper {
@ApiModelProperty(value = "排序")
@ExcelProperty(value = "排序", order = 2)
@ExcelInfo
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_NUMBER})
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_INTEGER})
@ValidationArgsLenMax(10)
private Integer sortNo;

@ -43,6 +43,7 @@ public class UserAndOrgModel extends ApiWrapper {
@ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL,ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(32)
@ValidationArgsLenMin(5)
private String username;
/** 登录密码 */

@ -23,6 +23,7 @@ import lombok.EqualsAndHashCode;
import org.opsli.api.base.warpper.ApiWrapper;
import org.opsli.common.annotation.validation.ValidationArgs;
import org.opsli.common.annotation.validation.ValidationArgsLenMax;
import org.opsli.common.annotation.validation.ValidationArgsLenMin;
import org.opsli.common.enums.ValiArgsType;
import java.util.List;
@ -43,6 +44,7 @@ public class UserInfo extends ApiWrapper {
@ApiModelProperty(value = "登录账户")
@ValidationArgs({ValiArgsType.IS_NOT_NULL,ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(32)
@ValidationArgsLenMin(5)
private String username;
/** 真实姓名 */

@ -37,12 +37,12 @@ import org.opsli.plugins.excel.annotation.ExcelInfo;
@EqualsAndHashCode(callSuper = false)
public class UserModel extends ApiWrapper {
/** 登录账户 */
@ApiModelProperty(value = "登录账户")
@ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL,ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(32)
@ValidationArgsLenMin(5)
private String username;
/** 登录密码 */

@ -53,7 +53,7 @@ public class UserPassword implements Serializable {
/** 新密码 */
@ApiModelProperty(value = "新密码")
@ValidationArgs({ValiArgsType.IS_NOT_NULL})
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_SECURITY_PASSWORD})
@ValidationArgsLenMin(6)
@ValidationArgsLenMax(50)
private String newPassword;

@ -50,7 +50,7 @@ public class Test3Model extends ApiWrapper {
@ApiModelProperty(value = "年龄")
@ExcelProperty(value = "年龄", order = 2)
@ExcelInfo
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_NUMBER})
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_INTEGER})
@ValidationArgsLenMax(3)
private Integer age;

@ -26,20 +26,24 @@ public enum ValiArgsType {
/** 不能为空 */
IS_NOT_NULL,
/** 字母,数字和下划线 */
IS_GENERAL,
/** 数字 */
IS_NUMBER,
/** 整数 */
IS_INTEGER,
/** 小数浮点 */
IS_DECIMAL,
/** 质数(素数) */
IS_PRIMES,
/** 纯字母 */
IS_LETTER,
/** 大写 */
IS_UPPER_CASE,
/** 小写 */
IS_LOWER_CASE,
/** ip4 */
/** IP (兼容IPV4 + IPV6) */
IS_IP,
/** IP4 */
IS_IPV4,
/** IP6 */
IS_IPV6,
/** 金额 */
IS_MONEY,
/** 邮箱 */
@ -48,18 +52,22 @@ public enum ValiArgsType {
IS_MOBILE,
/** 18位身份证 */
IS_CITIZENID,
/** 邮编 */
IS_ZIPCODE,
/** URL */
IS_URL,
/** 汉字 */
IS_CHINESE,
/** 字母,数字和下划线 */
IS_GENERAL,
/** 汉字,字母,数字和下划线 */
IS_GENERAL_WITH_CHINESE,
/** 邮编 */
IS_ZIPCODE,
/** URL */
IS_URL,
/** MAC地址 */
IS_MAC,
/** 中国车牌 */
IS_PLATE_NUMBER,
/** 安全密码 */
IS_SECURITY_PASSWORD,
;
public static void main(String[] args) {

@ -0,0 +1,147 @@
/**
* Copyright 2020 OPSLI https://www.opsli.com
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.opsli.common.utils;
import cn.hutool.core.lang.SimpleCache;
import java.util.regex.Pattern;
/**
* :https://any86.github.io/any-rule/
*
* @author Looly
*/
public final class DefPatternPool {
/**
* 61111
* 6
*/
public final static Pattern SECURITY_PASSWORD = Pattern.compile("^\\S*(?=\\S{6,})(?=\\S*\\d)(?=\\S*[A-Z])(?=\\S*[a-z])(?=\\S*[!@#$%^&*?.])\\S*$");
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
* Pattern
*/
private static final SimpleCache<RegexWithFlag, Pattern> POOL = new SimpleCache<>();
/**
* Pattern{@link Pattern}
*
* @param regex
* @return {@link Pattern}
*/
public static Pattern get(String regex) {
return get(regex, 0);
}
/**
* Pattern{@link Pattern}
*
* @param regex
* @param flags {@link Pattern}
* @return {@link Pattern}
*/
public static Pattern get(String regex, int flags) {
final RegexWithFlag regexWithFlag = new RegexWithFlag(regex, flags);
Pattern pattern = POOL.get(regexWithFlag);
if (null == pattern) {
pattern = Pattern.compile(regex, flags);
POOL.put(regexWithFlag, pattern);
}
return pattern;
}
/**
*
*
* @param regex
* @param flags
* @return {@link Pattern}{@code null}
*/
public static Pattern remove(String regex, int flags) {
return POOL.remove(new RegexWithFlag(regex, flags));
}
/**
*
*/
public static void clear() {
POOL.clear();
}
// ---------------------------------------------------------------------------------------------------------------------------------
/**
*
*
* @author Looly
*/
private static class RegexWithFlag {
private final String regex;
private final int flag;
/**
*
*
* @param regex
* @param flag
*/
public RegexWithFlag(String regex, int flag) {
this.regex = regex;
this.flag = flag;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + flag;
result = prime * result + ((regex == null) ? 0 : regex.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
RegexWithFlag other = (RegexWithFlag) obj;
if (flag != other.flag) {
return false;
}
if (regex == null) {
return other.regex == null;
} else {
return regex.equals(other.regex);
}
}
}
// ==================
private DefPatternPool(){}
}

@ -30,42 +30,51 @@ public enum ValidationMsg implements BaseMsg {
/** 字母,数字和下划线 */
EXCEPTION_IS_GENERAL(9801,"不是字母,数字或下划线! "),
/** 数字 */
EXCEPTION_IS_NUMBER(9802,"不是! "),
EXCEPTION_IS_INTEGER(9802,"不是数! "),
/** 小数浮点 */
EXCEPTION_IS_DECIMAL(9803,"不是小数浮点! "),
/** 质数 */
EXCEPTION_IS_PRIMES(9804,"不是质数! "),
/** 纯字母 */
EXCEPTION_IS_LETTER(9804,"不是纯字母! "),
EXCEPTION_IS_LETTER(9805,"不是纯字母! "),
/** 大写 */
EXCEPTION_IS_UPPER_CASE(9805,"不是大写字母! "),
EXCEPTION_IS_UPPER_CASE(9806,"不是大写字母! "),
/** 小写 */
EXCEPTION_IS_LOWER_CASE(9806,"不是小写字母! "),
/** ip4 */
EXCEPTION_IS_IPV4(9807,"不是IPV4地址! "),
EXCEPTION_IS_LOWER_CASE(9807,"不是小写字母! "),
/** IP */
EXCEPTION_IS_IP(9808,"不是IP地址! "),
/** IP4 */
EXCEPTION_IS_IPV4(9809,"不是IPV4地址! "),
/** IP6 */
EXCEPTION_IS_IPV6(98010,"不是IPV6地址! "),
/** 金额 */
EXCEPTION_IS_MONEY(9808,"不是金额! "),
EXCEPTION_IS_MONEY(9811,"不是金额! "),
/** 邮箱 */
EXCEPTION_IS_EMAIL(9809,"不是邮箱! "),
EXCEPTION_IS_EMAIL(9812,"不是邮箱! "),
/** 手机号 */
EXCEPTION_IS_MOBILE(98010,"不是手机号! "),
EXCEPTION_IS_MOBILE(9813,"不是手机号! "),
/** 18位身份证 */
EXCEPTION_IS_CITIZENID(9811,"不是18位身份证! "),
/** 邮编 */
EXCEPTION_IS_ZIPCODE(9812,"不是邮编! "),
/** URL */
EXCEPTION_IS_URL(9813,"不是URL! "),
EXCEPTION_IS_CITIZENID(9814,"不是18位身份证! "),
/** 汉字 */
EXCEPTION_IS_CHINESE(9814,"不是汉字! "),
EXCEPTION_IS_CHINESE(9815,"不是汉字! "),
/** 汉字,字母,数字和下划线 */
EXCEPTION_IS_GENERAL_WITH_CHINESE(9815,"不是汉字,字母,数字和下划线! "),
EXCEPTION_IS_GENERAL_WITH_CHINESE(9816,"不是汉字,字母,数字和下划线! "),
/** 邮编 */
EXCEPTION_IS_ZIPCODE(9817,"不是邮编! "),
/** URL */
EXCEPTION_IS_URL(9818,"不是URL! "),
/** MAC地址 */
EXCEPTION_IS_MAC(9816,"不是MAC地址! "),
EXCEPTION_IS_MAC(9819,"不是MAC地址! "),
/** 中国车牌 */
EXCEPTION_IS_PLATE_NUMBER(9817,"不是中国车牌! "),
EXCEPTION_IS_PLATE_NUMBER(9820,"不是中国车牌! "),
/** 安全密码 */
EXCEPTION_IS_SECURITY_PASSWORD(9821,"至少包含大小写字母、数字、特殊字符且不少于6位"),
/** 超出最大长度 */
EXCEPTION_IS_MAX(9818,"超出最大长度! "),
EXCEPTION_IS_MAX(9830,"超出最大长度! "),
/** 小于最小长度 */
EXCEPTION_IS_MIN(9819,"小于最小长度! "),
EXCEPTION_IS_MIN(9831,"小于最小长度! "),
;

@ -17,10 +17,12 @@ package org.opsli.core.utils;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ReflectUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.opsli.common.utils.DefPatternPool;
import org.opsli.core.msg.ValidationMsg;
import org.opsli.api.wrapper.system.dict.DictModel;
import org.opsli.common.annotation.validation.ValidationArgs;
@ -97,220 +99,294 @@ public final class ValidationUtil {
// 循环验证
for (ValiArgsType type : types) {
try {
boolean validateRet;
switch (type) {
// 不能为空
case IS_NOT_NULL:
boolean notNull = Validator.isNotEmpty(fieldValue);
if(!notNull){
case IS_NOT_NULL: {
validateRet = Validator.isNotEmpty(fieldValue);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_NOT_NULL;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 字母,数字和下划线
case IS_GENERAL:
if(StringUtils.isEmpty(value)) {
case IS_GENERAL: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean general = Validator.isGeneral(value);
if(!general){
validateRet = Validator.isGeneral(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_GENERAL;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
// 数字
case IS_NUMBER:
if(StringUtils.isEmpty(value)){
}
// 整数
case IS_INTEGER: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean number = Validator.isNumber(value);
if(!number){
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_NUMBER;
validateRet = NumberUtil.isInteger(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_INTEGER;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
// 小数浮点
case IS_DECIMAL:
if(StringUtils.isEmpty(value)){
}
// 浮点数
case IS_DECIMAL: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean decimal = Validator.isMoney(value);
if(!decimal){
validateRet = NumberUtil.isDouble(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_DECIMAL;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 质数
case IS_PRIMES: {
if (StringUtils.isEmpty(value)) {
break;
}
// 先验证 是否是 整数, 再验证是否是 质数
validateRet = NumberUtil.isInteger(value) &&
NumberUtil.isPrimes(Convert.toInt(value));
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_PRIMES;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 纯字母
case IS_LETTER:
if(StringUtils.isEmpty(value)){
case IS_LETTER: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean letter = Validator.isLetter(value);
if(!letter){
validateRet = Validator.isLetter(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_LETTER;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 大写
case IS_UPPER_CASE:
if(StringUtils.isEmpty(value)){
case IS_UPPER_CASE: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean upperCase = Validator.isUpperCase(value);
if(!upperCase){
validateRet = Validator.isUpperCase(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_UPPER_CASE;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 小写
case IS_LOWER_CASE:
if(StringUtils.isEmpty(value)){
case IS_LOWER_CASE: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean lowerCase = Validator.isLowerCase(value);
if(!lowerCase){
validateRet = Validator.isLowerCase(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_LOWER_CASE;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// IP
case IS_IP: {
if (StringUtils.isEmpty(value)) {
break;
}
validateRet = Validator.isIpv4(value) || Validator.isIpv6(value) ;
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_IP;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// IPV4
case IS_IPV4:
if(StringUtils.isEmpty(value)){
case IS_IPV4: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean ipv4 = Validator.isIpv4(value);
if(!ipv4){
validateRet = Validator.isIpv4(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_IPV4;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
// 金额
case IS_MONEY:
}
// IPV6
case IS_IPV6: {
if(StringUtils.isEmpty(value)){
break;
}
boolean money = Validator.isMoney(value);
if(!money){
validateRet = Validator.isIpv6(value);
if(!validateRet){
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_IPV6;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 金额
case IS_MONEY: {
if (StringUtils.isEmpty(value)) {
break;
}
validateRet = Validator.isMoney(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_MONEY;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 邮箱
case IS_EMAIL:
if(StringUtils.isEmpty(value)){
case IS_EMAIL: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean email = Validator.isEmail(value);
if(!email){
validateRet = Validator.isEmail(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_EMAIL;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 手机号
case IS_MOBILE:
if(StringUtils.isEmpty(value)){
case IS_MOBILE: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean mobile = Validator.isMobile(value);
if(!mobile){
validateRet = Validator.isMobile(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_MOBILE;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 18位身份证
case IS_CITIZENID:
if(StringUtils.isEmpty(value)){
case IS_CITIZENID: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean citizenId = Validator.isCitizenId(value);
if(!citizenId){
validateRet = Validator.isCitizenId(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_CITIZENID;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 邮编
case IS_ZIPCODE:
if(StringUtils.isEmpty(value)){
case IS_ZIPCODE: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean zipCode = Validator.isZipCode(value);
if(!zipCode){
validateRet = Validator.isZipCode(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_ZIPCODE;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// URL
case IS_URL:
if(StringUtils.isEmpty(value)){
case IS_URL: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean url = Validator.isUrl(value);
if(!url){
validateRet = Validator.isUrl(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_URL;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 汉字
case IS_CHINESE:
if(StringUtils.isEmpty(value)){
case IS_CHINESE: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean chinese = Validator.isChinese(value);
if(!chinese){
validateRet = Validator.isChinese(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_CHINESE;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 汉字,字母,数字和下划线
case IS_GENERAL_WITH_CHINESE:
if(StringUtils.isEmpty(value)){
case IS_GENERAL_WITH_CHINESE: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean generalWithChinese = Validator.isGeneralWithChinese(value);
if(!generalWithChinese){
validateRet = Validator.isGeneralWithChinese(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_GENERAL_WITH_CHINESE;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// MAC地址
case IS_MAC:
if(StringUtils.isEmpty(value)){
case IS_MAC: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean mac = Validator.isMac(value);
if(!mac){
validateRet = Validator.isMac(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_MAC;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 中国车牌
case IS_PLATE_NUMBER:
if(StringUtils.isEmpty(value)){
case IS_PLATE_NUMBER: {
if (StringUtils.isEmpty(value)) {
break;
}
boolean plateNumber = Validator.isPlateNumber(value);
if(!plateNumber){
validateRet = Validator.isPlateNumber(value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_PLATE_NUMBER;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
// 安全密码
case IS_SECURITY_PASSWORD: {
if (StringUtils.isEmpty(value)) {
break;
}
validateRet = Validator.isMatchRegex(
DefPatternPool.SECURITY_PASSWORD, value);
if (!validateRet) {
ValidationMsg msg = ValidationMsg.EXCEPTION_IS_SECURITY_PASSWORD;
msg.setFieldName(fieldName);
throw new ServiceException(msg);
}
break;
}
default:
break;
}

@ -42,6 +42,8 @@ public enum VueCodeBuilder {
/** 实例对象 */
INSTANCE;
/** 验证方法前缀 */
private static final String VALIDATE_PREFIX = "validate_";
/** 虚拟根路径 */
private static final String BASE_API_PATH;
static {
@ -151,10 +153,10 @@ public enum VueCodeBuilder {
}
List<String> validateTypeList = new ArrayList<>(validateTypes.length);
for (String vali : validateTypeSet) {
for (String validate : validateTypeSet) {
validateTypeList.add(
HumpUtil.underlineToHump(
vali.toLowerCase()
VALIDATE_PREFIX + validate.toLowerCase()
)
);
}

@ -87,29 +87,12 @@
#end
import { formateDate } from "@/utils/format";
import { isNull } from "@/utils/validate";
import { #(validateTypes) getMsg} from "@/utils/valiargs";
import { #(validateTypes) } from "@/utils/validateRlue";
export default {
name: "#(data.model.tableName)ManagementEdit",
data() {
#for(columnList : formList)
#for(column : columnList)
#for(vali : valiDict[column.fieldName])
#if(vali != "isNotNull")
const validate_#(column.fieldName+'_'+vali) = (rule, value, callback) => {
if (!#(vali)(value)) {
callback(new Error(getMsg("#(vali)")));
} else {
callback();
}
};
#end
#end
#end
#end
return {
form: {
// 设置默认值
@ -121,14 +104,14 @@
#for(column : columnList)
#if(valiDict[column.fieldName] != null && valiDict[column.fieldName].size() > 0)
#(column.fieldName): [
#for(vali : valiDict[column.fieldName])
#if(vali == "isNotNull")
#for(validate : valiDict[column.fieldName])
#if(validate == "isNotNull")
{ required: true, trigger: "blur", message: "#(column.fieldComments)非空" },
#end
#end
#for(vali : valiDict[column.fieldName])
#if(vali != "isNotNull")
{ required: false, trigger: "blur", validator: validate_#(column.fieldName+'_'+vali) },
#for(validate : valiDict[column.fieldName])
#if(validate != "isNotNull")
{ required: false, trigger: "blur", validator: #(validate) },
#end
#end
],

@ -42,7 +42,7 @@ public class LoginForm extends BaseEncrypt {
/** 密码 */
@ApiModelProperty(value = "密码")
@ValidationArgs(ValiArgsType.IS_NOT_NULL)
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_SECURITY_PASSWORD})
@ValidationArgsLenMin(6)
private String password;

Loading…
Cancel
Save