Commit 6e10e950 authored by KeYong's avatar KeYong

更新

parent ce9f2b33
......@@ -766,6 +766,9 @@ LEFT JOIN (
AND ( usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT')
</otherwise>
</choose>
<if test="bizOrgCode!='' and bizOrgCode!=null">
AND usr.biz_org_code like CONCAT('%',#{bizOrgCode},'%')
</if>
and usr.is_delete = false
</where>
</select>
......
......@@ -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.equipmanage.common.dto.AreaDto;
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.AreaTreeVo;
import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo;
import com.yeejoin.equipmanage.service.IAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
......@@ -69,9 +71,13 @@ public class AreaController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据登陆人、机构类型获取人员部门树", notes = "根据登陆人、机构类型获取人员部门树")
@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();
if (StringUtil.isNotEmpty(bizOrgCode)) {
reginParams.getPersonIdentity().setBizOrgCode(bizOrgCode);
}
return iAreaService.companyTreeByUserAndType(reginParams, type);
}
......
......@@ -28,6 +28,8 @@ import com.yeejoin.equipmanage.operation.AreaSynRiskOperator;
import com.yeejoin.equipmanage.service.IAreaService;
import com.yeejoin.equipmanage.service.IEqSourceFileService;
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.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -175,10 +177,12 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
public IPage areaList(Page page, Area area) {
long id = area.getParentId();
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
// 查询传入节点下的区域父id
Set<Long> parentIdSet = getChildrenId(id);
List<UnitAreaTreeVo> list = new ArrayList<>();
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())) {
queryWrapper.eq(Area::getBizOrgCode, area.getBizOrgCode());
queryWrapper.like(Area::getBizOrgCode, area.getBizOrgCode());
}
queryWrapper.eq(Area::getIsDelete, false);
if (parentIdSet.size() > 0) {
......@@ -214,7 +218,26 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
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) {
// 获取公司部门list
List<OrgUsr> orgUsrLists = iOrgUsrService.getListByBizOrgTypeCode("COMPANY,DEPARTMENT", bizOrgCode);
......@@ -233,6 +256,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
// 根据bizOrgCode获取区域list
LambdaQueryWrapper<Area> wrapper = new LambdaQueryWrapper<>();
wrapper.likeRight(Area::getBizOrgCode, bizOrgCode);
wrapper.eq(Area::getIsDelete, false);
List<Area> areaEntityList = this.baseMapper.selectList(wrapper);
List<UnitAreaTreeVo> systemList = areaEntityList.stream()
.map(key -> {
......@@ -279,6 +303,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
return idSet;
}
@Override
@Transactional
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