资产授权
parent
1dcc48fe7e
commit
713d2335eb
|
@ -2,13 +2,7 @@
|
|||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractClassShouldStartWithAbstractNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidApacheBeanUtilsCopy" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
|
@ -63,6 +57,5 @@
|
|||
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
|
@ -22,6 +22,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
<!-- mybatis-plus-join 扩展 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -77,4 +77,5 @@ public class TableInfo extends BaseEntity {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.domain.req.AssetAuthorizationReq;
|
||||
import com.muyu.source.service.AssetAuthorizationService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
|
@ -11,10 +21,28 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @ Description:资产授权控制层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/asset")
|
||||
public class AssetAuthorizationController {
|
||||
|
||||
public AssetAuthorizationController() {
|
||||
log.info("forest扫描路径:{}",
|
||||
ForestScannerRegister.getBasePackages());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AssetAuthorizationService assetAuthorizationService;
|
||||
|
||||
/**
|
||||
* 查询用户id列表
|
||||
* @param assetAuthorizationReq 查询条件
|
||||
* @return Result
|
||||
*/
|
||||
@PostMapping("/findUserIdList")
|
||||
public Result findUserIdList(@RequestBody AssetAuthorizationReq assetAuthorizationReq){
|
||||
List<Long> list = assetAuthorizationService.findUserIdList(assetAuthorizationReq);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,61 +2,202 @@ package com.muyu.source.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.dtflys.forest.annotation.NotNull;
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.domain.Structure;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.source.domain.AssetAuthorization;
|
||||
import com.muyu.source.domain.TableInfo;
|
||||
import com.muyu.source.domain.rep.TableInfoRep;
|
||||
import com.muyu.source.domain.rep.TableInfoResp;
|
||||
import com.muyu.source.domain.rep.TableInfoTreeRep;
|
||||
import com.muyu.source.service.StructureService;
|
||||
import com.muyu.source.service.AssetAuthorizationService;
|
||||
import com.muyu.source.service.TableInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/tableInfo")
|
||||
|
||||
public class TableInfoController {
|
||||
public TableInfoController() {
|
||||
log.info("forest扫描路径:{}",
|
||||
ForestScannerRegister.getBasePackages());
|
||||
}
|
||||
@Autowired
|
||||
private TableInfoService tableInfoService;
|
||||
@Autowired
|
||||
private StructureService structureService;
|
||||
private AssetAuthorizationService assetAuthorizationService;
|
||||
|
||||
@GetMapping("/findTableInfo")
|
||||
public Result<List<TableInfoTreeRep>> findTableInfo() {
|
||||
List<TableInfo> tableInfoList= tableInfoService.findSourceList();
|
||||
|
||||
List<TableInfoTreeRep> tableInfoTreeReps = new ArrayList<TableInfoTreeRep>();
|
||||
|
||||
for (TableInfo tableInfo : tableInfoList) {
|
||||
TableInfoTreeRep tableInfoTreeRep = new TableInfoTreeRep();
|
||||
tableInfoTreeRep.setTableInfo(tableInfo);
|
||||
List<TableInfoRep> tableInfoRepList= tableInfoService.findTablesList(tableInfo.getId());
|
||||
tableInfoTreeRep.setChildren(tableInfoRepList);
|
||||
for (TableInfoRep tableInfoRep : tableInfoRepList) {
|
||||
List<Structure> structureList=structureService.findStructureList(tableInfoRep.getId());
|
||||
tableInfoRep.setStructureList(structureList);
|
||||
}
|
||||
tableInfoTreeReps.add(tableInfoTreeRep);
|
||||
}
|
||||
|
||||
return Result.success(tableInfoTreeReps);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/findTableInfoList")
|
||||
public Result findByTableName() {
|
||||
/**
|
||||
* 查询资产信息
|
||||
* @return 查询的结果
|
||||
*/
|
||||
@GetMapping("/findAsset")
|
||||
public Result findAsset() {
|
||||
// 从tableInfoService中获取所有的TableInfo对象列表
|
||||
List<TableInfo> list = tableInfoService.list();
|
||||
List<TableInfoResp> respList = list.stream().filter(tableInfo -> tableInfo.getParentId()==0).map(tableInfo -> {
|
||||
TableInfoResp tableInfoResp = TableInfo.toTableInfoResp(tableInfo);
|
||||
tableInfoResp.setChildren(getChildren(tableInfo, list));
|
||||
return tableInfoResp;
|
||||
}).toList();
|
||||
// 使用Java 8的Stream API对list进行处理
|
||||
List<TableInfoResp> respList = list.stream()
|
||||
// 过滤出parentId为0的TableInfo对象,即顶层资产
|
||||
.filter(tableInfo -> tableInfo.getParentId() == 0)
|
||||
// 将过滤后的TableInfo对象转换为TableInfoResp对象,并设置其子资产
|
||||
.map(tableInfo -> {
|
||||
// 将TableInfo对象转换为TableInfoResp对象
|
||||
TableInfoResp tableInfoResp = TableInfo.toTableInfoResp(tableInfo);
|
||||
// 调用getAssetChildren方法获取当前资产的子资产列表,并设置到tableInfoResp对象中
|
||||
tableInfoResp.setChildren(getAssetChildren(tableInfo, list));
|
||||
// 返回处理后的tableInfoResp对象
|
||||
return tableInfoResp;
|
||||
})
|
||||
// 将处理后的对象收集到一个新的列表中
|
||||
.toList();
|
||||
// 返回一个包含处理后的TableInfoResp列表的成功结果
|
||||
return Result.success(respList);
|
||||
}
|
||||
|
||||
|
||||
// 获取指定表信息的子表信息列表
|
||||
private List<TableInfoResp> getAssetChildren(TableInfo tableInfo, List<TableInfo> list) {
|
||||
// 使用Java 8的Stream API对传入的list进行处理
|
||||
return list.stream()
|
||||
// 过滤出所有父ID等于传入tableInfo的ID的表信息
|
||||
.filter(tableInfo1 -> tableInfo1.getParentId().equals(tableInfo.getId()))
|
||||
// 将过滤后的表信息转换为TableInfoResp对象
|
||||
.map(tableInfo2 -> TableInfo.toTableInfoResp(tableInfo2))
|
||||
// 将转换后的对象收集到一个新的List中并返回
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询授权表信息
|
||||
* @return 查询的结果
|
||||
*/
|
||||
@GetMapping("findAssetByTableName")
|
||||
public Result findAsserByTableName(){
|
||||
// 从tableInfoService中获取所有的TableInfo对象列表
|
||||
List<TableInfo> list = tableInfoService.list();
|
||||
// 获取当前登录用户的信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// 从登录用户信息中获取SysUser对象
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
// 获取用户的ID
|
||||
Long userId = sysUser.getUserId();
|
||||
// 获取用户的部门ID
|
||||
Long deptId = sysUser.getDeptId();
|
||||
// 根据用户ID查询授权的表ID和基本信息
|
||||
List<AssetAuthorization> idByUserId = assetAuthorizationService.findTableIdAndBasicIdByUserId(userId);
|
||||
// 根据部门ID查询授权的表ID和基本信息
|
||||
List<AssetAuthorization> idByDeptId = assetAuthorizationService.findTableIdAndBasicIdByDeptId(deptId);
|
||||
// 创建一个HashSet用于存储授权的表信息
|
||||
HashSet<TableInfo> hashSet = new HashSet<>();
|
||||
// 将用户ID授权的表信息添加到hashSet中
|
||||
extracted(idByUserId, hashSet);
|
||||
// 将部门ID授权的表信息添加到hashSet中
|
||||
extracted(idByDeptId, hashSet);
|
||||
// 将hashSet中的表信息转换为TableInfoResp对象列表
|
||||
List<TableInfoResp> respList = getTableInfoResps(list);
|
||||
|
||||
// 返回成功的结果,包含转换后的TableInfoResp对象列表
|
||||
return Result.success(respList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据库/表
|
||||
* @return 查询的结果
|
||||
*/
|
||||
@GetMapping("/selectSourceOrTable")
|
||||
@Operation(summary = "查询数据库或表" , description = "查查询数据库或表内容")
|
||||
public Result<List<TableInfoResp>> findByTableName() {
|
||||
// 调用tableInfoService的list方法,获取所有的TableInfo对象列表
|
||||
List<TableInfo> list = tableInfoService.list();
|
||||
// 调用getTableInfoResps方法,将TableInfo对象列表转换为TableInfoResp对象列表
|
||||
List<TableInfoResp> respList = getTableInfoResps(list);
|
||||
// 使用Result类的success方法创建一个成功的结果,并将转换后的TableInfoResp对象列表作为数据返回
|
||||
return Result.success(respList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提取授权信息
|
||||
* @param idByDeptId 授权信息
|
||||
* @param hashSet 授权信息
|
||||
*/
|
||||
private void extracted(List<AssetAuthorization> idByDeptId, HashSet<TableInfo> hashSet) {
|
||||
// 遍历AssetAuthorizationReq列表
|
||||
for (AssetAuthorization assetImpowerResp : idByDeptId) {
|
||||
// 获取当前AssetAuthorizationReq对象的basicId和tableId
|
||||
Long basicId = assetImpowerResp.getBasicId();
|
||||
Long tableId = assetImpowerResp.getTableId();
|
||||
|
||||
// 如果basicId不为空
|
||||
if(null!=basicId){
|
||||
// 创建一个LambdaQueryWrapper对象,用于构建查询条件
|
||||
LambdaQueryWrapper<TableInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 设置查询条件:根据basicId查找TableInfo对象
|
||||
queryWrapper.eq(TableInfo::getBasicId, basicId);
|
||||
// 使用tableInfoService的list方法,根据查询条件获取符合条件的TableInfo列表
|
||||
List<TableInfo> tableInfoBasicIdList = tableInfoService.list(queryWrapper);
|
||||
// 将查询到的TableInfo列表添加到hashSet中
|
||||
hashSet.addAll(tableInfoBasicIdList);
|
||||
}
|
||||
|
||||
// 如果tableId不为空
|
||||
if(null!=tableId){
|
||||
// 使用tableInfoService的getById方法,根据tableId获取对应的TableInfo对象
|
||||
TableInfo tableInfoById = tableInfoService.getById(tableId);
|
||||
// 将获取到的TableInfo对象添加到hashSet中
|
||||
hashSet.add(tableInfoById);
|
||||
// 获取当前TableInfo对象的parentId
|
||||
Long parentId = tableInfoById.getParentId();
|
||||
// 使用tableInfoService的getById方法,根据parentId获取对应的TableInfo对象
|
||||
TableInfo tableInfoByIdParentId = tableInfoService.getById(parentId);
|
||||
// 将获取到的父级TableInfo对象添加到hashSet中
|
||||
hashSet.add(tableInfoByIdParentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子元素列表
|
||||
* @param list 列表
|
||||
* @return 列表
|
||||
*/
|
||||
@NotNull
|
||||
private static List<TableInfoResp> getTableInfoResps(List<TableInfo> list) {
|
||||
// 使用Java 8的Stream API对输入的list进行处理
|
||||
List<TableInfoResp> respList = list.stream()
|
||||
// 过滤出parentId为0的元素,即顶级元素
|
||||
.filter(tableInfo -> tableInfo.getParentId() == 0)
|
||||
// 对每个符合条件的元素进行映射操作
|
||||
.map(tableInfo -> {
|
||||
// 将TableInfo对象转换为TableInfoResp对象
|
||||
TableInfoResp tableInfoResp = TableInfo.toTableInfoResp(tableInfo);
|
||||
// 设置子元素列表,通过调用getChildren方法获取子元素
|
||||
tableInfoResp.setChildren(getChildren(tableInfo, list));
|
||||
// 返回处理后的TableInfoResp对象
|
||||
return tableInfoResp;
|
||||
})
|
||||
// 将流中的元素收集到一个新的列表中
|
||||
.toList();
|
||||
// 返回处理后的列表
|
||||
return respList;
|
||||
}
|
||||
/**
|
||||
* 获取子元素列表
|
||||
* @param tableInfo 当前元素
|
||||
* @param list 列表
|
||||
* @return 列表
|
||||
*/
|
||||
@NotNull
|
||||
private static List<TableInfoResp> getChildren(TableInfo tableInfo, List<TableInfo> list) {
|
||||
return list.stream().filter(tableInfo1 -> tableInfo1.getParentId().equals(tableInfo.getId())).map(
|
||||
|
@ -65,20 +206,27 @@ public class TableInfoController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 查询数据库表结构中的表名,表注释,数据量
|
||||
* @return
|
||||
* 根据id查询数据集
|
||||
* @param id id
|
||||
* @return 查询的结果
|
||||
*/
|
||||
@GetMapping("/selectColumn")
|
||||
public Result<List<TableInfo>> selectColumn() {
|
||||
List<TableInfo> list = tableInfoService.list(new LambdaQueryWrapper<>() {{
|
||||
select(TableInfo::getTableName, TableInfo::getTableRemark, TableInfo::getDataNum);
|
||||
}});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/findTableName")
|
||||
public Result findTableName(@RequestParam("id") Long id) {
|
||||
@Operation(summary = "根据id查询数据集" , description = "根据id查询数据集")
|
||||
public Result<TableInfo> findTableName(@RequestParam("id") Long id) {
|
||||
TableInfo byId = tableInfoService.getById(id);
|
||||
return Result.success(byId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询数据集
|
||||
* @param id id
|
||||
* @return 查询的结果
|
||||
* 联调的时候任务模块调用这个
|
||||
*/
|
||||
@PostMapping("/findTableById/{id}")
|
||||
@Operation(summary = "根据id查询数据集" , description = "根据id查询数据集")
|
||||
public Result<List<TableInfo>> findTableById(@PathVariable("id") Long id) {
|
||||
List<TableInfo> list =tableInfoService.findTableNameById(id);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-02-15:30
|
||||
* @ Version:1.0
|
||||
* @ Description:用户控制层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@RestController
|
||||
public class UserController {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.source.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-02-15:30
|
||||
* @ Version:1.0
|
||||
* @ Description:用户持久层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<SysUser> {
|
||||
}
|
|
@ -2,6 +2,10 @@ package com.muyu.source.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.source.domain.AssetAuthorization;
|
||||
import com.muyu.source.domain.rep.AssetAuthorizationRep;
|
||||
import com.muyu.source.domain.req.AssetAuthorizationReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
|
@ -13,5 +17,20 @@ import com.muyu.source.domain.AssetAuthorization;
|
|||
*/
|
||||
public interface AssetAuthorizationService extends IService<AssetAuthorization> {
|
||||
|
||||
/**
|
||||
* 查询授权的表ID和基本信息
|
||||
* @param userId 用户ID
|
||||
* @return 授权的表ID和基本信息
|
||||
*/
|
||||
List<AssetAuthorization> findTableIdAndBasicIdByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询授权的表ID和基本信息
|
||||
* @param deptId 部门ID
|
||||
* @return 授权的表ID和基本信息
|
||||
*/
|
||||
List<AssetAuthorization> findTableIdAndBasicIdByDeptId(Long deptId);
|
||||
|
||||
List<Long> findUserIdList(AssetAuthorizationReq assetAuthorizationReq);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
package com.muyu.source.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.source.domain.AssetAuthorization;
|
||||
import com.muyu.source.domain.rep.AssetAuthorizationRep;
|
||||
import com.muyu.source.domain.req.AssetAuthorizationReq;
|
||||
import com.muyu.source.mapper.AssetAuthorizationMapper;
|
||||
import com.muyu.source.mapper.UserMapper;
|
||||
import com.muyu.source.service.AssetAuthorizationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
|
@ -17,6 +27,54 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class AssetAuthorizationServiceImpl extends ServiceImpl<AssetAuthorizationMapper, AssetAuthorization> implements AssetAuthorizationService {
|
||||
|
||||
@Autowired
|
||||
private AssetAuthorizationMapper assetAuthorizationMapper;
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询授权的表ID和基本信息
|
||||
* @param userId 用户ID
|
||||
* @return 授权的表ID和基本信息
|
||||
*/
|
||||
@Override
|
||||
public List<AssetAuthorization> findTableIdAndBasicIdByUserId(Long userId) {
|
||||
return assetAuthorizationMapper.selectList(new LambdaQueryWrapper<>() {{
|
||||
eq(AssetAuthorization::getUserId, userId);
|
||||
}});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门ID查询授权的表ID和基本信息
|
||||
* @param deptId 部门ID
|
||||
* @return 授权的表ID和基本信息
|
||||
*/
|
||||
@Override
|
||||
public List<AssetAuthorization> findTableIdAndBasicIdByDeptId(Long deptId) {
|
||||
return assetAuthorizationMapper.selectList(new LambdaQueryWrapper<>() {{
|
||||
eq(AssetAuthorization::getDeptId, deptId);
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> findUserIdList(AssetAuthorizationReq assetAuthorizationReq) {
|
||||
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
||||
Long tableId = assetAuthorizationReq.getTableId();
|
||||
Long basicId = assetAuthorizationReq.getBasicId();
|
||||
if (tableId != null) {
|
||||
queryWrapper.eq("aa.table_id", tableId);
|
||||
}
|
||||
if (basicId != null) {
|
||||
queryWrapper.eq("aa.basic_id", basicId);
|
||||
}
|
||||
return userMapper.selectList(queryWrapper)
|
||||
.stream()
|
||||
.map(SysUser::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,28 +35,9 @@ public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> im
|
|||
return this.tableInfoMapper.selectOne(tableInfoLambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableInfo> findSourceList() {
|
||||
List<TableInfo> tableInfoList = tableInfoMapper.selectList(new LambdaQueryWrapper<TableInfo>(TableInfo.class)
|
||||
.eq(TableInfo::getParentId, 0));
|
||||
|
||||
return tableInfoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableInfoRep> findTablesList(Long id) {
|
||||
List<TableInfo> tableInfoList = tableInfoMapper.selectList(new LambdaQueryWrapper<TableInfo>(TableInfo.class).eq(
|
||||
TableInfo::getParentId, id
|
||||
));
|
||||
|
||||
List<TableInfoRep> tableInfoRepList = new ArrayList<>();
|
||||
for (TableInfo tableInfo : tableInfoList) {
|
||||
TableInfoRep tableInfoRep = TableInfo.tableInfoRep(tableInfo);
|
||||
tableInfoRepList.add(tableInfoRep);
|
||||
}
|
||||
|
||||
return tableInfoRepList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Structure> selectTableInfoById(Integer id) {
|
||||
|
@ -66,5 +47,10 @@ public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> im
|
|||
return structureList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableInfo> findTableNameById(Long id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.source.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.source.mapper.UserMapper;
|
||||
import com.muyu.source.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-02-15:32
|
||||
* @ Version:1.0
|
||||
* @ Description:用户业务实现层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, SysUser> implements UserService {
|
||||
}
|
|
@ -12,11 +12,8 @@ public interface TableInfoService extends IService<TableInfo> {
|
|||
|
||||
TableInfo selectTableInfoByName(TableInfo tableInfoInsert);
|
||||
|
||||
List<TableInfo> findSourceList();
|
||||
|
||||
List<TableInfoRep> findTablesList(Long id);
|
||||
|
||||
List<Structure> selectTableInfoById(Integer id);
|
||||
|
||||
|
||||
List<TableInfo> findTableNameById(Long id);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.source.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-02-15:31
|
||||
* @ Version:1.0
|
||||
* @ Description:用户业务层
|
||||
* @author Lenovo
|
||||
*/
|
||||
public interface UserService extends IService<SysUser> {
|
||||
}
|
Loading…
Reference in New Issue