From 17649b6bc816b9059b0a7b83e8acf56d287d7cc4 Mon Sep 17 00:00:00 2001 From: shao1121353141 <> Date: Mon, 25 Sep 2023 19:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/entity/app}/query/GetAppListQuery.java | 2 +- .../repository/app/AppRepositoryCustomized.java | 5 +++-- .../app/impl/AppRepositoryCustomizedImpl.java | 13 +++++++------ .../employee/portal/controller/AppController.java | 2 +- .../topiam/employee/portal/service/AppService.java | 2 +- .../portal/service/impl/AppServiceImpl.java | 5 ++--- 6 files changed, 15 insertions(+), 14 deletions(-) rename {eiam-portal/src/main/java/cn/topiam/employee/portal/pojo => eiam-common/src/main/java/cn/topiam/employee/common/entity/app}/query/GetAppListQuery.java (96%) diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppListQuery.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQuery.java similarity index 96% rename from eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppListQuery.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQuery.java index e34820f8..63976272 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppListQuery.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQuery.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.portal.pojo.query; +package cn.topiam.employee.common.entity.app.query; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java index bea2c11f..6665bc28 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java @@ -19,6 +19,7 @@ package cn.topiam.employee.common.repository.app; import java.util.List; +import cn.topiam.employee.common.entity.app.query.GetAppListQuery; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -37,12 +38,12 @@ public interface AppRepositoryCustomized { * * 获取我的应用列表 * - * @param name {@link String} * @param userId {@link Long} + * @param query {@link GetAppListQuery} * @param pageable {@link Pageable} * @return {@link List} */ - Page getAppList(Long userId, String name, Long groupId, Pageable pageable); + Page getAppList(Long userId, GetAppListQuery query, Pageable pageable); /** * diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java index dcf78380..23dd7a63 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import cn.topiam.employee.common.entity.app.query.GetAppListQuery; import org.apache.commons.lang3.StringUtils; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -56,13 +57,13 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized { /** * 获取我的应用列表 * - * @param name {@link String} * @param userId {@link Long} + * @param query {@link query} * @param pageable {@link String} * @return {@link List} */ @Override - public Page getAppList(Long userId, String name, Long groupId, Pageable pageable) { + public Page getAppList(Long userId, GetAppListQuery query, Pageable pageable) { List paramList = Lists.newArrayList(); //当前用户加入的用户组Id List 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') """); //用户名 - if (StringUtils.isNoneBlank(name)) { - builder.append(" AND app.name_ like '%").append(name).append("%'"); + if (StringUtils.isNoneBlank(query.getName())) { + builder.append(" AND app.name_ like '%").append(query.getName()).append("%'"); } //分组id - if (Objects.nonNull(groupId)) { - builder.append(" AND ass.group_id = ").append(groupId); + if (Objects.nonNull(query.getGroupId())) { + builder.append(" AND ass.group_id = ").append(query.getGroupId()); } //@formatter:on String sql = builder.toString(); diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java index 440a7981..49c3db6a 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; 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.GetAppListResult; import cn.topiam.employee.portal.service.AppService; diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java index 3163ea14..c5b1b516 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java @@ -20,7 +20,7 @@ package cn.topiam.employee.portal.service; import java.util.List; 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.GetAppListResult; import cn.topiam.employee.support.repository.page.domain.Page; diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java index 807d7063..5da76eb4 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java @@ -29,7 +29,7 @@ import cn.topiam.employee.common.repository.app.AppGroupRepository; import cn.topiam.employee.common.repository.app.AppRepository; import cn.topiam.employee.portal.converter.AppConverter; 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.GetAppListResult; import cn.topiam.employee.portal.service.AppService; @@ -56,8 +56,7 @@ public class AppServiceImpl implements AppService { public Page getAppList(GetAppListQuery query, PageModel pageModel) { Long userId = Long.valueOf(SecurityUtils.getCurrentUserId()); org.springframework.data.domain.Page list = appRepository.getAppList(userId, - query.getName(), query.getGroupId(), - QPageRequest.of(pageModel.getCurrent(), pageModel.getPageSize())); + query, QPageRequest.of(pageModel.getCurrent(), pageModel.getPageSize())); return appConverter.entityConvertToAppListResult(list); }