Browse Source

[feat]提交:修改图层管理查询①

pull/7/head
杨威 2 weeks ago
parent
commit
9267b2b48f
  1. 2
      dk-api/api-system/src/main/java/org/dromara/system/api/RemoteDeptService.java
  2. 8
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessLayerController.java
  3. 3
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessLayerVo.java
  4. 25
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessLayerServiceImpl.java
  5. 7
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteDeptServiceImpl.java
  6. 2
      dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java
  7. 2
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java
  8. 5
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java
  9. 5
      dk-modules/system/src/main/java/org/dromara/system/utils/KmzParserUtil.java
  10. 30
      dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml

2
dk-api/api-system/src/main/java/org/dromara/system/api/RemoteDeptService.java

@ -29,4 +29,6 @@ public interface RemoteDeptService {
List<RemoteDeptVo> selectListByParentId(String deptId);
RemoteDeptVo getByParentId(String deptId);
List<RemoteDeptVo> listTreeDeptByChild(Long deptId);
}

8
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessLayerController.java

@ -38,7 +38,7 @@ public class BusinessLayerController extends BaseController {
* 图层模块列表
*/
@Operation(summary ="图层模块列表",description = "图层模块列表")
@SaCheckPermission("business:layer:list")
// @SaCheckPermission("business:layer:list")
@GetMapping("/list")
public R<TableDataInfo<BusinessLayerVo>> list(BusinessLayerBo bo, PageQuery pageQuery) {
return R.ok(businessLayerService.queryPageList(bo, pageQuery));
@ -54,7 +54,7 @@ public class BusinessLayerController extends BaseController {
* 图层新增
*/
@Operation(summary ="图层新增",description = "图层新增")
@SaCheckPermission("business:layer:add")
// @SaCheckPermission("business:layer:add")
@Log(title = "图层新增", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
@ -65,7 +65,7 @@ public class BusinessLayerController extends BaseController {
/**
* 图层修改
*/
@SaCheckPermission("business:layer:edit")
// @SaCheckPermission("business:layer:edit")
@Operation(summary ="图层修改",description = "图层修改")
@Log(title = "图层修改", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@ -79,7 +79,7 @@ public class BusinessLayerController extends BaseController {
*
* @param id 主键
*/
@SaCheckPermission("business:task:remove")
// @SaCheckPermission("business:task:remove")
@Operation(summary ="图层删除",description = "图层删除")
@Log(title = "图层删除", businessType = BusinessType.DELETE)
@GetMapping("/delete")

3
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessLayerVo.java

@ -70,4 +70,7 @@ public class BusinessLayerVo {
private List<BusinessLayerVo> children;
//用于前端回显
private List<Long> deptIdList;
}

25
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessLayerServiceImpl.java

@ -20,10 +20,7 @@ import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Slf4j
@ -33,7 +30,7 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService {
private final BusinessLayerMapper baseMapper;
@DubboReference
@DubboReference(timeout = 30000)
RemoteDeptService remoteDeptService;
@Override
@ -41,10 +38,16 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService {
Page<BusinessLayerVo> result = baseMapper.queryPageList(pageQuery.build(), bo);
result.getRecords().forEach(businessLayerVo -> {
List<RemoteDeptVo> deptList = remoteDeptService.listTreeDeptByChild(businessLayerVo.getDeptId());
LinkedList<Long> deptIdList = new LinkedList<>();
deptList.forEach(deptVo -> {
deptIdList.add(deptVo.getDeptId());
});
List<BusinessLayerVo> layerVoList = baseMapper.selectInfoByParent(businessLayerVo.getId());
businessLayerVo.setChildren(buildTree(layerVoList,businessLayerVo.getId()));
businessLayerVo.setDeptIdList(deptIdList);
});
return TableDataInfo.build(result);
@ -101,7 +104,7 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService {
* @param allNodes
* @return
*/
public static List<BusinessLayerVo> buildTree(List<BusinessLayerVo> allNodes, Long parentId) {
public List<BusinessLayerVo> buildTree(List<BusinessLayerVo> allNodes, Long parentId) {
// 创建一个Map来存储所有节点,键为ID,值为节点
Map<Long, BusinessLayerVo> nodeMap = new HashMap<>();
for (BusinessLayerVo node : allNodes) {
@ -113,6 +116,14 @@ public class BusinessLayerServiceImpl implements IBusinessLayerService {
// 遍历所有节点,将子节点添加到父节点的 children 列表中
for (BusinessLayerVo node : allNodes) {
List<RemoteDeptVo> deptList = remoteDeptService.listTreeDeptByChild(node.getDeptId());
LinkedList<Long> deptIdList = new LinkedList<>();
deptList.forEach(deptVo -> {
deptIdList.add(deptVo.getDeptId());
});
node.setDeptIdList(deptIdList);
if (node.getParentId().equals(parentId)) {
rootNodes.add(node); // 当前节点的 parentId 与传入的 parentId 匹配,作为根节点
} else {

7
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteDeptServiceImpl.java

@ -66,4 +66,11 @@ public class RemoteDeptServiceImpl implements RemoteDeptService {
SysDeptVo sysDeptVo = sysDeptService.getByParentId(deptId);
return BeanUtil.copyProperties(sysDeptVo, RemoteDeptVo.class);
}
@Override
public List<RemoteDeptVo> listTreeDeptByChild(Long deptId) {
List<SysDeptVo> deptVoList = sysDeptService.listTreeDeptByChild(deptId);
return BeanUtil.copyToList(deptVoList, RemoteDeptVo.class);
}
}

2
dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java

@ -74,4 +74,6 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
List<Map<String,Object>> getNamePathList(@Param("deptId") Long deptId);
List<SysDeptVo> listTreeDept(@Param("deptId") Long deptId, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);
List<SysDeptVo> listTreeDeptByChild(@Param("deptId") Long deptId);
}

2
dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java

@ -160,4 +160,6 @@ public interface ISysDeptService {
List<SysDeptVo> listTreeDept(Long deptId);
SysDept addBoundaryDept(SysDeptBo sysDeptBo);
List<SysDeptVo> listTreeDeptByChild(Long deptId);
}

5
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@ -407,4 +407,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
return dept;
}
@Override
public List<SysDeptVo> listTreeDeptByChild(Long deptId) {
return baseMapper.listTreeDeptByChild(deptId); //.getTableCloud()
}
}

5
dk-modules/system/src/main/java/org/dromara/system/utils/KmzParserUtil.java

@ -1,5 +1,6 @@
package org.dromara.system.utils;
import cn.hutool.core.util.ObjectUtil;
import org.dromara.system.domain.kmz.KmzResult;
import org.dromara.system.domain.kmz.Placemark;
@ -121,7 +122,9 @@ public class KmzParserUtil {
for (String coords : currentCoordinates) {
Placemark newPlacemark = new Placemark();
newPlacemark.setName(currentPlacemark.getName());
newPlacemark.setAttributes(new HashMap<>(currentPlacemark.getAttributes()));
if (ObjectUtil.isNotEmpty(currentPlacemark.getAttributes())){
newPlacemark.setAttributes(new HashMap<>(currentPlacemark.getAttributes()));
}
newPlacemark.setCoordinates(coords);
placemarks.add(newPlacemark);
}

30
dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -112,4 +112,34 @@
)select * from warning_summary
</select>
<select id="listTreeDeptByChild" resultType="org.dromara.system.domain.vo.SysDeptVo">
WITH RECURSIVE warning_summary AS (
-- 基础查询:选择当前部门的信息
SELECT
sd1.dept_id,
sd1.dept_name,
sd1.parent_id
FROM
sys_dept sd1
WHERE
sd1.dept_id = #{deptId} -- 这里指定了需要查询的部门ID
UNION ALL
-- 递归查询:找到当前部门的上级部门
SELECT
sd2.dept_id,
sd2.dept_name,
sd2.parent_id
FROM
sys_dept sd2
JOIN warning_summary pd ON sd2.dept_id = pd.parent_id -- 找到上级部门
)
-- 返回所有上级部门信息
SELECT *
FROM warning_summary;
</select>
</mapper>

Loading…
Cancel
Save