Browse Source

[feat]提交修改部门区域逻辑

pull/7/head
杨威 2 weeks ago
parent
commit
55b3f1676c
  1. 2
      dk-api/api-system/src/main/java/org/dromara/system/api/RemoteDeptService.java
  2. 5
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessLayer.java
  3. 8
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessLayerBo.java
  4. 7
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessLayerVo.java
  5. 1
      dk-modules/business/src/main/resources/mapper/business/BusinessLayerMapper.xml
  6. 29
      dk-modules/system/src/main/java/org/dromara/system/controller/system/SysDepartBoundaryController.java
  7. 39
      dk-modules/system/src/main/java/org/dromara/system/domain/SysDepartBoundary.java
  8. 4
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteDeptServiceImpl.java
  9. 2
      dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java
  10. 2
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDepartBoundaryService.java
  11. 5
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java
  12. 50
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java
  13. 19
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java
  14. 21
      dk-modules/system/src/main/resources/mapper/system/SysDepartBoundaryMapper.xml
  15. 16
      dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml

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

@ -24,7 +24,7 @@ public interface RemoteDeptService {
RemoteDeptVo selectDeptById(Long deptId); RemoteDeptVo selectDeptById(Long deptId);
List<Map<String,Object>> getNamePathList(); List<Map<String,Object>> getNamePathList(Long deptId);
List<RemoteDeptVo> selectListByParentId(String deptId); List<RemoteDeptVo> selectListByParentId(String deptId);

5
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessLayer.java

@ -42,6 +42,11 @@ public class BusinessLayer {
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "layerType", other = "layer_type") @Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "layerType", other = "layer_type")
private String layerTypeName; private String layerTypeName;
/**
* 图层url
*/
private String layerUrl;
//租户id //租户id
private String tenantId; private String tenantId;
//部门id //部门id

8
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessLayerBo.java

