修复数据字典无法修改备注描述的问题

master
Guo XIn 1 year ago
parent 89dd173d0d
commit 70dca06355
  1. 5
      shandan-system/src/main/java/com/keyware/shandan/system/service/impl/SysDictServiceImpl.java

@ -8,7 +8,9 @@ import com.keyware.shandan.system.entity.SysDictType;
import com.keyware.shandan.system.mapper.SysDictMapper;
import com.keyware.shandan.system.service.SysDictService;
import com.keyware.shandan.system.utils.DictUtil;
import com.keyware.shandan.system.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.io.Serializable;
@ -24,10 +26,13 @@ import java.io.Serializable;
public class SysDictServiceImpl extends BaseServiceImpl<SysDictMapper, SysDict, String> implements SysDictService {
@Override
public Result<SysDict> updateOrSave(SysDict entity) throws Exception {
SysDict old = getById(entity.getId());
if(old == null || !entity.getDictName().equals(old.getDictName())){
SysDict existDict = getDictByTypeAndName(entity.getTypeId(), entity.getDictName());
if(existDict != null){
return Result.of(null, false, "字典名称已存在");
}
}
entity.setDictCode(entity.getDictName());
// entity.setDictValue(entity.getDictName());
boolean ok = super.saveOrUpdate(entity);