|
|
@ -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());
|
|
|
|