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

master
Guo XIn 1 year ago
parent 89dd173d0d
commit 70dca06355
  1. 11
      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.mapper.SysDictMapper;
import com.keyware.shandan.system.service.SysDictService; import com.keyware.shandan.system.service.SysDictService;
import com.keyware.shandan.system.utils.DictUtil; import com.keyware.shandan.system.utils.DictUtil;
import com.keyware.shandan.system.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.io.Serializable; import java.io.Serializable;
@ -24,9 +26,12 @@ import java.io.Serializable;
public class SysDictServiceImpl extends BaseServiceImpl<SysDictMapper, SysDict, String> implements SysDictService { public class SysDictServiceImpl extends BaseServiceImpl<SysDictMapper, SysDict, String> implements SysDictService {
@Override @Override
public Result<SysDict> updateOrSave(SysDict entity) throws Exception { public Result<SysDict> updateOrSave(SysDict entity) throws Exception {
SysDict existDict = getDictByTypeAndName(entity.getTypeId(), entity.getDictName()); SysDict old = getById(entity.getId());
if(existDict != null){ if(old == null || !entity.getDictName().equals(old.getDictName())){
return Result.of(null, false, "字典名称已存在"); SysDict existDict = getDictByTypeAndName(entity.getTypeId(), entity.getDictName());
if(existDict != null){
return Result.of(null, false, "字典名称已存在");
}
} }
entity.setDictCode(entity.getDictName()); entity.setDictCode(entity.getDictName());
// entity.setDictValue(entity.getDictName()); // entity.setDictValue(entity.getDictName());