use of com.bc.pmpheep.back.vo.AreaTreeVO in project pmph by BCSquad.
the class AreaSeviceTest method testGetAreaChirldren.
@Test
public void testGetAreaChirldren() {
Area area = addArea();
List<AreaTreeVO> listAreaTreeVOs = areaService.getAreaChirldren(area.getId());
Assert.assertNotNull("有子节点", listAreaTreeVOs);
}
use of com.bc.pmpheep.back.vo.AreaTreeVO in project pmph by BCSquad.
the class AreaServiceImpl method getAreaTreeVO.
@Override
public List<AreaTreeVO> getAreaTreeVO(Long parentId) throws CheckedServiceException {
if (null == parentId) {
throw new CheckedServiceException(CheckedExceptionBusiness.AREA, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
Long id = parentId;
AreaTreeVO areaTreeVO = new AreaTreeVO(id);
this.getAreaTree(areaTreeVO, new ArrayList<Long>());
return areaTreeVO.getChirldren();
}
use of com.bc.pmpheep.back.vo.AreaTreeVO in project pmph by BCSquad.
the class AreaServiceImpl method deleteAreaBatch.
@Override
public Integer deleteAreaBatch(Long id) throws CheckedServiceException {
if (null == id) {
throw new CheckedServiceException(CheckedExceptionBusiness.AREA, CheckedExceptionResult.NULL_PARAM, "ID为空");
}
if (0 < areaDao.getOrgId(id)) {
throw new CheckedServiceException(CheckedExceptionBusiness.AREA, CheckedExceptionResult.NULL_PARAM, "区域在机构区域已使用");
}
List<Long> ids = new ArrayList<Long>();
ids.add(id);
getAreaTree(new AreaTreeVO(id), ids);
return areaDao.deleteAreaBatch(ids);
}
use of com.bc.pmpheep.back.vo.AreaTreeVO in project pmph by BCSquad.
the class AreaServiceImpl method getAreaTree.
/**
**************************
* 下面是必须的辅助方法
******************************************
*/
/**
* 得到parentId的树 和树的所有id
*
* @author Mryang
* @createDate 2017年9月25日 下午2:05:27
* @param areaTreeVO
* 带parentId
* @param ids
*/
public void getAreaTree(AreaTreeVO areaTreeVO, List<Long> ids) {
List<AreaTreeVO> areaVOList = areaDao.getAreaByParentId(areaTreeVO.getId());
if (null != areaVOList && areaVOList.size() > 0) {
areaTreeVO.setChirldren(areaVOList);
areaTreeVO.setIsLeaf(false);
for (AreaTreeVO areaTreeVOChirld : areaVOList) {
ids.add(areaTreeVOChirld.getId());
getAreaTree(areaTreeVOChirld, ids);
}
}
}
Aggregations