Search in sources :

Example 6 with SysDictType

use of com.ruoyi.project.system.domain.SysDictType in project RuoYi-Vue-fast by yangzongzhuan.

the class SysDictTypeServiceImpl method deleteDictTypeByIds.

/**
 * 批量删除字典类型信息
 *
 * @param dictIds 需要删除的字典ID
 */
@Override
public void deleteDictTypeByIds(Long[] dictIds) {
    for (Long dictId : dictIds) {
        SysDictType dictType = selectDictTypeById(dictId);
        if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) {
            throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
        }
        dictTypeMapper.deleteDictTypeById(dictId);
        DictUtils.removeDictCache(dictType.getDictType());
    }
}
Also used : ServiceException(com.ruoyi.common.exception.ServiceException) SysDictType(com.ruoyi.project.system.domain.SysDictType)

Aggregations

SysDictType (com.ruoyi.project.system.domain.SysDictType)6 ServiceException (com.ruoyi.common.exception.ServiceException)2 SysDictData (com.ruoyi.project.system.domain.SysDictData)2 Transactional (org.springframework.transaction.annotation.Transactional)2