mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	chore: continew-starter 2.6.0 => 2.7.0
移除多数据源(有需要自行引入) 引入数据权限组件(独立出来) 调整包名及其他命名调整
This commit is contained in:
		| @@ -24,7 +24,7 @@ import org.apache.ibatis.annotations.Select; | ||||
| import top.continew.admin.common.config.mybatis.DataPermissionMapper; | ||||
| import top.continew.admin.system.model.entity.UserDO; | ||||
| import top.continew.admin.system.model.resp.UserDetailResp; | ||||
| import top.continew.starter.data.mp.datapermission.DataPermission; | ||||
| import top.continew.starter.extension.datapermission.annotation.DataPermission; | ||||
| import top.continew.starter.security.crypto.annotation.FieldEncrypt; | ||||
|  | ||||
| import java.util.List; | ||||
| @@ -97,6 +97,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|      * 根据邮箱查询数量 | ||||
|      * | ||||
|      * @param email 邮箱 | ||||
|      * @param id    ID | ||||
|      * @return 用户数量 | ||||
|      */ | ||||
|     Long selectCountByEmail(@FieldEncrypt @Param("email") String email, @Param("id") Long id); | ||||
| @@ -105,6 +106,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|      * 根据手机号查询数量 | ||||
|      * | ||||
|      * @param phone 手机号 | ||||
|      * @param id    ID | ||||
|      * @return 用户数量 | ||||
|      */ | ||||
|     Long selectCountByPhone(@FieldEncrypt @Param("phone") String phone, @Param("id") Long id); | ||||
|   | ||||
| @@ -18,8 +18,6 @@ package top.continew.admin.system.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.ObjectUtil; | ||||
| import cn.hutool.extra.spring.SpringUtil; | ||||
| import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import jakarta.annotation.Resource; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| @@ -38,7 +36,11 @@ import top.continew.starter.data.core.enums.DatabaseType; | ||||
| import top.continew.starter.data.core.util.MetaUtils; | ||||
| import top.continew.starter.extension.crud.service.impl.BaseServiceImpl; | ||||
|  | ||||
| import java.util.*; | ||||
| import javax.sql.DataSource; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
|  | ||||
| /** | ||||
|  * 部门业务实现 | ||||
| @@ -53,11 +55,12 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|     @Resource | ||||
|     private UserService userService; | ||||
|     private final RoleDeptService roleDeptService; | ||||
|     @Resource | ||||
|     private DataSource dataSource; | ||||
|  | ||||
|     @Override | ||||
|     public List<DeptDO> listChildren(Long id) { | ||||
|         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(SpringUtil | ||||
|             .getBean(DynamicRoutingDataSource.class), DatabaseType.MYSQL); | ||||
|         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(dataSource, DatabaseType.MYSQL); | ||||
|         return baseMapper.lambdaQuery().apply(databaseType.findInSet(id, "ancestors")).list(); | ||||
|     } | ||||
|  | ||||
| @@ -184,8 +187,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | ||||
|         if (CollUtil.isEmpty(ids)) { | ||||
|             return 0L; | ||||
|         } | ||||
|         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(SpringUtil | ||||
|             .getBean(DynamicRoutingDataSource.class), DatabaseType.MYSQL); | ||||
|         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(dataSource, DatabaseType.MYSQL); | ||||
|         return ids.stream() | ||||
|             .mapToLong(id -> baseMapper.lambdaQuery().apply(databaseType.findInSet(id, "ancestors")).count()) | ||||
|             .sum(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user