|
@@ -8,6 +8,7 @@ import com.zhongshu.card.client.model.school.DictInfoSearch;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
|
import com.zhongshu.card.client.service.school.DictInfoService;
|
|
import com.zhongshu.card.client.service.school.DictInfoService;
|
|
|
|
|
+import com.zhongshu.card.client.utils.type.DictInfoType;
|
|
|
import com.zhongshu.card.server.core.dao.school.DictInfoDao;
|
|
import com.zhongshu.card.server.core.dao.school.DictInfoDao;
|
|
|
import com.zhongshu.card.server.core.domain.school.BookInfo;
|
|
import com.zhongshu.card.server.core.domain.school.BookInfo;
|
|
|
import com.zhongshu.card.server.core.domain.school.DictInfo;
|
|
import com.zhongshu.card.server.core.domain.school.DictInfo;
|
|
@@ -45,22 +46,24 @@ public class DictInfoServiceImpl extends SuperService implements DictInfoService
|
|
|
public ResultContent addDict(DictInfoParam param) {
|
|
public ResultContent addDict(DictInfoParam param) {
|
|
|
Assert.hasText(param.getName(), "name不能为空");
|
|
Assert.hasText(param.getName(), "name不能为空");
|
|
|
Assert.isNull(param.getDictInfoType(), "dictInfoType不能为空");
|
|
Assert.isNull(param.getDictInfoType(), "dictInfoType不能为空");
|
|
|
- initDefaultUserParam(param);
|
|
|
|
|
|
|
+ initDefaultUserAndOid(param);
|
|
|
if (param.getSort() == null) {
|
|
if (param.getSort() == null) {
|
|
|
param.setSort(1L);
|
|
param.setSort(1L);
|
|
|
}
|
|
}
|
|
|
|
|
+ DictInfoType dictInfoType = param.getDictInfoType();
|
|
|
|
|
+
|
|
|
DictInfo dictInfo = new DictInfo();
|
|
DictInfo dictInfo = new DictInfo();
|
|
|
if (StringUtils.isNotEmpty(param.getId())) {
|
|
if (StringUtils.isNotEmpty(param.getId())) {
|
|
|
dictInfo = dictInfoDao.findTopById(param.getId());
|
|
dictInfo = dictInfoDao.findTopById(param.getId());
|
|
|
if (ObjectUtils.isEmpty(dictInfo)) {
|
|
if (ObjectUtils.isEmpty(dictInfo)) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
}
|
|
}
|
|
|
- DictInfo temp = dictInfoDao.findTopByNameAndOid(param.getName(), param.getOid());
|
|
|
|
|
|
|
+ DictInfo temp = dictInfoDao.findTopByNameAndOidAndDictInfoType(param.getName(), param.getOid(), dictInfoType);
|
|
|
if (ObjectUtils.isNotEmpty(temp) && !temp.getId().equals(dictInfo.getId())) {
|
|
if (ObjectUtils.isNotEmpty(temp) && !temp.getId().equals(dictInfo.getId())) {
|
|
|
return ResultContent.buildFail(String.format("name已存在:%s", param.getName()));
|
|
return ResultContent.buildFail(String.format("name已存在:%s", param.getName()));
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- DictInfo temp = dictInfoDao.findTopByNameAndOid(param.getName(), param.getOid());
|
|
|
|
|
|
|
+ DictInfo temp = dictInfoDao.findTopByNameAndOidAndDictInfoType(param.getName(), param.getOid(), dictInfoType);
|
|
|
if (ObjectUtils.isNotEmpty(temp)) {
|
|
if (ObjectUtils.isNotEmpty(temp)) {
|
|
|
return ResultContent.buildFail(String.format("name已存在:%s", param.getName()));
|
|
return ResultContent.buildFail(String.format("name已存在:%s", param.getName()));
|
|
|
}
|
|
}
|