|
|
@ -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,10 +26,13 @@ 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 old = getById(entity.getId()); |
|
|
|
|
|
|
|
if(old == null || !entity.getDictName().equals(old.getDictName())){ |
|
|
|
SysDict existDict = getDictByTypeAndName(entity.getTypeId(), entity.getDictName()); |
|
|
|
SysDict existDict = getDictByTypeAndName(entity.getTypeId(), entity.getDictName()); |
|
|
|
if(existDict != null){ |
|
|
|
if(existDict != null){ |
|
|
|
return Result.of(null, false, "字典名称已存在"); |
|
|
|
return Result.of(null, false, "字典名称已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
entity.setDictCode(entity.getDictName()); |
|
|
|
entity.setDictCode(entity.getDictName()); |
|
|
|
// entity.setDictValue(entity.getDictName());
|
|
|
|
// entity.setDictValue(entity.getDictName());
|
|
|
|
boolean ok = super.saveOrUpdate(entity); |
|
|
|
boolean ok = super.saveOrUpdate(entity); |
|
|
|