|
|
|
@ -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,9 +26,12 @@ import java.io.Serializable; |
|
|
|
|
public class SysDictServiceImpl extends BaseServiceImpl<SysDictMapper, SysDict, String> implements SysDictService { |
|
|
|
|
@Override |
|
|
|
|
public Result<SysDict> updateOrSave(SysDict entity) throws Exception { |
|
|
|
|
SysDict existDict = getDictByTypeAndName(entity.getTypeId(), entity.getDictName()); |
|
|
|
|
if(existDict != null){ |
|
|
|
|
return Result.of(null, false, "字典名称已存在"); |
|
|
|
|
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());
|
|
|
|
|