Merge branch 'refs/heads/dev-8.3.3'

master v8.3.3
stylefeng 2025-02-25 18:45:47 +08:00
commit ff4369a6f7
261 changed files with 4503 additions and 800 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -24,6 +24,9 @@
*/
package cn.stylefeng.roses.kernel.rule.enums.permission;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.rule.base.ReadableEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.rule.exception.enums.DataScopeExceptionEnum;
import lombok.Getter;
@ -35,7 +38,7 @@ import lombok.Getter;
* @since 2020/11/5 15:22
*/
@Getter
public enum DataScopeTypeEnum {
public enum DataScopeTypeEnum implements ReadableEnum<DataScopeTypeEnum> {
/**
*
@ -58,9 +61,21 @@ public enum DataScopeTypeEnum {
COMPANY_WITH_CHILD(31, "本公司及以下数据"),
/**
*
*
* <p>
*
*/
DEFINE(40, "指定部门数据"),
DEFINE_ORG_LEVEL_WITH_CHILD(32, "指定机构层级及以下"),
/**
*
*/
DEFINE(40, "指定机构集合数据"),
/**
*
*/
DEFINE_ORG_WITH_CHILD(41, "指定机构及以下"),
/**
*
@ -93,4 +108,26 @@ public enum DataScopeTypeEnum {
throw new ServiceException(DataScopeExceptionEnum.DATA_SCOPE_ERROR);
}
@Override
public Object getKey() {
return code;
}
@Override
public Object getName() {
return message;
}
@Override
public DataScopeTypeEnum parseToEnum(String originValue) {
if (ObjectUtil.isEmpty(originValue)) {
return null;
}
for (DataScopeTypeEnum value : DataScopeTypeEnum.values()) {
if (value.code.equals(Convert.toInt(originValue))) {
return value;
}
}
return null;
}
}

View File

@ -28,9 +28,12 @@ import cn.stylefeng.roses.kernel.rule.tree.factory.base.AbstractSortedTreeNode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
*
@ -54,22 +57,14 @@ public class SortedTreeBuildFactory<T extends AbstractSortedTreeNode<T>> extends
public List<T> doTreeBuild(List<T> nodes) {
// 先对列表进行排序
nodes.sort(Comparator.comparing(AbstractSortedTreeNode::getSort));
nodes.sort(Comparator.comparing(itemNode -> Optional.ofNullable((itemNode).getSort()).orElse(new BigDecimal(Integer.MAX_VALUE))));
// 将每个节点构造一个子树
for (T treeNode : nodes) {
this.buildChildNodes(nodes, treeNode, new ArrayList<>());
}
// 只保留上级是根节点的节点,也就是只留下所有一级节点
ArrayList<T> results = new ArrayList<>();
for (T node : nodes) {
if (node.getNodeParentId().equals(getRootParentId())) {
results.add(node);
}
}
return results;
return findTops(nodes);
}
@Override
@ -81,7 +76,7 @@ public class SortedTreeBuildFactory<T extends AbstractSortedTreeNode<T>> extends
List<T> nodeSubLists = getSubChildsLevelOne(totalNodes, node);
// 对子节点进行排序
nodeSubLists.sort(Comparator.comparing(AbstractSortedTreeNode::getSort));
nodeSubLists.sort(Comparator.comparing(itemNode -> Optional.ofNullable((itemNode).getSort()).orElse(new BigDecimal(Integer.MAX_VALUE))));
if (!nodeSubLists.isEmpty()) {
for (T nodeSubList : nodeSubLists) {
@ -93,4 +88,19 @@ public class SortedTreeBuildFactory<T extends AbstractSortedTreeNode<T>> extends
node.setChildrenNodes(childNodeLists);
}
/**
* nodeid
*
* @author fengshuonan
* @since 2024/12/11 15:35
*/
private List<T> findTops(List<T> nodes) {
List<T> totalParentList = nodes.stream().filter((itemNode) -> null != itemNode.getNodeParentId()).collect(Collectors.toList());
List<String> totalNodeIdList = nodes.stream().map(AbstractSortedTreeNode::getNodeId).collect(Collectors.toList());
return totalParentList.stream().filter((item) -> !totalNodeIdList.contains(item.getNodeParentId())).distinct().collect(Collectors.toList());
}
}

View File

@ -1,36 +1,9 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.rule.util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.framework.AdvisedSupport;
import org.springframework.aop.framework.AopProxy;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import java.lang.reflect.Field;
/**
*
*
@ -73,12 +46,10 @@ public class AopTargetUtils {
* @since 2020/10/19 16:21
*/
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
h.setAccessible(true);
Object dynamicAdvisedInterceptor = h.get(proxy);
Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
advised.setAccessible(true);
return ((AdvisedSupport) advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();
if (proxy instanceof Advised advised) {
return advised.getTargetSource().getTarget();
}
throw new IllegalArgumentException("Not a CGLIB proxy");
}
/**
@ -88,12 +59,10 @@ public class AopTargetUtils {
* @since 2020/10/19 16:22
*/
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
h.setAccessible(true);
AopProxy aopProxy = (AopProxy) h.get(proxy);
Field advised = aopProxy.getClass().getDeclaredField("advised");
advised.setAccessible(true);
return ((AdvisedSupport) advised.get(aopProxy)).getTargetSource().getTarget();
if (proxy instanceof Advised advised) {
return advised.getTargetSource().getTarget();
}
throw new IllegalArgumentException("Not a JDK dynamic proxy");
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-auth</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -121,7 +121,7 @@ public enum AuthExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
LOGIN_LOCKED(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "18", "账号或密码错误!");
LOGIN_LOCKED(RuleConstants.BUSINESS_ERROR_TYPE_CODE + AuthConstants.AUTH_EXCEPTION_STEP_CODE + "18", "暂时无法登录,请稍后重试");
/**
*

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-auth</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-auth</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -67,4 +67,9 @@ public interface CacheConstants {
*/
String DEFAULT_STRING_CACHE_PREFIX = "DEFAULT:STRINGS:";
/**
* 60
*/
Long DEFAULT_EXP_SECONDS = 60L * 60L;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-cache</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-config</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -1,24 +1,18 @@
package cn.stylefeng.roses.kernel.db.mp.datascope;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.db.mp.datascope.config.DataScopeConfig;
import cn.stylefeng.roses.kernel.db.mp.datascope.holder.DataScopeHolder;
import cn.stylefeng.roses.kernel.rule.enums.permission.DataScopeTypeEnum;
import com.baomidou.mybatisplus.extension.plugins.handler.MultiDataPermissionHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.StringValue;
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
import net.sf.jsqlparser.expression.Parenthesis;
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
import net.sf.jsqlparser.expression.operators.relational.InExpression;
import net.sf.jsqlparser.expression.operators.relational.LikeExpression;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.select.LateralSubSelect;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.SelectItem;
import java.util.stream.Collectors;
@ -54,118 +48,40 @@ public class ProjectDataScopeHandler implements MultiDataPermissionHandler {
return null;
}
// 数据校验处理
dataScopeConfig = this.validateDataScopeConfig(dataScopeConfig);
if (dataScopeConfig == null) {
// 如果是全部权限,则不校验
if (dataScopeConfig.isTotalDataScope()) {
return null;
}
// 获取数据范围的类型
DataScopeTypeEnum dataScopeTypeEnum = dataScopeConfig.getDataScopeType();
switch (dataScopeTypeEnum) {
Expression dataScopeExpression = null;
// 如果是全部数据返回空不对sql进行处理
case ALL:
return null;
// 如果是需要校验仅创建人数据
if (dataScopeConfig.isDoCreateUserValidate()) {
// 如果是本部门数据,则限制查询只能查询本部门数据
case DEPT:
return getEqualsTo(dataScopeConfig.getOrgIdFieldName(), dataScopeConfig.getUserDeptId());
// 获取创建人ID
Long currentUserId = dataScopeConfig.getUserId();
// 如果是本部门及以下部门
case DEPT_WITH_CHILD:
return deptWithChildScope(dataScopeConfig, dataScopeConfig.getUserDeptId());
// 本公司及以下数据
case COMPANY_WITH_CHILD:
return deptWithChildScope(dataScopeConfig, dataScopeConfig.getUserCompanyId());
// 指定部门数据
case DEFINE:
return getInExpression(dataScopeConfig);
// 仅本人数据
case SELF:
return getEqualsTo(dataScopeConfig.getUserIdFieldName(), dataScopeConfig.getUserId());
// 其他情况
default:
return null;
}
}
/**
*
*
* @author fengshuonan
* @since 2024-02-29 11:00
*/
private DataScopeConfig validateDataScopeConfig(DataScopeConfig dataScopeConfig) {
if (dataScopeConfig == null) {
return null;
// 生成创建人条件表达式
dataScopeExpression = getEqualsTo(dataScopeConfig.getUserIdFieldName(), currentUserId);
}
DataScopeTypeEnum dataScopeType = dataScopeConfig.getDataScopeType();
if (dataScopeType == null) {
return null;
}
// 如果是需要校验指定部门数据
if (dataScopeConfig.isDoOrgScopeValidate()) {
// 如果数据范围为全部直接返回空也就是不进行数据范围sql拦截器
if (DataScopeTypeEnum.ALL.equals(dataScopeType)) {
return null;
}
// 获取组织范围条件表达式
InExpression orgScopeCondition = getInExpression(dataScopeConfig);
// 如果数据范围是本人则查询本人id是否传递
else if (DataScopeTypeEnum.SELF.equals(dataScopeType)) {
if (ObjectUtil.isEmpty(dataScopeConfig.getUserId())) {
dataScopeConfig.setUserId(NONE_ID_VALUE);
}
if (ObjectUtil.isEmpty(dataScopeConfig.getUserIdFieldName())) {
dataScopeConfig.setUserIdFieldName(DEFAULT_USER_ID_FIELD_NAME);
// 如果已经有创建人条件,需要合并
if (dataScopeExpression != null) {
// 使用 OrExpression 合并条件
dataScopeExpression = new AndExpression(dataScopeExpression, orgScopeCondition);
} else {
// 否则仅使用组织范围条件
dataScopeExpression = orgScopeCondition;
}
}
// 如果是本公司及以下数据则查询公司id是否传递
else if (DataScopeTypeEnum.COMPANY_WITH_CHILD.equals(dataScopeType)) {
if (ObjectUtil.isEmpty(dataScopeConfig.getUserCompanyId())) {
dataScopeConfig.setUserCompanyId(NONE_ID_VALUE);
}
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
}
}
// 如果是本部门及以下数据则查询部门id是否传递
else if (DataScopeTypeEnum.DEPT_WITH_CHILD.equals(dataScopeType)) {
if (ObjectUtil.isEmpty(dataScopeConfig.getUserDeptId())) {
dataScopeConfig.setUserDeptId(NONE_ID_VALUE);
}
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
}
}
// 如果是本部门数据则查询部门id是否传递
else if (DataScopeTypeEnum.DEPT.equals(dataScopeType)) {
if (ObjectUtil.isEmpty(dataScopeConfig.getUserDeptId())) {
dataScopeConfig.setUserDeptId(NONE_ID_VALUE);
}
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
}
}
// 如果是指定部门数据则查询部门id是否传递
else if (DataScopeTypeEnum.DEFINE.equals(dataScopeType)) {
if (ObjectUtil.isEmpty(dataScopeConfig.getSpecificOrgIds())) {
dataScopeConfig.setSpecificOrgIds(ListUtil.list(true, NONE_ID_VALUE));
}
if (ObjectUtil.isEmpty(dataScopeConfig.getOrgIdFieldName())) {
dataScopeConfig.setOrgIdFieldName(DEFAULT_ORG_ID_FIELD_NAME);
}
}
return dataScopeConfig;
return dataScopeExpression;
}
/**
@ -197,52 +113,13 @@ public class ProjectDataScopeHandler implements MultiDataPermissionHandler {
// 创建 IN 表达式的值列表
ExpressionList expressionList = new ExpressionList();
expressionList.setExpressions(dataScopeConfig.getSpecificOrgIds().stream().map(LongValue::new).collect(Collectors.toList()));
expressionList.setExpressions(dataScopeConfig.getUserOrgIdList().stream().map(LongValue::new).collect(Collectors.toList()));
// 创建 IN 表达式
InExpression inExpression = new InExpression();
inExpression.setLeftExpression(orgIdColumn);
inExpression.setRightExpression(expressionList);
inExpression.setRightExpression(new Parenthesis(expressionList));
return inExpression;
}
/**
*
* <p>
* org_id in (select org_id from sys_hr_organization where org_pids like "%[id]%" or org_id = id)
*
* @author fengshuonan
* @since 2024-02-29 20:14
*/
private static Expression deptWithChildScope(DataScopeConfig dataScopeConfig, Long deptOrCompanyId) {
// 创建 org_id 列
Column orgIdColumn = new Column(dataScopeConfig.getOrgIdFieldName());
// 创建子查询 select 部分
LateralSubSelect subSelect = new LateralSubSelect();
PlainSelect selectBody = new PlainSelect();
selectBody.setSelectItems(ListUtil.of(new SelectItem<>(orgIdColumn)));
selectBody.setFromItem(new Table("sys_hr_organization"));
// 创建 LIKE 表达式
LikeExpression likeExpression = new LikeExpression();
likeExpression.setLeftExpression(new Column("org_pids"));
likeExpression.setRightExpression(new StringValue("%[" + deptOrCompanyId + "]%"));
// 设置等于表达式
EqualsTo equalsTo = new EqualsTo();
equalsTo.setLeftExpression(orgIdColumn);
equalsTo.setRightExpression(new LongValue(deptOrCompanyId));
// 创建 OR 表达式
OrExpression orExpression = new OrExpression(likeExpression, equalsTo);
// 设置子查询的 WHERE 条件
selectBody.setWhere(orExpression);
subSelect.setSelect(selectBody);
// 创建 IN 表达式
return new InExpression(orgIdColumn, subSelect);
}
}

