|
|
|
@ -14,6 +14,7 @@ import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -36,9 +37,11 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
private SysDictionaryRepository sysDictionaryRDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "添加字典")
|
|
|
|
|
public void insertSysDictionary(SysDictionary sysDictionary) {
|
|
|
|
|
long repeatCount = sysDictionaryRDao.findByPropertyCount("dictionaryCode",sysDictionary.getDictionaryCode());
|
|
|
|
|
if (repeatCount > 0){
|
|
|
|
|
long repeatCodeCount = sysDictionaryRDao.findByPropertyCount("dictionaryCode",sysDictionary.getDictionaryCode());
|
|
|
|
|
long repeatValueCount = sysDictionaryRDao.findByPropertyCount("dictionaryValue",sysDictionary.getDictionaryValue());
|
|
|
|
|
if (repeatCodeCount > 0 || repeatValueCount > 0){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.IO_EXCEPTION.getCode())
|
|
|
|
@ -64,17 +67,21 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据id删除字典")
|
|
|
|
|
public void deleteSysDictionaryById(Long id) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY id:{}",id);
|
|
|
|
|
sysDictionaryRDao.deleteById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "修改字典")
|
|
|
|
|
public void updateSysDictionary(SysDictionary sysDictionary) {
|
|
|
|
|
// 校验唯一
|
|
|
|
|
String hqlPack = CoreHqlPack.packHqlSysDictionaryCode(sysDictionary);
|
|
|
|
|
long repeatCount = sysDictionaryRDao.findByHqlWhereCount(hqlPack);
|
|
|
|
|
if (repeatCount > 0){
|
|
|
|
|
long repeatCodeCount = sysDictionaryRDao.findByHqlWhereCount(hqlPack);
|
|
|
|
|
hqlPack = CoreHqlPack.packHqlSysDictionaryValue(sysDictionary);
|
|
|
|
|
long repeatValueCount = sysDictionaryRDao.findByHqlWhereCount(hqlPack);
|
|
|
|
|
if (repeatCodeCount > 0 || repeatValueCount > 0){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -98,24 +105,28 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询所有字典信息")
|
|
|
|
|
public List<SysDictionary> listSysDictionary() {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY list");
|
|
|
|
|
return sysDictionaryRDao.list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据id查询字典信息")
|
|
|
|
|
public SysDictionary getSysDictionaryById(Long id) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY id:{}",id);
|
|
|
|
|
return sysDictionaryRDao.getById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据父级代码查询字典项信息")
|
|
|
|
|
public List<SysDictionary> findSysDictionaryByParentCode(String parentCode) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY parentCode:{}",parentCode);
|
|
|
|
|
return sysDictionaryRDao.findByProperty("parentCodeRdd",parentCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "字典复杂查询,分页,排序",notes = "默认查询非顶级字典")
|
|
|
|
|
public ListPager querySysDictionaryByPager(SysDictionary sysDictionary, Pager pager) {
|
|
|
|
|
sysDictionary = sysDictionary == null ? new SysDictionary():sysDictionary;
|
|
|
|
|
|
|
|
|
@ -125,18 +136,21 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询顶级字典")
|
|
|
|
|
public List<SysDictionary> findSysDictionaryByTop() {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY parentId:{}", CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
return sysDictionaryRDao.findByProperty("parentId",(long)CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "批量删除字典")
|
|
|
|
|
public void deleteSysDictionaryByIds(Long[] ids) {
|
|
|
|
|
LOGGER.info("字典 SYS_DICTIONARY ids:{}", ids.toString());
|
|
|
|
|
sysDictionaryRDao.deleteByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "检出文件名称是否符合系统规范")
|
|
|
|
|
public boolean checkFileName(String fileName) {
|
|
|
|
|
List<SysDictionary> list = findSysDictionaryByParentCode(CommonConstWords.DICTIONARY_FILE_TYPE);
|
|
|
|
|
|
|
|
|
@ -153,6 +167,7 @@ public class SysDictionaryService implements ISysDictionaryService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据父节点 以及当前节点CODE 获取字典信息")
|
|
|
|
|
public SysDictionary getSysDictionaryByParentCodeAndCode(String parentCode, String code) {
|
|
|
|
|
List<SysDictionary> list = sysDictionaryRDao.findByProperty(new String[]{"parentCodeRdd","dictionaryCode"},
|
|
|
|
|
new Object[]{parentCode,code});
|
|
|
|
|