@ -37,9 +37,17 @@ public class BusinessLayerBo {
* */ * */
private Date createTime; private Date createTime;
/**
* 0目录 1地址
*/
@NotNull(message = "图层类型不能为空", groups = { AddGroup.class}) @NotNull(message = "图层类型不能为空", groups = { AddGroup.class})
private Integer layerType; private Integer layerType;
/**
* 图层url
*/
private String layerUrl;
private String tenantId; private String tenantId;
@NotNull(message = "部门id不能为空", groups = { AddGroup.class}) @NotNull(message = "部门id不能为空", groups = { AddGroup.class})
private Long deptId; private Long deptId;

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

@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.dromara.business.domain.BusinessLayer; import org.dromara.business.domain.BusinessLayer;
import org.dromara.business.domain.BusinessTask; import org.dromara.business.domain.BusinessTask;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.translation.annotation.Translation; import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant; import org.dromara.common.translation.constant.TransConstant;
@ -44,6 +46,11 @@ public class BusinessLayerVo {
private String tenantId; private String tenantId;
private Long deptId; private Long deptId;
/**
* 图层url
*/
private String layerUrl;
private String deptName; private String deptName;
private String remark; private String remark;

1
dk-modules/business/src/main/resources/mapper/business/BusinessLayerMapper.xml

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t.enable, t.enable,
t.remark, t.remark,
t.layer_type as layerType, t.layer_type as layerType,
t.layer_url as layerUrl,
t.dept_id as deptId, t.dept_id as deptId,
t.dept_name AS deptName, t.dept_name AS deptName,
t.tenant_id as tenantId, t.tenant_id as tenantId,

29
dk-modules/system/src/main/java/org/dromara/system/controller/system/SysDepartBoundaryController.java

@ -5,19 +5,17 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.SysDepartBoundary ;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.SysDepartBoundary;
import org.dromara.system.domain.bo.SysDepartBoundaryBo; import org.dromara.system.domain.bo.SysDepartBoundaryBo;
import org.dromara.system.service.ISysDepartBoundaryService; import org.dromara.system.service.ISysDepartBoundaryService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 部门区域 * 部门区域
@ -40,7 +38,6 @@ public class SysDepartBoundaryController extends BaseController {
@Operation(summary ="查询部门的地理位置",description = "查询部门的地理位置") @Operation(summary ="查询部门的地理位置",description = "查询部门的地理位置")
@GetMapping(value = "/listJson") @GetMapping(value = "/listJson")
public R<List<SysDepartBoundaryBo>> listJson(SysDepartBoundary departBoundary) { public R<List<SysDepartBoundaryBo>> listJson(SysDepartBoundary departBoundary) {
// departBoundary.setDeptId(String.valueOf(LoginHelper.getDeptId()));
List<SysDepartBoundaryBo> listJson = departBoundaryService.listJson(departBoundary); List<SysDepartBoundaryBo> listJson = departBoundaryService.listJson(departBoundary);
return R.ok("查询成功!",listJson); return R.ok("查询成功!",listJson);
} }
@ -61,22 +58,12 @@ public class SysDepartBoundaryController extends BaseController {
* 解析shp文件 * 解析shp文件
* @return * @return
*/ */
@Operation(summary ="批量新增部门区域",description = "批量新增部门区域") @Operation(summary ="新增部门区域",description = "新增部门区域(areaType: 0:市级 1:区级(县) 2:镇级(街道) 3:村级)")
@RequestMapping(value = "/upload", method = RequestMethod.POST) @RequestMapping(value = "/upload", method = RequestMethod.POST)
public R<Void> uploadShpFile(@RequestParam("file") MultipartFile file,@RequestParam("areaType") Integer areaType) { public R<Void> uploadShpFile(@RequestParam("file") MultipartFile file,
return toAjax(departBoundaryService.uploadShpFile(file,areaType)); @RequestParam("areaType") Integer areaType,
} @RequestParam("parentId") Long parentId) {
return toAjax(departBoundaryService.uploadShpFile(file,areaType,parentId));
/**
* 编辑
*
* @param
* @return
*/
@Operation(summary ="编辑部门区域",description = "编辑部门区域")
@RequestMapping(value = "/update", method = RequestMethod.POST)
public R<Void> updateDepartBoundary(@RequestBody SysDepartBoundary departBoundary) {
return toAjax(departBoundaryService.updateDepartBoundary(departBoundary));
} }
@ -91,8 +78,4 @@ public class SysDepartBoundaryController extends BaseController {
public R<Void> deleteDepartBoundary(@RequestParam(name = "id") String id) { public R<Void> deleteDepartBoundary(@RequestParam(name = "id") String id) {
return toAjax(departBoundaryService.deleteDepartBoundary(id)); return toAjax(departBoundaryService.deleteDepartBoundary(id));
} }
} }

39
dk-modules/system/src/main/java/org/dromara/system/domain/SysDepartBoundary.java

@ -25,53 +25,24 @@ public class SysDepartBoundary extends BaseEntity {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private String id; private String id;
/**
* 租户Id
*/
private String tenantId;
/**机构ID*/ /**机构ID*/
private String deptId; private Long deptId;
/**机构/部门名称*/ /**机构/部门名称*/
private String deptName; private String deptName;
/**是否显示0显示,1不显示*/ /**部门全路径*/
private Integer type; private String namePath;
/**边界*/
private String communityName;
/**边界*/ /**边界*/
private String boundary; private String boundary;
/** /**
* 周长 * 区域类别 areaType: 0市级 1区级() 2镇级(街道) 3村级
*/
private Double perimeter;
/**
* 面积平方公里
*/
private Double area;
/**
* 面积亩
*/
private Double areaMu;
/**
* 编号
*/
private String shpNo;
/**
* 区域类别
*/ */
private Integer areaType; private Integer areaType;
/**删除状态(0,正常,1已删除)*/ /**删除状态(0,正常,1已删除)*/
private String delFlag; private String delFlag;
private List<String> deptIds;
} }

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

@ -50,8 +50,8 @@ public class RemoteDeptServiceImpl implements RemoteDeptService {
} }
@Override @Override
public List<Map<String,Object>> getNamePathList() { public List<Map<String,Object>> getNamePathList(Long deptId) {
return sysDeptService.getNamePathList(); return sysDeptService.getNamePathList(deptId);
} }
@Override @Override

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

@ -71,7 +71,7 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
}) })
Page<SysDeptVo> selectPageDeptList(@Param("page") Page<SysDeptVo> page, @Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper); Page<SysDeptVo> selectPageDeptList(@Param("page") Page<SysDeptVo> page, @Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
List<Map<String,Object>> getNamePathList(); List<Map<String,Object>> getNamePathList(@Param("deptId") Long deptId);
List<SysDeptVo> listTreeDept(@Param("deptId") Long deptId, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix); List<SysDeptVo> listTreeDept(@Param("deptId") Long deptId, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);
} }

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

