Search in sources :

Example 1 with MdcDictVo

use of com.paascloud.provider.model.vo.MdcDictVo in project paascloud-master by paascloud.

the class MdcDictServiceImpl method getMdcDictVoById.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public MdcDictVo getMdcDictVoById(Long dictId) {
    MdcDict dict = mdcDictMapper.selectByPrimaryKey(dictId);
    if (dict == null) {
        logger.error("找不到数据字典信息id={}", dictId);
        throw new MdcBizException(ErrorCodeEnum.MDC10021018, dictId);
    }
    // 获取父级菜单信息
    MdcDict parentDict = mdcDictMapper.selectByPrimaryKey(dict.getPid());
    ModelMapper modelMapper = new ModelMapper();
    MdcDictVo dictVo = modelMapper.map(dict, MdcDictVo.class);
    if (parentDict != null) {
        dictVo.setParentDictName(parentDict.getDictName());
    }
    return dictVo;
}
Also used : MdcBizException(com.paascloud.provider.exceptions.MdcBizException) MdcDictVo(com.paascloud.provider.model.vo.MdcDictVo) MdcDict(com.paascloud.provider.model.domain.MdcDict) ModelMapper(org.modelmapper.ModelMapper) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with MdcDictVo

use of com.paascloud.provider.model.vo.MdcDictVo in project paascloud-master by paascloud.

the class MdcDictMainController method queryDictVoById.

/**
 * 根据ID获取字典信息.
 *
 * @param id the id
 *
 * @return the wrapper
 */
@PostMapping(value = "/queryById/{id}")
@ApiOperation(httpMethod = "POST", value = "根据ID获取字典信息")
public Wrapper<MdcDictVo> queryDictVoById(@ApiParam(name = "id", value = "字典id") @PathVariable Long id) {
    logger.info("根据Id查询字典信息, dictId={}", id);
    MdcDictVo mdcDictVo = mdcDictService.getMdcDictVoById(id);
    return WrapMapper.ok(mdcDictVo);
}
Also used : MdcDictVo(com.paascloud.provider.model.vo.MdcDictVo) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

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