mirror of https://gitee.com/topiam/eiam
应用详情返回应用组ID
parent
00447e2ede
commit
6cb2c043cc
|
@ -26,6 +26,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import cn.topiam.employee.common.entity.app.AppGroupAssociationEntity;
|
||||
import cn.topiam.employee.support.repository.LogicDeleteRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||
|
||||
/**
|
||||
|
@ -73,4 +76,14 @@ public interface AppGroupAssociationRepository extends
|
|||
* @param appId {@link Long}
|
||||
*/
|
||||
void deleteByAppId(Long appId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据应用ID 查询关联信息
|
||||
*
|
||||
* @param appId {@link Long}
|
||||
* @return {@link List}
|
||||
*/
|
||||
@Query(value = "SELECT group_id FROM `app_group_association` WHERE app_id = :appId AND is_deleted = '0'", nativeQuery = true)
|
||||
List<Long> findGroupIdByAppId(Long appId);
|
||||
}
|
||||
|
|
|
@ -135,9 +135,10 @@ public interface AppConverter {
|
|||
* 实体转应用返回
|
||||
*
|
||||
* @param entity {@link AppEntity}
|
||||
* @param groupIds {@link List}
|
||||
* @return {@link AppGetResult}
|
||||
*/
|
||||
default AppGetResult entityConvertToAppResult(AppEntity entity) {
|
||||
default AppGetResult entityConvertToAppResult(AppEntity entity,List<Long> groupIds) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -150,6 +151,7 @@ public interface AppConverter {
|
|||
appGetResult.setClientId(entity.getClientId());
|
||||
appGetResult.setClientSecret(entity.getClientSecret());
|
||||
appGetResult.setType(entity.getType());
|
||||
appGetResult.setGroupIds(groupIds);
|
||||
//图标未配置,所以先从模版中拿
|
||||
if (StringUtils.isBlank(entity.getIcon())) {
|
||||
ApplicationService applicationService = getApplicationServiceLoader()
|
||||
|
|
|
@ -19,6 +19,7 @@ package cn.topiam.employee.console.pojo.result.app;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppProtocol;
|
||||
import cn.topiam.employee.common.enums.app.AppType;
|
||||
|
@ -104,4 +105,11 @@ public class AppGetResult implements Serializable {
|
|||
*/
|
||||
@Parameter(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 应用组ID集合
|
||||
*/
|
||||
@Parameter(description = "应用组ID集合")
|
||||
private List<Long> groupIds;
|
||||
}
|
||||
|
|
|
@ -154,7 +154,8 @@ public class AppServiceImpl implements AppService {
|
|||
Optional<AppEntity> optional = appRepository.findById(id);
|
||||
if (optional.isPresent()) {
|
||||
AppEntity entity = optional.get();
|
||||
return appConverter.entityConvertToAppResult(entity);
|
||||
List<Long> groupIds = appGroupAssociationRepository.findGroupIdByAppId(id);
|
||||
return appConverter.entityConvertToAppResult(entity,groupIds);
|
||||
}
|
||||
return null;
|
||||
|
||||
|
|
Loading…
Reference in New Issue