@ -20,7 +20,7 @@ public interface ISysDepartBoundaryService extends IService<SysDepartBoundary>{
List<SysDepartBoundary> queryByDeptId(String deptId); List<SysDepartBoundary> queryByDeptId(String deptId);
boolean uploadShpFile(MultipartFile file,Integer areaType); boolean uploadShpFile(MultipartFile file,Integer areaType,Long parentId);
boolean deleteDepartBoundary(String id); boolean deleteDepartBoundary(String id);

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

@ -1,6 +1,7 @@
package org.dromara.system.service; package org.dromara.system.service;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.bo.SysDeptBo; import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo; import org.dromara.system.domain.vo.SysDeptVo;
@ -144,7 +145,7 @@ public interface ISysDeptService {
* 查询每个部门的所属的部门全路径 * 查询每个部门的所属的部门全路径
* @return * @return
*/ */
List<Map<String,Object>> getNamePathList(); List<Map<String,Object>> getNamePathList(Long deptId);
/** /**
* 根据父级找子级 * 根据父级找子级
@ -157,4 +158,6 @@ public interface ISysDeptService {
SysDeptVo getByParentId(String deptId); SysDeptVo getByParentId(String deptId);
List<SysDeptVo> listTreeDept(Long deptId); List<SysDeptVo> listTreeDept(Long deptId);
SysDept addBoundaryDept(SysDeptBo sysDeptBo);
} }

50
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java

@ -8,11 +8,15 @@ import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.system.api.domain.vo.RemoteDeptVo; import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.dromara.system.domain.SysDepartBoundary; import org.dromara.system.domain.SysDepartBoundary;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.SysGeospatialVectors; import org.dromara.system.domain.SysGeospatialVectors;
import org.dromara.system.domain.SysVectorDict; import org.dromara.system.domain.SysVectorDict;
import org.dromara.system.domain.bo.SysDepartBoundaryBo; import org.dromara.system.domain.bo.SysDepartBoundaryBo;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.mapper.SysDepartBoundaryMapper; import org.dromara.system.mapper.SysDepartBoundaryMapper;
import org.dromara.system.service.ISysDepartBoundaryService; import org.dromara.system.service.ISysDepartBoundaryService;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysVectorDictService; import org.dromara.system.service.ISysVectorDictService;
import org.dromara.system.utils.BatchProcessorUtil; import org.dromara.system.utils.BatchProcessorUtil;
import org.dromara.system.utils.ShpAnalysisUtil; import org.dromara.system.utils.ShpAnalysisUtil;
@ -42,8 +46,7 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
private final ISysVectorDictService vectorDictService; private final ISysVectorDictService vectorDictService;
@DubboReference private final ISysDeptService deptService;
RemoteDeptService remoteDeptService;
@Override @Override
public TableDataInfo<SysDepartBoundary> listSysDepartBoundary(PageQuery pageQuery, SysDepartBoundary departBoundary) { public TableDataInfo<SysDepartBoundary> listSysDepartBoundary(PageQuery pageQuery, SysDepartBoundary departBoundary) {
@ -65,12 +68,12 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean uploadShpFile(MultipartFile file,Integer areaType) { public boolean uploadShpFile(MultipartFile file,Integer areaType,Long parentId) {
try { try {
List<SysGeospatialVectors> geospatialVectorsList = buildGeospatialVector(file); List<SysGeospatialVectors> geospatialVectorsList = buildGeospatialVector(file);
//6、生成新的对象集合存储数据表中 //6、生成新的对象集合存储数据表中
List<SysDepartBoundary> boundaryList = buildBusinessDepartBoundary(geospatialVectorsList,areaType); List<SysDepartBoundary> boundaryList = buildBusinessDepartBoundary(geospatialVectorsList,areaType,parentId);
// 分批处理 // 分批处理
int startIndex = 0; // 从第 0 条开始 int startIndex = 0; // 从第 0 条开始
@ -176,20 +179,20 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
@Override @Override
public List<SysDepartBoundaryBo> listJson(SysDepartBoundary departBoundary) { public List<SysDepartBoundaryBo> listJson(SysDepartBoundary departBoundary) {
if(StringUtils.isBlank(departBoundary.getDeptId())){ if(ObjectUtil.isEmpty(departBoundary.getDeptId())){
throw new ServiceException("部门【id】不存在"); throw new ServiceException("部门【id】不存在");
} }
SysDepartBoundaryBo child = new SysDepartBoundaryBo(); SysDepartBoundaryBo child = new SysDepartBoundaryBo();
child.setDepartId(String.valueOf(departBoundary.getDeptId())); child.setDepartId(String.valueOf(departBoundary.getDeptId()));
child.setAreaType(SysDepartBoundaryBo.AreaType.DistrictLevel); child.setAreaType(SysDepartBoundaryBo.AreaType.DistrictLevel);
child.setLandCategoriesJson(this.baseMapper.listJson(departBoundary.getDeptId())); child.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(departBoundary.getDeptId())));
RemoteDeptVo remoteDeptVo = remoteDeptService.getByParentId(departBoundary.getDeptId()); SysDeptVo sysDeptVo = deptService.getByParentId(String.valueOf(departBoundary.getDeptId()));
SysDepartBoundaryBo parent = new SysDepartBoundaryBo(); SysDepartBoundaryBo parent = new SysDepartBoundaryBo();
parent.setDepartId(String.valueOf(remoteDeptVo.getDeptId())); parent.setDepartId(String.valueOf(sysDeptVo.getDeptId()));
parent.setAreaType(SysDepartBoundaryBo.AreaType.Municipal); parent.setAreaType(SysDepartBoundaryBo.AreaType.Municipal);
parent.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(remoteDeptVo.getDeptId()))); parent.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(sysDeptVo.getDeptId())));
return List.of(child,parent); return List.of(child,parent);
} }
@ -202,6 +205,7 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
throw new ServiceException("实体不存在!"); throw new ServiceException("实体不存在!");
} }
return this.baseMapper.deleteById(departBoundary.getId())>0; return this.baseMapper.deleteById(departBoundary.getId())>0;
} }
@ -211,12 +215,12 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
* @param geospatialVectorsList * @param geospatialVectorsList
* @return * @return
*/ */
private List<SysDepartBoundary> buildBusinessDepartBoundary(List<SysGeospatialVectors> geospatialVectorsList, Integer areaType) { private List<SysDepartBoundary> buildBusinessDepartBoundary(List<SysGeospatialVectors> geospatialVectorsList, Integer areaType,Long parentId) {
List<SysDepartBoundary> resultList = new ArrayList<>(); List<SysDepartBoundary> resultList = new ArrayList<>();
List<Map<String,Object>> namePathList = remoteDeptService.getNamePathList(); List<Map<String,Object>> namePathList = deptService.getNamePathList(null);
Map<String, List<Map<String, Object>>> namePathMap = namePathList.stream() Map<String, List<Map<String, Object>>> namePathMap = namePathList.stream().filter(p-> Long.valueOf(p.get("parentId").toString()).equals(parentId))
.collect(Collectors.groupingBy(item -> item.get("deptName").toString())); .collect(Collectors.groupingBy(item -> item.get("deptName").toString()));
geospatialVectorsList.forEach(param->{ geospatialVectorsList.forEach(param->{
@ -225,14 +229,30 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
String divisionName = param.getAdminDivisionName(); String divisionName = param.getAdminDivisionName();
businessDepartBoundary.setBoundary(param.getLandCategories()); businessDepartBoundary.setBoundary(param.getLandCategories());
//判断是否存在表中,在表中更新部门区域中的部门id信息
if (ObjectUtil.isNotEmpty(namePathMap.get(divisionName))){ if (ObjectUtil.isNotEmpty(namePathMap.get(divisionName))){
Map<String, Object> objectMap = namePathMap.get(divisionName).get(0); Map<String, Object> objectMap = namePathMap.get(divisionName).get(0);
businessDepartBoundary.setShpNo(ObjectUtil.isEmpty(objectMap.get("shpNo"))?null:(String)objectMap.get("shpNo"));
businessDepartBoundary.setDeptName(objectMap.get("deptName") + ""); businessDepartBoundary.setDeptName(objectMap.get("deptName") + "");
businessDepartBoundary.setDeptId(objectMap.get("deptId") + ""); businessDepartBoundary.setDeptId(Long.valueOf(objectMap.get("deptId") + ""));
businessDepartBoundary.setCommunityName(objectMap.get("namePath") + ""); businessDepartBoundary.setNamePath(objectMap.get("namePath") + "");
businessDepartBoundary.setAreaType(areaType); businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary); resultList.add(businessDepartBoundary);
}else {
//如果不存在在部门表中则添加
SysDeptBo sysDeptBo = new SysDeptBo();
sysDeptBo.setParentId(parentId);
sysDeptBo.setDeptName(param.getAdminDivisionName());
SysDept sysDept = deptService.addBoundaryDept(sysDeptBo);
List<Map<String,Object>> deptNamePath = deptService.getNamePathList(sysDept.getDeptId());
businessDepartBoundary.setDeptName(sysDept.getDeptName());
businessDepartBoundary.setDeptId(sysDept.getDeptId());
businessDepartBoundary.setNamePath(deptNamePath.getFirst().get("namePath").toString());
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
} }
}); });
return resultList; return resultList;

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

@ -365,8 +365,8 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override @Override
public List<Map<String,Object>> getNamePathList() { public List<Map<String,Object>> getNamePathList(Long deptId) {
return baseMapper.getNamePathList(); return baseMapper.getNamePathList(deptId);
} }
@Override @Override
@ -392,4 +392,19 @@ public class SysDeptServiceImpl implements ISysDeptService {
return baseMapper.listTreeDept(deptId, ptPrefix); //.getTableCloud() return baseMapper.listTreeDept(deptId, ptPrefix); //.getTableCloud()
} }
@Override
public SysDept addBoundaryDept(SysDeptBo bo) {
SysDept info = baseMapper.selectById(bo.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
throw new ServiceException("部门停用,不允许新增");
}
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
baseMapper.insert(dept);
return dept;
}
} }