View File

@ -1,6 +1,7 @@
package cn.stylefeng.roses.kernel.db.mp.datascope;
import cn.stylefeng.roses.kernel.db.mp.datascope.config.DataScopeConfig;
import cn.stylefeng.roses.kernel.rule.enums.permission.DataScopeTypeEnum;
/**
*
@ -18,4 +19,12 @@ public interface UserRoleDataScopeApi {
*/
DataScopeConfig getUserRoleDataScopeConfig();
/**
*
*
* @author fengshuonan
* @since 2025/1/27 23:32
*/
DataScopeConfig getUserPointDataScopeConfig(DataScopeTypeEnum dataScopeTypeEnum);
}

View File

@ -1,10 +1,9 @@
package cn.stylefeng.roses.kernel.db.mp.datascope.config;
import cn.stylefeng.roses.kernel.db.mp.datascope.ProjectDataScopeHandler;
import cn.stylefeng.roses.kernel.rule.enums.permission.DataScopeTypeEnum;
import lombok.Data;
import java.util.List;
import java.util.Set;
/**
*
@ -16,38 +15,48 @@ import java.util.List;
public class DataScopeConfig {
/**
*
*
* <p>
*
*/
private DataScopeTypeEnum dataScopeType;
private boolean totalDataScope = false;
//-------------------------------针对限制的用户的数据范围进行校验-------------------------------
/**
* id
*
*/
private boolean doCreateUserValidate = false;
/**
* id
* <p>
* id
*/
private Long userId;
/**
* id
*/
private Long userDeptId;
/**
* id
*/
private Long userCompanyId;
/**
* ID DEFINE 使
*/
private List<Long> specificOrgIds;
/**
*
*/
private String orgIdFieldName = ProjectDataScopeHandler.DEFAULT_ORG_ID_FIELD_NAME;
/**
*
*/
private String userIdFieldName = ProjectDataScopeHandler.DEFAULT_USER_ID_FIELD_NAME;
//-------------------------------针对限制的部门集合数据范围进行校验-------------------------------
/**
*
*/
private boolean doOrgScopeValidate = false;
/**
* id
* <p>
*
*/
private Set<Long> userOrgIdList;
/**
*
*/
private String orgIdFieldName = ProjectDataScopeHandler.DEFAULT_ORG_ID_FIELD_NAME;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-db</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-ds-container</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-email</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-event</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-event</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-event</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -82,4 +82,16 @@ public interface FileConstants {
*/
String DEFAULT_AVATAR_FILE_OBJ_NAME = "defaultAvatar.png";
//-------------------------------缓存相关-------------------------------
/**
*
*/
String FILE_INFO_CACHE_NAME_PREFIX = "FILE_INFO:";
/**
*
*/
Long FILE_CACHE_TIMEOUT_SECONDS = 3600L * 24 * 2;
}

