mirror of https://gitee.com/topiam/eiam
门户端应用管理优化
parent
a094605649
commit
9a5c6d68d6
|
@ -15,11 +15,12 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package cn.topiam.employee.portal.pojo.query;
|
package cn.topiam.employee.common.entity.app.query;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -39,14 +40,17 @@ public class GetAppListQuery implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = -4981513177967939516L;
|
private static final long serialVersionUID = -4981513177967939516L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name
|
* 应用名称
|
||||||
*/
|
*/
|
||||||
|
@Parameter(description = "应用名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* groupId
|
* 应用分组ID
|
||||||
*/
|
*/
|
||||||
|
@Parameter(description = "应用分组ID")
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,6 +19,7 @@ package cn.topiam.employee.common.repository.app;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.topiam.employee.common.entity.app.query.GetAppListQuery;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
@ -37,12 +38,12 @@ public interface AppRepositoryCustomized {
|
||||||
*
|
*
|
||||||
* 获取我的应用列表
|
* 获取我的应用列表
|
||||||
*
|
*
|
||||||
* @param name {@link String}
|
|
||||||
* @param userId {@link Long}
|
* @param userId {@link Long}
|
||||||
|
* @param query {@link GetAppListQuery}
|
||||||
* @param pageable {@link Pageable}
|
* @param pageable {@link Pageable}
|
||||||
* @return {@link List}
|
* @return {@link List}
|
||||||
*/
|
*/
|
||||||
Page<AppEntity> getAppList(Long userId, String name, Long groupId, Pageable pageable);
|
Page<AppEntity> getAppList(Long userId, GetAppListQuery query, Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import cn.topiam.employee.common.entity.app.query.GetAppListQuery;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
@ -56,13 +57,13 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized {
|
||||||
/**
|
/**
|
||||||
* 获取我的应用列表
|
* 获取我的应用列表
|
||||||
*
|
*
|
||||||
* @param name {@link String}
|
|
||||||
* @param userId {@link Long}
|
* @param userId {@link Long}
|
||||||
|
* @param query {@link query}
|
||||||
* @param pageable {@link String}
|
* @param pageable {@link String}
|
||||||
* @return {@link List}
|
* @return {@link List}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<AppEntity> getAppList(Long userId, String name, Long groupId, Pageable pageable) {
|
public Page<AppEntity> getAppList(Long userId, GetAppListQuery query, Pageable pageable) {
|
||||||
List<Object> paramList = Lists.newArrayList();
|
List<Object> paramList = Lists.newArrayList();
|
||||||
//当前用户加入的用户组Id
|
//当前用户加入的用户组Id
|
||||||
List<Long> groupIdList = userGroupMemberRepository.findByUserId(userId).stream()
|
List<Long> groupIdList = userGroupMemberRepository.findByUserId(userId).stream()
|
||||||
|
@ -89,12 +90,12 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized {
|
||||||
AND (app_acce.subject_id IN (:subjectIds) OR app.authorization_type = 'all_access')
|
AND (app_acce.subject_id IN (:subjectIds) OR app.authorization_type = 'all_access')
|
||||||
""");
|
""");
|
||||||
//用户名
|
//用户名
|
||||||
if (StringUtils.isNoneBlank(name)) {
|
if (StringUtils.isNoneBlank(query.getName())) {
|
||||||
builder.append(" AND app.name_ like '%").append(name).append("%'");
|
builder.append(" AND app.name_ like '%").append(query.getName()).append("%'");
|
||||||
}
|
}
|
||||||
//分组id
|
//分组id
|
||||||
if (null!=groupId) {
|
if (Objects.nonNull(query.getGroupId())) {
|
||||||
builder.append(" AND ass.group_id = ").append(groupId);
|
builder.append(" AND ass.group_id = ").append(query.getGroupId());
|
||||||
}
|
}
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
String sql = builder.toString();
|
String sql = builder.toString();
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import cn.topiam.employee.common.entity.app.query.AppGroupQuery;
|
import cn.topiam.employee.common.entity.app.query.AppGroupQuery;
|
||||||
import cn.topiam.employee.portal.pojo.query.GetAppListQuery;
|
import cn.topiam.employee.common.entity.app.query.GetAppListQuery;
|
||||||
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
||||||
import cn.topiam.employee.portal.pojo.result.GetAppListResult;
|
import cn.topiam.employee.portal.pojo.result.GetAppListResult;
|
||||||
import cn.topiam.employee.portal.service.AppService;
|
import cn.topiam.employee.portal.service.AppService;
|
||||||
|
|
|
@ -20,7 +20,7 @@ package cn.topiam.employee.portal.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.topiam.employee.common.entity.app.query.AppGroupQuery;
|
import cn.topiam.employee.common.entity.app.query.AppGroupQuery;
|
||||||
import cn.topiam.employee.portal.pojo.query.GetAppListQuery;
|
import cn.topiam.employee.common.entity.app.query.GetAppListQuery;
|
||||||
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
||||||
import cn.topiam.employee.portal.pojo.result.GetAppListResult;
|
import cn.topiam.employee.portal.pojo.result.GetAppListResult;
|
||||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import cn.topiam.employee.common.repository.app.AppGroupRepository;
|
||||||
import cn.topiam.employee.common.repository.app.AppRepository;
|
import cn.topiam.employee.common.repository.app.AppRepository;
|
||||||
import cn.topiam.employee.portal.converter.AppConverter;
|
import cn.topiam.employee.portal.converter.AppConverter;
|
||||||
import cn.topiam.employee.portal.converter.AppGroupConverter;
|
import cn.topiam.employee.portal.converter.AppGroupConverter;
|
||||||
import cn.topiam.employee.portal.pojo.query.GetAppListQuery;
|
import cn.topiam.employee.common.entity.app.query.GetAppListQuery;
|
||||||
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
||||||
import cn.topiam.employee.portal.pojo.result.GetAppListResult;
|
import cn.topiam.employee.portal.pojo.result.GetAppListResult;
|
||||||
import cn.topiam.employee.portal.service.AppService;
|
import cn.topiam.employee.portal.service.AppService;
|
||||||
|
@ -56,8 +56,7 @@ public class AppServiceImpl implements AppService {
|
||||||
public Page<GetAppListResult> getAppList(GetAppListQuery query, PageModel pageModel) {
|
public Page<GetAppListResult> getAppList(GetAppListQuery query, PageModel pageModel) {
|
||||||
Long userId = Long.valueOf(SecurityUtils.getCurrentUserId());
|
Long userId = Long.valueOf(SecurityUtils.getCurrentUserId());
|
||||||
org.springframework.data.domain.Page<AppEntity> list = appRepository.getAppList(userId,
|
org.springframework.data.domain.Page<AppEntity> list = appRepository.getAppList(userId,
|
||||||
query.getName(), query.getGroupId(),
|
query, QPageRequest.of(pageModel.getCurrent(), pageModel.getPageSize()));
|
||||||
QPageRequest.of(pageModel.getCurrent(), pageModel.getPageSize()));
|
|
||||||
return appConverter.entityConvertToAppListResult(list);
|
return appConverter.entityConvertToAppListResult(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue