Răsfoiți Sursa

学校功能

TRX 1 an în urmă
părinte
comite
67706bf639

+ 1 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/base/SuperParam.java

@@ -7,6 +7,7 @@ import java.io.Serializable;
 
 /**
  * 添加/编辑的父类
+ *
  * @author TRX
  * @date 2024/5/26
  */

+ 2 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/school/DictInfoDao.java

@@ -1,6 +1,7 @@
 package com.zhongshu.card.server.core.dao.school;
 
 import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.zhongshu.card.client.utils.type.DictInfoType;
 import com.zhongshu.card.server.core.dao.school.extend.DictInfoDaoExtend;
 import com.zhongshu.card.server.core.domain.school.Area;
 import com.zhongshu.card.server.core.domain.school.DictInfo;
@@ -17,6 +18,6 @@ public interface DictInfoDao extends MongoDao<DictInfo>, DictInfoDaoExtend {
 
     DictInfo findTopById(String id);
 
-    DictInfo findTopByNameAndOid(String name, String oid);
+    DictInfo findTopByNameAndOidAndDictInfoType(String name, String oid, DictInfoType dictInfoType);
 
 }

+ 6 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/school/DictInfoServiceImpl.java

@@ -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.ResultMessage;
 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.domain.school.BookInfo;
 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) {
         Assert.hasText(param.getName(), "name不能为空");
         Assert.isNull(param.getDictInfoType(), "dictInfoType不能为空");
-        initDefaultUserParam(param);
+        initDefaultUserAndOid(param);
         if (param.getSort() == null) {
             param.setSort(1L);
         }
+        DictInfoType dictInfoType = param.getDictInfoType();
+
         DictInfo dictInfo = new DictInfo();
         if (StringUtils.isNotEmpty(param.getId())) {
             dictInfo = dictInfoDao.findTopById(param.getId());
             if (ObjectUtils.isEmpty(dictInfo)) {
                 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())) {
                 return ResultContent.buildFail(String.format("name已存在:%s", param.getName()));
             }
         } else {
-            DictInfo temp = dictInfoDao.findTopByNameAndOid(param.getName(), param.getOid());
+            DictInfo temp = dictInfoDao.findTopByNameAndOidAndDictInfoType(param.getName(), param.getOid(), dictInfoType);
             if (ObjectUtils.isNotEmpty(temp)) {
                 return ResultContent.buildFail(String.format("name已存在:%s", param.getName()));
             }