Commit 6e10e950 authored by KeYong's avatar KeYong

更新

parent ce9f2b33
...@@ -766,6 +766,9 @@ LEFT JOIN ( ...@@ -766,6 +766,9 @@ LEFT JOIN (
AND ( usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') AND ( usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
</otherwise> </otherwise>
</choose> </choose>
<if test="bizOrgCode!='' and bizOrgCode!=null">
AND usr.biz_org_code like CONCAT('%',#{bizOrgCode},'%')
</if>
and usr.is_delete = false and usr.is_delete = false
</where> </where>
</select> </select>
......
...@@ -7,12 +7,14 @@ import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify; ...@@ -7,12 +7,14 @@ import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.equipmanage.common.dto.AreaDto; import com.yeejoin.equipmanage.common.dto.AreaDto;
import com.yeejoin.equipmanage.common.entity.Area; import com.yeejoin.equipmanage.common.entity.Area;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.AreaResquest; import com.yeejoin.equipmanage.common.vo.AreaResquest;
import com.yeejoin.equipmanage.common.vo.AreaTreeVo; import com.yeejoin.equipmanage.common.vo.AreaTreeVo;
import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo; import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo;
import com.yeejoin.equipmanage.service.IAreaService; import com.yeejoin.equipmanage.service.IAreaService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -69,9 +71,13 @@ public class AreaController extends AbstractBaseController { ...@@ -69,9 +71,13 @@ public class AreaController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据登陆人、机构类型获取人员部门树", notes = "根据登陆人、机构类型获取人员部门树") @ApiOperation(httpMethod = "GET", value = "根据登陆人、机构类型获取人员部门树", notes = "根据登陆人、机构类型获取人员部门树")
@GetMapping(value = "/companyTreeByUserAndType") @GetMapping(value = "/companyTreeByUserAndType")
public List<OrgMenuDto> companyTreeByUserAndType(@RequestParam(required = false) String type){ public List<OrgMenuDto> companyTreeByUserAndType(@RequestParam(required = false) String type,
@RequestParam(required = false) String bizOrgCode){
// 获取登陆人角色 // 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
if (StringUtil.isNotEmpty(bizOrgCode)) {
reginParams.getPersonIdentity().setBizOrgCode(bizOrgCode);
}
return iAreaService.companyTreeByUserAndType(reginParams, type); return iAreaService.companyTreeByUserAndType(reginParams, type);
} }
......
...@@ -28,6 +28,8 @@ import com.yeejoin.equipmanage.operation.AreaSynRiskOperator; ...@@ -28,6 +28,8 @@ import com.yeejoin.equipmanage.operation.AreaSynRiskOperator;
import com.yeejoin.equipmanage.service.IAreaService; import com.yeejoin.equipmanage.service.IAreaService;
import com.yeejoin.equipmanage.service.IEqSourceFileService; import com.yeejoin.equipmanage.service.IEqSourceFileService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import io.micrometer.core.instrument.util.StringUtils;
import liquibase.pro.packaged.S;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -175,10 +177,12 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA ...@@ -175,10 +177,12 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
public IPage areaList(Page page, Area area) { public IPage areaList(Page page, Area area) {
long id = area.getParentId(); long id = area.getParentId();
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
// 查询传入节点下的区域父id List<UnitAreaTreeVo> list = new ArrayList<>();
Set<Long> parentIdSet = getChildrenId(id); list = treeMenuList(getAreaTreeListVo(area.getBizOrgCode()), id);
List<Long> parentIdSet = list.stream().map(vo -> vo.getId()).collect(Collectors.toList());
parentIdSet.add(id);
if (StringUtil.isNotEmpty(area.getBizOrgCode())) { if (StringUtil.isNotEmpty(area.getBizOrgCode())) {
queryWrapper.eq(Area::getBizOrgCode, area.getBizOrgCode()); queryWrapper.like(Area::getBizOrgCode, area.getBizOrgCode());
} }
queryWrapper.eq(Area::getIsDelete, false); queryWrapper.eq(Area::getIsDelete, false);
if (parentIdSet.size() > 0) { if (parentIdSet.size() > 0) {
...@@ -214,7 +218,26 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA ...@@ -214,7 +218,26 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
return pageArea; return pageArea;
} }
@Override /**
* 获取某个父节点下面的所有子节点
* @param list
* @param pid
* @return
*/
public static List<UnitAreaTreeVo> treeMenuList (List<UnitAreaTreeVo> list, Long pid) {
List<UnitAreaTreeVo> voList = new ArrayList<>();
for (UnitAreaTreeVo vo : list) {
//遍历出父id等于参数的id,add进子节点集合
if (Long.valueOf(vo.getParentId()) == pid) {
//递归遍历下一级
treeMenuList(list, Long.valueOf(vo.getId()));
voList.add(vo);
}
}
return voList;
}
@Override
public List<UnitAreaTreeVo> getAreaTreeListVo(String bizOrgCode) { public List<UnitAreaTreeVo> getAreaTreeListVo(String bizOrgCode) {
// 获取公司部门list // 获取公司部门list
List<OrgUsr> orgUsrLists = iOrgUsrService.getListByBizOrgTypeCode("COMPANY,DEPARTMENT", bizOrgCode); List<OrgUsr> orgUsrLists = iOrgUsrService.getListByBizOrgTypeCode("COMPANY,DEPARTMENT", bizOrgCode);
...@@ -233,6 +256,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA ...@@ -233,6 +256,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
// 根据bizOrgCode获取区域list // 根据bizOrgCode获取区域list
LambdaQueryWrapper<Area> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Area> wrapper = new LambdaQueryWrapper<>();
wrapper.likeRight(Area::getBizOrgCode, bizOrgCode); wrapper.likeRight(Area::getBizOrgCode, bizOrgCode);
wrapper.eq(Area::getIsDelete, false);
List<Area> areaEntityList = this.baseMapper.selectList(wrapper); List<Area> areaEntityList = this.baseMapper.selectList(wrapper);
List<UnitAreaTreeVo> systemList = areaEntityList.stream() List<UnitAreaTreeVo> systemList = areaEntityList.stream()
.map(key -> { .map(key -> {
...@@ -279,6 +303,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA ...@@ -279,6 +303,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
return idSet; return idSet;
} }
@Override @Override
@Transactional @Transactional
public Object saveArea(AreaResquest areaResquest) { public Object saveArea(AreaResquest areaResquest) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment