mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	refactor: 适配 ContiNew Starter 数据权限解决方案(数据访问模块-MyBatis Plus)
1.移除数据权限相关内容,适配 ContiNew Starter 数据权限解决方案 2.适配 ContiNew Starter 部分包结构变动
This commit is contained in:
		| @@ -1,75 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.admin.common.annotation; | ||||
|  | ||||
| import java.lang.annotation.*; | ||||
|  | ||||
| import org.springframework.core.annotation.AliasFor; | ||||
|  | ||||
| /** | ||||
|  * 数据权限注解 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 2023/3/6 23:34 | ||||
|  */ | ||||
| @Target(ElementType.METHOD) | ||||
| @Retention(RetentionPolicy.RUNTIME) | ||||
| @Documented | ||||
| public @interface DataPermission { | ||||
|  | ||||
|     /** | ||||
|      * Alias for the {@link #tableAlias()} attribute. | ||||
|      */ | ||||
|     @AliasFor("tableAlias") | ||||
|     String value() default ""; | ||||
|  | ||||
|     /** | ||||
|      * 表别名 | ||||
|      */ | ||||
|     @AliasFor("value") | ||||
|     String tableAlias() default ""; | ||||
|  | ||||
|     /** | ||||
|      * ID | ||||
|      */ | ||||
|     String id() default "id"; | ||||
|  | ||||
|     /** | ||||
|      * 部门 ID | ||||
|      */ | ||||
|     String deptId() default "dept_id"; | ||||
|  | ||||
|     /** | ||||
|      * 用户 ID | ||||
|      */ | ||||
|     String userId() default "create_user"; | ||||
|  | ||||
|     /** | ||||
|      * 角色 ID(角色和部门关联表) | ||||
|      */ | ||||
|     String roleId() default "role_id"; | ||||
|  | ||||
|     /** | ||||
|      * 部门表别名 | ||||
|      */ | ||||
|     String deptTableAlias() default "sys_dept"; | ||||
|  | ||||
|     /** | ||||
|      * 角色和部门关联表别名 | ||||
|      */ | ||||
|     String roleDeptTableAlias() default "sys_role_dept"; | ||||
| } | ||||
| @@ -0,0 +1,58 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.admin.common.config.mybatis; | ||||
|  | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import cn.hutool.core.convert.Convert; | ||||
|  | ||||
| import top.charles7c.continew.admin.common.model.dto.LoginUser; | ||||
| import top.charles7c.continew.admin.common.util.helper.LoginHelper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionCurrentUser; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataScope; | ||||
|  | ||||
| /** | ||||
|  * 数据权限过滤器实现类 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 2023/12/21 21:19 | ||||
|  */ | ||||
| public class DataPermissionFilterImpl implements DataPermissionFilter { | ||||
|  | ||||
|     @Override | ||||
|     public boolean isFilter() { | ||||
|         LoginUser loginUser = LoginHelper.getLoginUser(); | ||||
|         return null != loginUser && !loginUser.isAdmin(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public DataPermissionCurrentUser getCurrentUser() { | ||||
|         LoginUser loginUser = LoginHelper.getLoginUser(); | ||||
|         if (null == loginUser) { | ||||
|             throw new IllegalArgumentException("Current user is not allowed to be empty."); | ||||
|         } | ||||
|         DataPermissionCurrentUser currentUser = new DataPermissionCurrentUser(); | ||||
|         currentUser.setUserId(Convert.toStr(loginUser.getId())); | ||||
|         currentUser.setDeptId(Convert.toStr(loginUser.getDeptId())); | ||||
|         currentUser.setRoles(loginUser.getRoles().stream() | ||||
|             .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), | ||||
|                 DataScope.valueOf(r.getDataScope().name()))) | ||||
|             .collect(Collectors.toSet())); | ||||
|         return currentUser; | ||||
|     } | ||||
| } | ||||
| @@ -1,176 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.admin.common.config.mybatis; | ||||
|  | ||||
| import java.lang.reflect.Method; | ||||
| import java.util.Collections; | ||||
|  | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | ||||
| import com.baomidou.mybatisplus.extension.plugins.handler.DataPermissionHandler; | ||||
|  | ||||
| import top.charles7c.continew.admin.common.annotation.DataPermission; | ||||
| import top.charles7c.continew.admin.common.enums.DataScopeEnum; | ||||
| import top.charles7c.continew.admin.common.model.dto.LoginUser; | ||||
| import top.charles7c.continew.admin.common.model.dto.RoleDTO; | ||||
| import top.charles7c.continew.admin.common.util.helper.LoginHelper; | ||||
| import top.charles7c.continew.starter.core.constant.StringConstants; | ||||
|  | ||||
| import net.sf.jsqlparser.expression.Expression; | ||||
| import net.sf.jsqlparser.expression.Function; | ||||
| import net.sf.jsqlparser.expression.LongValue; | ||||
| import net.sf.jsqlparser.expression.Parenthesis; | ||||
| import net.sf.jsqlparser.expression.operators.conditional.AndExpression; | ||||
| import net.sf.jsqlparser.expression.operators.conditional.OrExpression; | ||||
| 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.schema.Column; | ||||
| import net.sf.jsqlparser.schema.Table; | ||||
| import net.sf.jsqlparser.statement.select.PlainSelect; | ||||
| import net.sf.jsqlparser.statement.select.SelectExpressionItem; | ||||
| import net.sf.jsqlparser.statement.select.SubSelect; | ||||
|  | ||||
| /** | ||||
|  * 数据权限处理器实现 | ||||
|  * <p> | ||||
|  * 来源:<a href="https://gitee.com/baomidou/mybatis-plus/issues/I37I90">DataPermissionInterceptor 如何使用?</a> | ||||
|  * </p> | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 2023/3/6 23:19 | ||||
|  */ | ||||
| @Slf4j | ||||
| public class DataPermissionHandlerImpl implements DataPermissionHandler { | ||||
|  | ||||
|     @Override | ||||
|     public Expression getSqlSegment(Expression where, String mappedStatementId) { | ||||
|         try { | ||||
|             Class<?> clazz = | ||||
|                 Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(StringConstants.DOT))); | ||||
|             String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringConstants.DOT) + 1); | ||||
|             Method[] methodArr = clazz.getMethods(); | ||||
|             for (Method method : methodArr) { | ||||
|                 DataPermission dataPermission = method.getAnnotation(DataPermission.class); | ||||
|                 if (null != dataPermission | ||||
|                     && (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName))) { | ||||
|                     LoginUser loginUser = LoginHelper.getLoginUser(); | ||||
|                     if (null != loginUser && !loginUser.isAdmin()) { | ||||
|                         return buildDataScopeFilter(loginUser, dataPermission, where); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } catch (ClassNotFoundException e) { | ||||
|             log.error("Data permission handler build data scope filter occurred an error: {}.", e.getMessage(), e); | ||||
|         } | ||||
|         return where; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 构建数据范围过滤条件 | ||||
|      * | ||||
|      * @param user | ||||
|      *            当前登录用户 | ||||
|      * @param dataPermission | ||||
|      *            数据权限 | ||||
|      * @param where | ||||
|      *            当前查询条件 | ||||
|      * @return 构建后查询条件 | ||||
|      */ | ||||
|     private Expression buildDataScopeFilter(LoginUser user, DataPermission dataPermission, Expression where) { | ||||
|         Expression expression = null; | ||||
|         String tableAlias = dataPermission.tableAlias(); | ||||
|         String id = dataPermission.id(); | ||||
|         String deptId = dataPermission.deptId(); | ||||
|         for (RoleDTO role : user.getRoles()) { | ||||
|             DataScopeEnum dataScope = role.getDataScope(); | ||||
|             if (DataScopeEnum.ALL.equals(dataScope)) { | ||||
|                 return where; | ||||
|             } | ||||
|             if (DataScopeEnum.DEPT_AND_CHILD.equals(dataScope)) { | ||||
|                 // select t1.* from table as t1 where t1.`dept_id` in (select `id` from `sys_dept` where `id` = xxx or | ||||
|                 // find_in_set(xxx, `ancestors`)); | ||||
|                 // 构建子查询 | ||||
|                 SubSelect subSelect = new SubSelect(); | ||||
|                 PlainSelect select = new PlainSelect(); | ||||
|                 select.setSelectItems(Collections.singletonList(new SelectExpressionItem(new Column(id)))); | ||||
|                 select.setFromItem(new Table(dataPermission.deptTableAlias())); | ||||
|                 EqualsTo equalsTo = new EqualsTo(); | ||||
|                 equalsTo.setLeftExpression(new Column(id)); | ||||
|                 equalsTo.setRightExpression(new LongValue(user.getDeptId())); | ||||
|                 Function function = new Function(); | ||||
|                 function.setName("find_in_set"); | ||||
|                 function.setParameters(new ExpressionList(new LongValue(user.getDeptId()), new Column("ancestors"))); | ||||
|                 select.setWhere(new OrExpression(equalsTo, function)); | ||||
|                 subSelect.setSelectBody(select); | ||||
|                 // 构建父查询 | ||||
|                 InExpression inExpression = new InExpression(); | ||||
|                 inExpression.setLeftExpression(this.buildColumn(tableAlias, deptId)); | ||||
|                 inExpression.setRightExpression(subSelect); | ||||
|                 expression = null != expression ? new OrExpression(expression, inExpression) : inExpression; | ||||
|             } else if (DataScopeEnum.DEPT.equals(dataScope)) { | ||||
|                 // select t1.* from table as t1 where t1.`dept_id` = xxx; | ||||
|                 EqualsTo equalsTo = new EqualsTo(); | ||||
|                 equalsTo.setLeftExpression(this.buildColumn(tableAlias, deptId)); | ||||
|                 equalsTo.setRightExpression(new LongValue(user.getDeptId())); | ||||
|                 expression = null != expression ? new OrExpression(expression, equalsTo) : equalsTo; | ||||
|             } else if (DataScopeEnum.SELF.equals(dataScope)) { | ||||
|                 // select t1.* from table as t1 where t1.`create_user` = xxx; | ||||
|                 EqualsTo equalsTo = new EqualsTo(); | ||||
|                 equalsTo.setLeftExpression(this.buildColumn(tableAlias, dataPermission.userId())); | ||||
|                 equalsTo.setRightExpression(new LongValue(user.getId())); | ||||
|                 expression = null != expression ? new OrExpression(expression, equalsTo) : equalsTo; | ||||
|             } else if (DataScopeEnum.CUSTOM.equals(dataScope)) { | ||||
|                 // select t1.* from table as t1 where t1.`dept_id` in (select `dept_id` from `sys_role_dept` where | ||||
|                 // `role_id` = xxx); | ||||
|                 // 构建子查询 | ||||
|                 SubSelect subSelect = new SubSelect(); | ||||
|                 PlainSelect select = new PlainSelect(); | ||||
|                 select.setSelectItems(Collections.singletonList(new SelectExpressionItem(new Column(deptId)))); | ||||
|                 select.setFromItem(new Table(dataPermission.roleDeptTableAlias())); | ||||
|                 EqualsTo equalsTo = new EqualsTo(); | ||||
|                 equalsTo.setLeftExpression(new Column(dataPermission.roleId())); | ||||
|                 equalsTo.setRightExpression(new LongValue(role.getId())); | ||||
|                 select.setWhere(equalsTo); | ||||
|                 subSelect.setSelectBody(select); | ||||
|                 // 构建父查询 | ||||
|                 InExpression inExpression = new InExpression(); | ||||
|                 inExpression.setLeftExpression(this.buildColumn(tableAlias, deptId)); | ||||
|                 inExpression.setRightExpression(subSelect); | ||||
|                 expression = null != expression ? new OrExpression(expression, inExpression) : inExpression; | ||||
|             } | ||||
|         } | ||||
|         return null != where ? new AndExpression(where, new Parenthesis(expression)) : expression; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 构建 Column | ||||
|      * | ||||
|      * @param tableAlias | ||||
|      *            表别名 | ||||
|      * @param columnName | ||||
|      *            字段名称 | ||||
|      * @return 带表别名字段 | ||||
|      */ | ||||
|     private Column buildColumn(String tableAlias, String columnName) { | ||||
|         if (StringUtils.isNotEmpty(tableAlias)) { | ||||
|             columnName = String.format("%s.%s", tableAlias, columnName); | ||||
|         } | ||||
|         return new Column(columnName); | ||||
|     } | ||||
| } | ||||
| @@ -14,7 +14,7 @@ | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| package top.charles7c.continew.admin.common.base; | ||||
| package top.charles7c.continew.admin.common.config.mybatis; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @@ -24,8 +24,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Constants; | ||||
| 
 | ||||
| import top.charles7c.continew.admin.common.annotation.DataPermission; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermission; | ||||
| 
 | ||||
| /** | ||||
|  * 数据权限 Mapper 基类 | ||||
| @@ -21,6 +21,8 @@ import org.springframework.context.annotation.Configuration; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter; | ||||
|  | ||||
| /** | ||||
|  * MyBatis Plus 配置 | ||||
|  * | ||||
| @@ -37,4 +39,12 @@ public class MybatisPlusConfiguration { | ||||
|     public MetaObjectHandler metaObjectHandler() { | ||||
|         return new MyBatisPlusMetaObjectHandler(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 数据权限过滤器 | ||||
|      */ | ||||
|     @Bean | ||||
|     public DataPermissionFilter dataPermissionFilter() { | ||||
|         return new DataPermissionFilterImpl(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,56 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.admin.common.model.dto; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * 系统日志上下文 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 2022/12/25 8:59 | ||||
|  */ | ||||
| @Data | ||||
| public class LogContext implements Serializable { | ||||
|  | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** | ||||
|      * 创建人 | ||||
|      */ | ||||
|     private Long createUser; | ||||
|  | ||||
|     /** | ||||
|      * 创建时间 | ||||
|      */ | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
|     /** | ||||
|      * 错误信息 | ||||
|      */ | ||||
|     private String errorMsg; | ||||
|  | ||||
|     /** | ||||
|      * 异常信息 | ||||
|      */ | ||||
|     private Throwable exception; | ||||
| } | ||||
| @@ -25,7 +25,7 @@ import top.charles7c.continew.admin.monitor.model.entity.LogDO; | ||||
| import top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp; | ||||
| import top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp; | ||||
| import top.charles7c.continew.admin.monitor.model.resp.DashboardTotalResp; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 系统日志 Mapper | ||||
|   | ||||
| @@ -29,8 +29,8 @@ import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import cn.hutool.core.date.DatePattern; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 登录日志查询条件 | ||||
|   | ||||
| @@ -29,8 +29,8 @@ import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import cn.hutool.core.date.DatePattern; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 操作日志查询条件 | ||||
|   | ||||
| @@ -29,8 +29,8 @@ import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import cn.hutool.core.date.DatePattern; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 系统日志查询条件 | ||||
|   | ||||
| @@ -42,7 +42,7 @@ import top.charles7c.continew.admin.monitor.service.LogService; | ||||
| import top.charles7c.continew.starter.core.util.ExceptionUtils; | ||||
| import top.charles7c.continew.starter.core.util.ReflectUtils; | ||||
| import top.charles7c.continew.starter.core.util.validate.CheckUtils; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper; | ||||
| import top.charles7c.continew.starter.extension.crud.base.CommonUserService; | ||||
| import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; | ||||
| import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; | ||||
|   | ||||
| @@ -20,7 +20,7 @@ import java.util.List; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.AnnouncementDO; | ||||
| import top.charles7c.continew.admin.system.model.resp.DashboardAnnouncementResp; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 公告 Mapper | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| package top.charles7c.continew.admin.system.mapper; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.DeptDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 部门 Mapper | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import top.charles7c.continew.admin.common.model.resp.LabelValueResp; | ||||
| import top.charles7c.continew.admin.system.model.entity.DictItemDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 字典项 Mapper | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| package top.charles7c.continew.admin.system.mapper; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.DictDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 字典 Mapper | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import java.util.Set; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.MenuDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 菜单 Mapper | ||||
|   | ||||
| @@ -24,7 +24,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.MessageDO; | ||||
| import top.charles7c.continew.admin.system.model.resp.MessageResp; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 消息 Mapper | ||||
|   | ||||
| @@ -19,7 +19,7 @@ package top.charles7c.continew.admin.system.mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.MessageUserDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 消息和用户 Mapper | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| package top.charles7c.continew.admin.system.mapper; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.OptionDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 参数 Mapper | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Param; | ||||
| import org.apache.ibatis.annotations.Select; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.RoleDeptDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 角色和部门 Mapper | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| package top.charles7c.continew.admin.system.mapper; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.RoleDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 角色 Mapper | ||||
|   | ||||
| @@ -19,7 +19,7 @@ package top.charles7c.continew.admin.system.mapper; | ||||
| import java.util.List; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.RoleMenuDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 角色和菜单 Mapper | ||||
|   | ||||
| @@ -19,7 +19,7 @@ package top.charles7c.continew.admin.system.mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
| import org.apache.ibatis.annotations.Select; | ||||
|  | ||||
| import top.charles7c.continew.admin.common.base.DataPermissionMapper; | ||||
| import top.charles7c.continew.admin.common.config.mybatis.DataPermissionMapper; | ||||
| import top.charles7c.continew.admin.system.model.entity.UserDO; | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Param; | ||||
| import org.apache.ibatis.annotations.Select; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.UserRoleDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 用户和角色 Mapper | ||||
|   | ||||
| @@ -19,7 +19,7 @@ package top.charles7c.continew.admin.system.mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.entity.UserSocialDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 用户社会化关联 Mapper | ||||
|   | ||||
| @@ -23,8 +23,8 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 公告查询条件 | ||||
|   | ||||
| @@ -23,8 +23,8 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 部门查询条件 | ||||
|   | ||||
| @@ -23,7 +23,7 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
|  | ||||
| /** | ||||
|  * 字典项查询条件 | ||||
|   | ||||
| @@ -23,7 +23,7 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
|  | ||||
| /** | ||||
|  * 字典查询条件 | ||||
|   | ||||
| @@ -23,8 +23,8 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 菜单查询条件 | ||||
|   | ||||
| @@ -22,8 +22,8 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 消息查询条件 | ||||
|   | ||||
| @@ -26,8 +26,8 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 参数查询条件 | ||||
|   | ||||
| @@ -23,7 +23,7 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
|  | ||||
| /** | ||||
|  * 角色查询条件 | ||||
|   | ||||
| @@ -29,8 +29,8 @@ import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import cn.hutool.core.date.DatePattern; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * 用户查询条件 | ||||
|   | ||||
| @@ -39,7 +39,7 @@ import top.charles7c.continew.admin.system.service.MessageService; | ||||
| import top.charles7c.continew.admin.system.service.MessageUserService; | ||||
| import top.charles7c.continew.starter.core.util.ExceptionUtils; | ||||
| import top.charles7c.continew.starter.core.util.validate.CheckUtils; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper; | ||||
| import top.charles7c.continew.starter.extension.crud.base.CommonUserService; | ||||
| import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; | ||||
| import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; | ||||
|   | ||||
| @@ -34,7 +34,7 @@ import top.charles7c.continew.admin.system.model.req.OptionReq; | ||||
| import top.charles7c.continew.admin.system.model.req.OptionResetValueReq; | ||||
| import top.charles7c.continew.admin.system.model.resp.OptionResp; | ||||
| import top.charles7c.continew.admin.system.service.OptionService; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper; | ||||
|  | ||||
| /** | ||||
|  * 参数业务实现 | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Param; | ||||
| import org.apache.ibatis.annotations.Select; | ||||
|  | ||||
| import top.charles7c.continew.admin.tool.model.entity.FieldConfigDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 字段配置 Mapper | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| package top.charles7c.continew.admin.tool.mapper; | ||||
|  | ||||
| import top.charles7c.continew.admin.tool.model.entity.GenConfigDO; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
|  | ||||
| /** | ||||
|  * 生成配置 Mapper | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package ${packageName}.${subPackageName}; | ||||
|  | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseMapper; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; | ||||
| import ${packageName}.model.entity.${classNamePrefix}DO; | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -16,8 +16,8 @@ import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.Query; | ||||
| import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; | ||||
|  | ||||
| /** | ||||
|  * ${businessName}查询条件 | ||||
|   | ||||
| @@ -147,8 +147,9 @@ mybatis-plus: | ||||
|     enabled: true | ||||
|     # Mapper 接口扫描包配置 | ||||
|     mapper-package: ${project.base-package}.**.mapper | ||||
|     # 数据权限实现 | ||||
|     data-permission-handler-impl: top.charles7c.continew.admin.common.config.mybatis.DataPermissionHandlerImpl | ||||
|     # 数据权限配置 | ||||
|     data-permission: | ||||
|       enabled: true | ||||
|     # 分页插件配置 | ||||
|     pagination: | ||||
|       enabled: true | ||||
|   | ||||
		Reference in New Issue
	
	Block a user