Joburgess 5 tahun lalu
induk
melakukan
ac9b1592e5

+ 10 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/OrganizationDao.java

@@ -25,6 +25,15 @@ public interface OrganizationDao extends BaseDAO<Integer, Organization> {
      * @param parentOrganIdTag:
      * @return java.util.List<java.lang.Integer>
      */
-    List<Integer> getSelfAndChildOrganIds(@Param("parentOrganIdTag") String parentOrganIdTag);
+    List<Integer> getChildOrganIds(@Param("parentOrganIdTag") String parentOrganIdTag);
+
+    /**
+     * @describe 获取下一级所有合作单位编号
+     * @author Joburgess
+     * @date 2020.06.28
+     * @param organId: 当前合作单位
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> getNextLevelOrganIds(@Param("organId") Integer organId);
 
 }

+ 11 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/OrganizationService.java

@@ -22,7 +22,7 @@ public interface OrganizationService extends BaseService<Integer, Organization>
     void updateOrganization(Organization organization);
 
     /**
-     * @describe 获取当前分部及其所有子分部编号
+     * @describe 获取当前分部及其所有子合作单位编号
      * @author Joburgess
      * @date 2020.06.28
      * @param organId: 本单位编号
@@ -30,4 +30,14 @@ public interface OrganizationService extends BaseService<Integer, Organization>
      * @return java.util.List<java.lang.Integer>
      */
     List<Integer> getChildOrganIds(Integer organId, boolean includeSelf);
+
+    /**
+     * @describe 获取下一级所有合作单位编号
+     * @author Joburgess
+     * @date 2020.06.28
+     * @param organId: 当前合作单位编号
+     * @param includeSelf: 是否包含当前合作单位
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> getNextLevelOrganIds(Integer organId, boolean includeSelf);
 }

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -2,6 +2,8 @@ package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
+import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.dao.ExamOrganizationRelationDao;
@@ -11,6 +13,7 @@ import com.keao.edu.user.entity.ExaminationBasic;
 import com.keao.edu.user.enums.ExamStatusEnum;
 import com.keao.edu.user.enums.YesOrNoEnum;
 import com.keao.edu.user.service.ExamOrganizationRelationService;
+import com.keao.edu.user.service.OrganizationService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -29,6 +32,8 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	private ExamOrganizationRelationDao examOrganizationRelationDao;
 	@Autowired
 	private ExaminationBasicDao examinationBasicDao;
+	@Autowired
+	private OrganizationService organizationService;
 
 	@Override
 	public BaseDAO<Long, ExamOrganizationRelation> getDAO() {
@@ -36,6 +41,11 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	}
 
 	@Override
+	public PageInfo<ExamOrganizationRelation> queryPage(QueryInfo queryInfo) {
+		return super.queryPage(queryInfo);
+	}
+
+	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
 		if(Objects.isNull(examOrganizationRelation.getExaminationBasicId())){

+ 17 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/OrganizationServiceImpl.java

@@ -141,7 +141,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 		StringBuffer parentOrganIdTag= new StringBuffer(Objects.isNull(organization.getParentOrganIdTag())?"":organization.getParentOrganIdTag());
 		parentOrganIdTag.append(",");
 		parentOrganIdTag.append(organization.getId());
-		List<Integer> selfAndChildOrganIds = organDao.getSelfAndChildOrganIds(parentOrganIdTag.toString());
+		List<Integer> selfAndChildOrganIds = organDao.getChildOrganIds(parentOrganIdTag.toString());
 		if(null == selfAndChildOrganIds){
 			selfAndChildOrganIds= Collections.EMPTY_LIST;
 		}
@@ -150,4 +150,20 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 		}
 		return selfAndChildOrganIds;
 	}
+
+	@Override
+	public List<Integer> getNextLevelOrganIds(Integer organId, boolean includeSelf) {
+		Organization organization = organDao.get(organId);
+		if(Objects.isNull(organization)){
+			throw new BizException("当前声部不存在");
+		}
+		List<Integer> selfAndChildOrganIds = organDao.getNextLevelOrganIds(organization.getId());
+		if(null == selfAndChildOrganIds){
+			selfAndChildOrganIds= Collections.EMPTY_LIST;
+		}
+		if(includeSelf){
+			selfAndChildOrganIds.add(organization.getId());
+		}
+		return null;
+	}
 }

+ 3 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/OrganizationMapper.xml

@@ -120,4 +120,7 @@
 	<select id="getSelfAndChildOrganIds" resultType="int">
 		SELECT id_ FROM organization WHERE parent_organ_id_tag_ LIKE CONCAT(#{parentOrganIdTag}, '%');
 	</select>
+	<select id="getNextLevelOrganIds" resultType="int">
+		SELECT id_ FROM organization WHERE parent_organ_id_ =#{organId};
+	</select>
 </mapper>