21
dk-modules/system/src/main/resources/mapper/system/SysDepartBoundaryMapper.xml

@ -79,13 +79,9 @@
INSERT INTO sys_depart_boundary ( INSERT INTO sys_depart_boundary (
dept_id, dept_id,
dept_name, dept_name,
community_name, name_path,
boundary, boundary,
perimeter, area_type,
area,
area_mu,
shp_no,
village_type,
create_by, create_by,
create_time, create_time,
update_by, update_by,
@ -96,13 +92,9 @@
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.deptId}, (#{item.deptId},
#{item.deptName}, #{item.deptName},
#{item.communityName}, #{item.namePath},
ST_GeomFromText(#{item.boundary}), ST_GeomFromText(#{item.boundary}),
#{item.perimeter}, #{item.areaType},
#{item.area},
#{item.areaMu},
#{item.shpNo},
#{item.villageType},
#{item.createBy}, #{item.createBy},
#{item.createTime}, #{item.createTime},
#{item.updateBy}, #{item.updateBy},
@ -126,9 +118,8 @@
JSON_OBJECT( JSON_OBJECT(
'deptId', l.dept_id, 'deptId', l.dept_id,
'deptName', l.dept_name, 'deptName', l.dept_name,
'adcode', l.shp_no, 'name', l.name_path,
'name', l.community_name, 'community_name', l.name_path
'community_name', l.community_name
), ),
'geometry', 'geometry',
ST_AsGeoJSON(l.boundary) ST_AsGeoJSON(l.boundary)

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

@ -52,7 +52,8 @@
sd.dept_name deptName, sd.dept_name deptName,
CAST(sd.dept_name AS CHAR(500)) AS namePath, CAST(sd.dept_name AS CHAR(500)) AS namePath,
sd.shp_no shpNo, sd.shp_no shpNo,
sd.tenant_id sd.tenant_id,
sd.parent_id
FROM FROM
sys_dept sd sys_dept sd
WHERE WHERE
@ -66,7 +67,8 @@
d.dept_name deptName, d.dept_name deptName,
CONCAT(dp.namePath, '', d.dept_name) AS namePath, CONCAT(dp.namePath, '', d.dept_name) AS namePath,
d.shp_no shpNo, d.shp_no shpNo,
d.tenant_id d.tenant_id,
d.parent_id
FROM FROM
sys_dept d sys_dept d
INNER JOIN INNER JOIN
@ -77,9 +79,15 @@
namePath, namePath,
shpNo, shpNo,
deptName, deptName,
tenant_id tenant_id,
parent_id parentId
FROM FROM
DeptPath DeptPath dp
<where>
<if test="deptId != null and deptId != ''">
dp.deptId = #{deptId}
</if>
</where>
ORDER BY ORDER BY
deptId deptId
</select> </select>

Loading…
Cancel
Save