View File

@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
/**
* id访
* <p>
*
*
* @author fengshuonan
* @since 2023/11/13 17:49

View File

@ -7,6 +7,8 @@ import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
/**
* Jsonurl
* <p>
*
*
* @author fengshuonan
* @since 2023/3/28 9:30

View File

@ -126,6 +126,12 @@ public class SysFileInfoResponse {
@ChineseDescription("存储路径")
private String filePath;
/**
* md5
*/
@ChineseDescription("文件的md5值")
private String fileMd5;
/**
* 访url访url
*/
@ -150,10 +156,4 @@ public class SysFileInfoResponse {
@ChineseDescription("上传时间")
private Date uploadTime;
/**
* md5
*/
@ChineseDescription("文件的md5值")
private String fileMd5;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -61,6 +61,20 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--内存或者redis的缓存-->
<dependency>
<groupId>com.javaguns.roses</groupId>
<artifactId>cache-sdk-memory</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.javaguns.roses</groupId>
<artifactId>cache-sdk-redis</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,27 @@
package cn.stylefeng.roses.kernel.file.modular.cache;
import cn.hutool.cache.impl.TimedCache;
import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
/**
*
* <p>
* keyidvalueSysFileInfoResponse
*
* @author fengshuonan
* @since 2025/1/14 16:58
*/
public class FileInfoMemoryCache extends AbstractMemoryCacheOperator<SysFileInfoResponse> {
public FileInfoMemoryCache(TimedCache<String, SysFileInfoResponse> timedCache) {
super(timedCache);
}
@Override
public String getCommonKeyPrefix() {
return FileConstants.FILE_INFO_CACHE_NAME_PREFIX;
}
}

View File

@ -0,0 +1,27 @@
package cn.stylefeng.roses.kernel.file.modular.cache;
import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
import org.springframework.data.redis.core.RedisTemplate;
/**
* Redis
* <p>
* keyidvalueSysFileInfoResponse
*
* @author fengshuonan
* @since 2025/1/14 16:58
*/
public class FileInfoRedisCache extends AbstractRedisCacheOperator<SysFileInfoResponse> {
public FileInfoRedisCache(RedisTemplate<String, SysFileInfoResponse> redisTemplate) {
super(redisTemplate);
}
@Override
public String getCommonKeyPrefix() {
return FileConstants.FILE_INFO_CACHE_NAME_PREFIX;
}
}

View File

@ -33,6 +33,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
@ -58,6 +59,7 @@ import cn.stylefeng.roses.kernel.file.modular.mapper.SysFileInfoMapper;
import cn.stylefeng.roses.kernel.file.modular.service.SysFileInfoService;
import cn.stylefeng.roses.kernel.file.modular.service.SysFileStorageService;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.rule.util.StrFilterUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -100,40 +102,41 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Resource
private SysFileStorageService sysFileStorageService;
@Resource(name = "fileInfoCache")
private CacheOperatorApi<SysFileInfoResponse> fileInfoCache;
@Override
public SysFileInfoResponse getFileInfoResult(Long fileId) {
// 查询库中文件信息
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
sysFileInfoRequest.setFileId(fileId);
SysFileInfo sysFileInfo = this.querySysFileInfo(sysFileInfoRequest);
SysFileInfoResponse fileInfo = this.getFileInfoWithoutContent(fileId);
if (fileInfo == null) {
throw new ServiceException(FileExceptionEnum.FILE_NOT_FOUND);
}
// 获取文件字节码
byte[] fileBytes;
try {
// 如果是存储在数据库从数据库中获取其他的方式走FileOperatorApi
if (FileLocationEnum.DB.getCode().equals(sysFileInfo.getFileLocation())) {
if (FileLocationEnum.DB.getCode().equals(fileInfo.getFileLocation())) {
SysFileStorage storage = sysFileStorageService.getById(fileId);
// 如果在数据库中找不到这条记录,则从本地资源路径中找,因为有的文件字节较大不宜往数据库中存储
if (storage == null) {
fileBytes = ResourceUtil.readBytes("pics/" + sysFileInfo.getFileId() + "." + sysFileInfo.getFileSuffix());
fileBytes = ResourceUtil.readBytes("pics/" + fileInfo.getFileId() + "." + fileInfo.getFileSuffix());
} else {
fileBytes = storage.getFileBytes();
}
} else {
fileBytes = fileOperatorApi.getFileBytes(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName());
fileBytes = fileOperatorApi.getFileBytes(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
}
} catch (Exception e) {
log.error("获取文件异常,具体信息为:{}", e.getMessage());
log.error("获取文件异常,具体信息为:{}", e.getMessage());
throw new FileException(FileExceptionEnum.FILE_STREAM_ERROR, e.getMessage());
}
// 设置文件字节码
SysFileInfoResponse sysFileInfoResult = new SysFileInfoResponse();
BeanUtil.copyProperties(sysFileInfo, sysFileInfoResult);
sysFileInfoResult.setFileBytes(fileBytes);
return sysFileInfoResult;
fileInfo.setFileBytes(fileBytes);
return fileInfo;
}
@Override
@ -182,6 +185,9 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
// 存储新版本文件信息
this.save(newFileInfo);
// 删除文件信息的缓存
fileInfoCache.remove(oldFileInfo.getFileId().toString());
// 返回文件信息体
SysFileInfoResponse fileUploadInfoResult = new SysFileInfoResponse();
BeanUtil.copyProperties(newFileInfo, fileUploadInfoResult);
@ -231,6 +237,10 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
this.fileOperatorApi.deleteFile(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
}
}
// 删除文件缓存
List<String> fileIdListString = fileInfos.stream().map(SysFileInfo::getFileId).map(String::valueOf).collect(Collectors.toList());
fileInfoCache.remove(fileIdListString);
}
@Override
@ -440,15 +450,30 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Override
public SysFileInfoResponse getFileInfoWithoutContent(Long fileId) {
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
sysFileInfoRequest.setFileId(fileId);
if (fileId == null) {
return null;
}
// 获取文件的基本信息
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
// 先从缓存中获取文件信息详情
SysFileInfoResponse cachedResult = fileInfoCache.get(fileId.toString());
if (cachedResult != null) {
return cachedResult;
}
LambdaQueryWrapper<SysFileInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysFileInfo::getFileId, fileId);
wrapper.select(SysFileInfo::getFileId, SysFileInfo::getFileCode, SysFileInfo::getFileVersion, SysFileInfo::getFileStatus, SysFileInfo::getFileSuffix, SysFileInfo::getFileSizeKb,
SysFileInfo::getFileSizeInfo, SysFileInfo::getSecretFlag, SysFileInfo::getFileObjectName, SysFileInfo::getFileLocation, SysFileInfo::getFileBucket, SysFileInfo::getFileOriginName,
SysFileInfo::getFilePath, SysFileInfo::getFileMd5);
SysFileInfo sysFileInfo = this.getOne(wrapper, false);
if (sysFileInfo == null) {
return null;
}
// 转化实体
SysFileInfoResponse sysFileInfoResponse = new SysFileInfoResponse();
BeanUtil.copyProperties(sysFileInfo, sysFileInfoResponse);
fileInfoCache.put(fileId.toString(), sysFileInfoResponse, FileConstants.DEFAULT_FILE_TIMEOUT_SECONDS);
return sysFileInfoResponse;
}
@ -461,33 +486,34 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
@Override
public String getFileAuthUrl(Long fileId, String token) {
// 获取文件的基本信息
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
sysFileInfoRequest.setFileId(fileId);
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
SysFileInfoResponse fileInfo = this.getFileInfoWithoutContent(fileId);
if(fileInfo == null){
throw new ServiceException(FILE_NOT_FOUND);
}
// 如果是数据库存储则返回previewUrl
if (sysFileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
if (fileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
return this.sysFileStorageService.getFileAuthUrl(String.valueOf(fileId));
} else {
// 返回第三方存储文件url
return fileOperatorApi.getFileAuthUrl(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName(),
FileConfigExpander.getDefaultFileTimeoutSeconds());
return fileOperatorApi.getFileAuthUrl(fileInfo.getFileBucket(), fileInfo.getFileObjectName(), FileConfigExpander.getDefaultFileTimeoutSeconds());
}
}
@Override
public String getFileUnAuthUrl(Long fileId) {
// 获取文件的基本信息
SysFileInfoRequest sysFileInfoRequest = new SysFileInfoRequest();
sysFileInfoRequest.setFileId(fileId);
SysFileInfo sysFileInfo = querySysFileInfo(sysFileInfoRequest);
SysFileInfoResponse fileInfo = this.getFileInfoWithoutContent(fileId);
if(fileInfo == null){
throw new ServiceException(FILE_NOT_FOUND);
}
// 如果是数据库存储则返回previewUrl
if (sysFileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
if (fileInfo.getFileLocation().equals(FileLocationEnum.DB.getCode())) {
return this.sysFileStorageService.getFileUnAuthUrl(String.valueOf(fileId));
} else {
// 返回第三方存储文件url
return fileOperatorApi.getFileUnAuthUrl(sysFileInfo.getFileBucket(), sysFileInfo.getFileObjectName());
return fileOperatorApi.getFileUnAuthUrl(fileInfo.getFileBucket(), fileInfo.getFileObjectName());
}
}
@ -551,10 +577,7 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
antdvFileInfo.setUid(String.valueOf(fileId));
// 设置文件名称
LambdaQueryWrapper<SysFileInfo> sysFileInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysFileInfoLambdaQueryWrapper.eq(SysFileInfo::getFileId, fileId);
sysFileInfoLambdaQueryWrapper.select(SysFileInfo::getFileOriginName, SysFileInfo::getFileSizeInfo, SysFileInfo::getFileSuffix);
SysFileInfo sysFileInfo = this.getOne(sysFileInfoLambdaQueryWrapper);
SysFileInfoResponse sysFileInfo = this.getFileInfoWithoutContent(fileId);
if (sysFileInfo == null) {
continue;
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-file</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -31,6 +31,20 @@
<version>${roses.version}</version>
</dependency>
<!--内存或者redis的缓存-->
<dependency>
<groupId>com.javaguns.roses</groupId>
<artifactId>cache-sdk-memory</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.javaguns.roses</groupId>
<artifactId>cache-sdk-redis</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,59 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.file.starter.cache;
import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
import cn.stylefeng.roses.kernel.file.modular.cache.FileInfoMemoryCache;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
*
*
* @author fengshuonan
* @since 2025/1/14 17:03
*/
@Configuration
@ConditionalOnMissingClass("org.springframework.data.redis.connection.RedisConnectionFactory")
public class FileMemoryCacheAutoConfiguration {
/**
*
*
* @author fengshuonan
* @since 2025/1/14 17:04
*/
@Bean
public CacheOperatorApi<SysFileInfoResponse> fileInfoCache() {
TimedCache<String, SysFileInfoResponse> cache = CacheUtil.newTimedCache(1000 * FileConstants.FILE_CACHE_TIMEOUT_SECONDS);
return new FileInfoMemoryCache(cache);
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.file.starter.cache;
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
import cn.stylefeng.roses.kernel.cache.redis.util.CreateRedisTemplateUtil;
import cn.stylefeng.roses.kernel.file.api.pojo.response.SysFileInfoResponse;
import cn.stylefeng.roses.kernel.file.modular.cache.FileInfoRedisCache;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
/**
*
*
* @author fengshuonan
* @since 2025/1/14 17:23
*/
@Configuration
@ConditionalOnClass(name = "org.springframework.data.redis.connection.RedisConnectionFactory")
public class FileRedisCacheAutoConfiguration {
/**
* Redis
*
* @author fengshuonan
* @since 2025/1/14 17:25
*/
@Bean
public CacheOperatorApi<SysFileInfoResponse> fileInfoCache(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, SysFileInfoResponse> redisTemplate = CreateRedisTemplateUtil.createObject(redisConnectionFactory);
return new FileInfoRedisCache(redisTemplate);
}
}

View File

@ -1,2 +1,4 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.stylefeng.roses.kernel.file.starter.ProjectFileAutoConfiguration
cn.stylefeng.roses.kernel.file.starter.ProjectFileAutoConfiguration,\
cn.stylefeng.roses.kernel.file.starter.cache.FileRedisCacheAutoConfiguration,\
cn.stylefeng.roses.kernel.file.starter.cache.FileMemoryCacheAutoConfiguration

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-groovy</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-groovy</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-groovy</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-i18n</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-i18n</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-i18n</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-i18n</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-jwt</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-jwt</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-log</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-log</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-log</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -155,7 +155,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
String searchText = logManagerRequest.getSearchText();
if (StrUtil.isNotEmpty(searchText)) {
queryWrapper.nested(wrap -> {
queryWrapper.likeRight(SysLog::getRequestUrl, searchText).or().likeRight(SysLog::getLogContent, searchText);
wrap.like(SysLog::getRequestUrl, searchText).or().like(SysLog::getLogContent, searchText);
});
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-log</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-log</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-log</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-office</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-office</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-pinyin</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-pinyin</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-pinyin</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-scanner</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-scanner</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-scanner</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-security</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-security</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-security</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-security</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.javaguns.roses</groupId>
<artifactId>kernel-d-security</artifactId>
<version>8.3.2</version>
<version>8.3.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

Some files were not shown because too many files have changed in this diff Show More