Search in sources :

Example 6 with MdcDict

use of com.paascloud.provider.model.domain.MdcDict in project paascloud-master by paascloud.

the class MdcDictServiceImpl method getAllParentDictFolderByMenuId.

private List<MdcDict> getAllParentDictFolderByMenuId(Long dictId) {
    MdcDict mdcDictQuery = new MdcDict();
    mdcDictQuery.setId(dictId);
    mdcDictQuery = mapper.selectOne(mdcDictQuery);
    List<MdcDict> mdcDictList = Lists.newArrayList();
    mdcDictList = buildParentNote(mdcDictList, mdcDictQuery);
    return mdcDictList;
}
Also used : MdcDict(com.paascloud.provider.model.domain.MdcDict)

Example 7 with MdcDict

use of com.paascloud.provider.model.domain.MdcDict in project paascloud-master by paascloud.

the class MdcDictServiceImpl method checkDictHasChildDict.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public boolean checkDictHasChildDict(Long dictId) {
    logger.info("检查数据字典id={}是否存在生效节点", dictId);
    MdcDict uacMenu = new MdcDict();
    uacMenu.setStatus(MdcDictStatusEnum.ENABLE.getType());
    uacMenu.setPid(dictId);
    return mapper.selectCount(uacMenu) > 0;
}
Also used : MdcDict(com.paascloud.provider.model.domain.MdcDict) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with MdcDict

use of com.paascloud.provider.model.domain.MdcDict in project paascloud-master by paascloud.

the class MdcDictServiceImpl method buildNode.

/**
 * 递归获取菜单的子节点
 */
private List<MdcDict> buildNode(List<MdcDict> mdcDictList, MdcDict uacMenu, int dictStatus) {
    List<MdcDict> uacMenuQueryList = mapper.select(uacMenu);
    MdcDict uacMenuQuery;
    for (MdcDict dict : uacMenuQueryList) {
        if (dictStatus == dict.getStatus()) {
            mdcDictList.add(dict);
        }
        uacMenuQuery = new MdcDict();
        uacMenuQuery.setPid(dict.getId());
        buildNode(mdcDictList, uacMenuQuery, dictStatus);
    }
    return mdcDictList;
}
Also used : MdcDict(com.paascloud.provider.model.domain.MdcDict)

Example 9 with MdcDict

use of com.paascloud.provider.model.domain.MdcDict in project paascloud-master by paascloud.

the class MdcDictServiceImpl method saveMdcDict.

@Override
public void saveMdcDict(MdcDict mdcDict, LoginAuthDto loginAuthDto) {
    Long pid = mdcDict.getPid();
    mdcDict.setUpdateInfo(loginAuthDto);
    MdcDict parentMenu = mapper.selectByPrimaryKey(pid);
    if (PublicUtil.isEmpty(parentMenu)) {
        throw new MdcBizException(ErrorCodeEnum.MDC10021020, pid);
    }
    if (mdcDict.isNew()) {
        MdcDict updateMenu = new MdcDict();
        updateMenu.setId(pid);
        Long dictId = super.generateId();
        mdcDict.setId(dictId);
        mapper.insertSelective(mdcDict);
    } else {
        mapper.updateByPrimaryKeySelective(mdcDict);
    }
}
Also used : MdcBizException(com.paascloud.provider.exceptions.MdcBizException) MdcDict(com.paascloud.provider.model.domain.MdcDict)

Example 10 with MdcDict

use of com.paascloud.provider.model.domain.MdcDict in project paascloud-master by paascloud.

the class MdcDictMainController method saveDict.

@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "编辑字典")
public Wrapper saveDict(@ApiParam(name = "saveDict", value = "编辑字典") @RequestBody MdcEditDictDto mdcDictAddDto) {
    MdcDict mdcDict = new MdcDict();
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    BeanUtils.copyProperties(mdcDictAddDto, mdcDict);
    mdcDictService.saveMdcDict(mdcDict, loginAuthDto);
    return WrapMapper.ok();
}
Also used : MdcDict(com.paascloud.provider.model.domain.MdcDict) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

MdcDict (com.paascloud.provider.model.domain.MdcDict)10 MdcBizException (com.paascloud.provider.exceptions.MdcBizException)3 Transactional (org.springframework.transaction.annotation.Transactional)2 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 MdcDictVo (com.paascloud.provider.model.vo.MdcDictVo)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ModelMapper (org.modelmapper.ModelMapper)1