|
|
@@ -17,10 +17,7 @@ import com.zhongshu.card.client.model.org.*;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
|
import com.zhongshu.card.client.service.org.OrganizationService;
|
|
|
-import com.zhongshu.card.client.utils.type.OrganizationState;
|
|
|
-import com.zhongshu.card.client.utils.type.OrganizationUserType;
|
|
|
-import com.zhongshu.card.client.utils.type.RoleType;
|
|
|
-import com.zhongshu.card.client.utils.type.UserState;
|
|
|
+import com.zhongshu.card.client.utils.type.*;
|
|
|
import com.zhongshu.card.server.core.dao.org.*;
|
|
|
import com.zhongshu.card.server.core.dataConfig.CardDefault;
|
|
|
import com.zhongshu.card.server.core.domain.org.*;
|
|
|
@@ -188,7 +185,8 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
|
|
|
ResultContent<Organization> resultContent = addOrganization(addParam);
|
|
|
if (resultContent.isSuccess()) {
|
|
|
Organization main = resultContent.getContent();
|
|
|
- OrganizationRelation organizationRelation = organizationRelationDao.findTopByMainOrganizationAndAuthType(main, AuthType.School);
|
|
|
+ OrganizationRelation organizationRelation = organizationRelationDao
|
|
|
+ .findTopByMainOrganizationAndRelationType(main, OrganizationRelationType.SchoolToProject);
|
|
|
if (ObjectUtils.isEmpty(organizationRelation)) {
|
|
|
organizationRelation = new OrganizationRelation();
|
|
|
}
|
|
|
@@ -228,13 +226,15 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
|
|
|
BeanUtils.copyProperties(param, main);
|
|
|
|
|
|
// 找出关联的项目
|
|
|
- OrganizationRelation organizationRelation = organizationRelationDao.findTopByMainOrganizationAndAuthType(main, AuthType.School);
|
|
|
+ OrganizationRelation organizationRelation = organizationRelationDao
|
|
|
+ .findTopByMainOrganizationAndRelationType(main, OrganizationRelationType.SchoolToProject);
|
|
|
if (ObjectUtils.isEmpty(organizationRelation)) {
|
|
|
organizationRelation = new OrganizationRelation();
|
|
|
}
|
|
|
organizationRelation.setAuthType(AuthType.School);
|
|
|
organizationRelation.setMainOrganization(main);
|
|
|
organizationRelation.setRelOrganization(organization);
|
|
|
+ organizationRelation.setRelationType(OrganizationRelationType.SchoolToProject);
|
|
|
organizationRelationDao.save(organizationRelation);
|
|
|
|
|
|
return ResultContent.buildSuccess();
|
|
|
@@ -336,8 +336,10 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
|
|
|
// 学校查询的特有参数
|
|
|
if (param.getAuthType() == AuthType.School) {
|
|
|
if (StringUtils.isNotEmpty(param.getProjectOid())) {
|
|
|
+ // 查询项目已绑定的学校数据
|
|
|
Organization organization = organizationDao.findTopByOid(param.getProjectOid());
|
|
|
- List<OrganizationRelation> list = organizationRelationDao.findByRelOrganizationAndAuthType(organization, AuthType.School);
|
|
|
+ List<OrganizationRelation> list = organizationRelationDao
|
|
|
+ .findByRelOrganizationAndRelationType(organization, OrganizationRelationType.SchoolToProject);
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
List<String> oids = list.stream().map(it -> {
|
|
|
return it.getOid();
|
|
|
@@ -611,7 +613,8 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
|
|
|
// 判断不同的类型
|
|
|
if (entity.getAuthType() == AuthType.School) {
|
|
|
// 学校:查询出关联的项目信息
|
|
|
- OrganizationRelation organization = organizationRelationDao.findTopByMainOrganizationAndAuthType(entity, AuthType.School);
|
|
|
+ OrganizationRelation organization = organizationRelationDao
|
|
|
+ .findTopByMainOrganizationAndRelationType(entity, OrganizationRelationType.SchoolToProject);
|
|
|
if (ObjectUtils.isNotEmpty(organization)) {
|
|
|
model.setProjectModel(toSimpleModel(organization.getRelOrganization()));
|
|
|
}
|
|
|
@@ -644,7 +647,8 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
BeanUtils.copyProperties(entity, model);
|
|
|
// 统计学校数量
|
|
|
- Long number = organizationRelationDao.countByRelOrganizationAndAuthType(entity, AuthType.School);
|
|
|
+ Long number = organizationRelationDao
|
|
|
+ .countByRelOrganizationAndRelationType(entity, OrganizationRelationType.SchoolToProject);
|
|
|
model.setSchoolNumber(number);
|
|
|
}
|
|
|
return model;
|