Merge remote-tracking branch 'origin/dev' into warm-flow-future
This commit is contained in:
commit
7d48bc9628
@ -216,6 +216,8 @@ springdoc:
|
|||||||
packages-to-scan: org.dromara.system
|
packages-to-scan: org.dromara.system
|
||||||
- group: 4.代码生成模块
|
- group: 4.代码生成模块
|
||||||
packages-to-scan: org.dromara.generator
|
packages-to-scan: org.dromara.generator
|
||||||
|
- group: 5.工作流模块
|
||||||
|
packages-to-scan: org.dromara.workflow
|
||||||
|
|
||||||
# 防止XSS攻击
|
# 防止XSS攻击
|
||||||
xss:
|
xss:
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
package org.dromara.common.core.validate.enumd;
|
||||||
|
|
||||||
|
import jakarta.validation.Constraint;
|
||||||
|
import jakarta.validation.Payload;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义枚举校验
|
||||||
|
*
|
||||||
|
* @author 秋辞未寒
|
||||||
|
* @date 2024-12-09
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@Repeatable(EnumPattern.List.class) // 允许在同一元素上多次使用该注解
|
||||||
|
@Constraint(validatedBy = {EnumPatternValidator.class})
|
||||||
|
public @interface EnumPattern {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要校验的枚举类型
|
||||||
|
*/
|
||||||
|
Class<? extends Enum<?>> type();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枚举类型校验值字段名称
|
||||||
|
* 需确保该字段实现了 getter 方法
|
||||||
|
*/
|
||||||
|
String fieldName();
|
||||||
|
|
||||||
|
String message() default "输入值不在枚举范围内";
|
||||||
|
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
|
||||||
|
@Documented
|
||||||
|
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@interface List {
|
||||||
|
EnumPattern[] value();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package org.dromara.common.core.validate.enumd;
|
||||||
|
|
||||||
|
import jakarta.validation.ConstraintValidator;
|
||||||
|
import jakarta.validation.ConstraintValidatorContext;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.core.utils.reflect.ReflectUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义枚举校验注解实现
|
||||||
|
*
|
||||||
|
* @author 秋辞未寒
|
||||||
|
* @date 2024-12-09
|
||||||
|
*/
|
||||||
|
public class EnumPatternValidator implements ConstraintValidator<EnumPattern, String> {
|
||||||
|
|
||||||
|
private EnumPattern annotation;;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(EnumPattern annotation) {
|
||||||
|
ConstraintValidator.super.initialize(annotation);
|
||||||
|
this.annotation = annotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
|
||||||
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
String fieldName = annotation.fieldName();
|
||||||
|
for (Object e : annotation.type().getEnumConstants()) {
|
||||||
|
if (value.equals(ReflectUtils.invokeGetter(e, fieldName))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -58,9 +58,9 @@ public class SocialUtils {
|
|||||||
case "linkedin" -> new AuthLinkedinRequest(builder.build(), STATE_CACHE);
|
case "linkedin" -> new AuthLinkedinRequest(builder.build(), STATE_CACHE);
|
||||||
case "microsoft" -> new AuthMicrosoftRequest(builder.build(), STATE_CACHE);
|
case "microsoft" -> new AuthMicrosoftRequest(builder.build(), STATE_CACHE);
|
||||||
case "renren" -> new AuthRenrenRequest(builder.build(), STATE_CACHE);
|
case "renren" -> new AuthRenrenRequest(builder.build(), STATE_CACHE);
|
||||||
case "stack_overflow" -> new AuthStackOverflowRequest(builder.build(), STATE_CACHE);
|
case "stack_overflow" -> new AuthStackOverflowRequest(builder.stackOverflowKey(obj.getStackOverflowKey()).build(), STATE_CACHE);
|
||||||
case "huawei" -> new AuthHuaweiRequest(builder.build(), STATE_CACHE);
|
case "huawei" -> new AuthHuaweiRequest(builder.build(), STATE_CACHE);
|
||||||
case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.build(), STATE_CACHE);
|
case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.agentId(obj.getAgentId()).build(), STATE_CACHE);
|
||||||
case "gitlab" -> new AuthGitlabRequest(builder.build(), STATE_CACHE);
|
case "gitlab" -> new AuthGitlabRequest(builder.build(), STATE_CACHE);
|
||||||
case "wechat_mp" -> new AuthWeChatMpRequest(builder.build(), STATE_CACHE);
|
case "wechat_mp" -> new AuthWeChatMpRequest(builder.build(), STATE_CACHE);
|
||||||
case "aliyun" -> new AuthAliyunRequest(builder.build(), STATE_CACHE);
|
case "aliyun" -> new AuthAliyunRequest(builder.build(), STATE_CACHE);
|
||||||
|
@ -106,7 +106,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
.like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment()))
|
.like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment()))
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
"create_time", params.get("beginTime"), params.get("endTime"))
|
"create_time", params.get("beginTime"), params.get("endTime"))
|
||||||
.orderByAsc("table_id");
|
.orderByDesc("update_time");
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,8 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
gen.setCreateTime(x.getCreateTime());
|
gen.setCreateTime(x.getCreateTime());
|
||||||
gen.setUpdateTime(x.getUpdateTime());
|
gen.setUpdateTime(x.getUpdateTime());
|
||||||
return gen;
|
return gen;
|
||||||
}).toList();
|
}).sorted(Comparator.comparing(GenTable::getCreateTime).reversed())
|
||||||
|
.toList();
|
||||||
|
|
||||||
IPage<GenTable> page = pageQuery.build();
|
IPage<GenTable> page = pageQuery.build();
|
||||||
page.setTotal(tables.size());
|
page.setTotal(tables.size());
|
||||||
|
@ -29,6 +29,8 @@ public class GenUtils {
|
|||||||
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
|
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
|
||||||
genTable.setFunctionName(replaceText(genTable.getTableComment()));
|
genTable.setFunctionName(replaceText(genTable.getTableComment()));
|
||||||
genTable.setFunctionAuthor(GenConfig.getAuthor());
|
genTable.setFunctionAuthor(GenConfig.getAuthor());
|
||||||
|
genTable.setCreateTime(null);
|
||||||
|
genTable.setUpdateTime(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,6 +41,8 @@ public class GenUtils {
|
|||||||
// 统一转小写 避免有些数据库默认大写问题 如果需要特别书写方式 请在实体类增加注解标注别名
|
// 统一转小写 避免有些数据库默认大写问题 如果需要特别书写方式 请在实体类增加注解标注别名
|
||||||
String columnName = column.getColumnName().toLowerCase();
|
String columnName = column.getColumnName().toLowerCase();
|
||||||
column.setTableId(table.getTableId());
|
column.setTableId(table.getTableId());
|
||||||
|
column.setCreateTime(null);
|
||||||
|
column.setUpdateTime(null);
|
||||||
// 设置java字段名
|
// 设置java字段名
|
||||||
column.setJavaField(StringUtils.toCamelCase(columnName));
|
column.setJavaField(StringUtils.toCamelCase(columnName));
|
||||||
// 设置默认类型
|
// 设置默认类型
|
||||||
|
@ -95,6 +95,10 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
${ClassName}::get$AttrName ,params.get("begin$AttrName"), params.get("end$AttrName"));
|
${ClassName}::get$AttrName ,params.get("begin$AttrName"), params.get("end$AttrName"));
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
#if($column.isPk==1)
|
||||||
|
lqw.orderByAsc(${ClassName}::get$AttrName);
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,6 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) {
|
public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) {
|
||||||
// 只查询未禁用部门
|
|
||||||
bo.setStatus(SystemConstants.NORMAL);
|
|
||||||
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
||||||
List<SysDeptVo> depts = baseMapper.selectDeptList(lqw);
|
List<SysDeptVo> depts = baseMapper.selectDeptList(lqw);
|
||||||
return buildDeptTreeSelect(depts);
|
return buildDeptTreeSelect(depts);
|
||||||
@ -116,7 +114,8 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
tree.setId(dept.getDeptId())
|
tree.setId(dept.getDeptId())
|
||||||
.setParentId(dept.getParentId())
|
.setParentId(dept.getParentId())
|
||||||
.setName(dept.getDeptName())
|
.setName(dept.getDeptName())
|
||||||
.setWeight(dept.getOrderNum()));
|
.setWeight(dept.getOrderNum())
|
||||||
|
.putExtra("disabled", SystemConstants.DISABLE.equals(dept.getStatus())));
|
||||||
Tree<Long> tree = trees.stream().filter(it -> it.getId().longValue() == d.getDeptId()).findFirst().get();
|
Tree<Long> tree = trees.stream().filter(it -> it.getId().longValue() == d.getDeptId()).findFirst().get();
|
||||||
treeList.add(tree);
|
treeList.add(tree);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user