Explorar o código

Merge remote-tracking branch 'origin/master'

‘linchangsheng’ hai 1 mes
pai
achega
b5b73214f4

+ 4 - 3
src/main/java/com/gree/mall/manager/controller/admin/AdminRoleController.java

@@ -27,12 +27,13 @@ public class AdminRoleController {
     @ApiOperation(value = "角色列表")
     public ResponseHelper<IPage<AdminRole>> list(
             HttpServletRequest request,
-            @ApiParam(value = "上级商户", required = true) @RequestParam String adminCompanyId,
-            @ApiParam(value = "适用机构 2:商家 1:商户 0:平台", required = true) @RequestParam Integer type,
+            @ApiParam(value = "商户名称") @RequestParam(required = false) String companyWechatName,
+            @ApiParam(value = "上级商户") @RequestParam(required = false) String adminCompanyId,
+            @ApiParam(value = "适用机构 2:商家 1:商户 0:平台") @RequestParam(required = false) Integer type,
             @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
             @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
     ) throws RemoteServiceException {
-        IPage<AdminRole> adminRoleIPage = adminRoleLogic.listPage(request, adminCompanyId, type, pageNum, pageSize);
+        IPage<AdminRole> adminRoleIPage = adminRoleLogic.listPage(request, companyWechatName, adminCompanyId, type, pageNum, pageSize);
         return ResponseHelper.success(adminRoleIPage);
     }
 

+ 2 - 1
src/main/java/com/gree/mall/manager/logic/admin/AdminRoleLogic.java

@@ -34,13 +34,14 @@ public class AdminRoleLogic {
     /**
      * 角色列表
      */
-    public IPage<AdminRole> listPage(HttpServletRequest request, String adminCompanyId, Integer type, Integer pageNo, Integer pageSize) {
+    public IPage<AdminRole> listPage(HttpServletRequest request, String companyWechatName, String adminCompanyId, Integer type, Integer pageNo, Integer pageSize) {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
         List<String> companyWechatIds = adminUser.getAdminCompanyIds();
 
         Integer userType = this.checkUserType(adminUser);
 
         return adminRoleService.lambdaQuery()
+                .eq(StringUtils.isNotBlank(companyWechatName), AdminRole::getCompanyName, companyWechatName)
                 .eq(StringUtils.isNotBlank(adminCompanyId), AdminRole::getCompanyWechatId, adminCompanyId)
                 .eq(Objects.nonNull(type), AdminRole::getType, type)
                 .in(CollectionUtils.isNotEmpty(companyWechatIds), AdminRole::getCompanyWechatId, companyWechatIds)

+ 16 - 1
src/main/java/com/gree/mall/manager/logic/admin/AdminUserLogic.java

@@ -101,7 +101,7 @@ public class AdminUserLogic {
      */
     public AdminUserCom login(String userName, String password, String code, String codeValue) throws RemoteServiceException {
         String value = (String) redisUtil.get(RedisPrefixEnum.TOKEN_NEW_VERIFICATION + code);
-        if (!value.equals(codeValue)) {
+        if (StringUtils.isBlank(value) || !value.equals(codeValue)) {
             throw new RemoteServiceException("验证码错误");
         }
         AdminUser adminUser = adminUserService.lambdaQuery()
@@ -318,7 +318,15 @@ public class AdminUserLogic {
      */
     public IPage<AdminUser> list(String roleId, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
+
+        Set<String> adminUserIdList = new HashSet<>();
+        if (!adminUser.getUserName().equals("admin")) {
+            // 非admin账号,筛选能看的账号
+            this.queryCanSeeAdminUser(adminUserIdList, adminUser);
+        }
+
         IPage<AdminUser> page = adminUserService.lambdaQuery()
+                .in(CollectionUtil.isNotEmpty(adminUserIdList), AdminUser::getAdminUserId, adminUserIdList)
                 .eq(StringUtils.isNotEmpty(roleId), AdminUser::getRoleId, roleId)
                 .eq(status != null, AdminUser::getStatus, status)
                 .in(CollectionUtils.isNotEmpty(adminUser.getAdminCompanyIds()), AdminUser::getCompanyWechatId, adminUser.getAdminCompanyIds())
@@ -326,6 +334,13 @@ public class AdminUserLogic {
         return page;
     }
 
+    private void queryCanSeeAdminUser(Set<String> adminUserIdList, AdminUserCom adminUser) {
+        final List<AdminUserPermissionsRela> permissionsRelaList = adminUserPermissionsRelaService.lambdaQuery()
+                .eq(AdminUserPermissionsRela::getAdminUserId, adminUser.getAdminUserId())
+                .list();
+
+    }
+
 
     /**
      * 商户列表

+ 0 - 4
src/main/resources/mapper/CommonMapper.xml

@@ -20,9 +20,5 @@
         FROM
             admin_company a
         ${ex.query}
-        <if test="ex.orderBy == null or ex.orderBy ==''">
-            ORDER BY a.create_time DESC
-        </if>
-        ${ex.orderBy}
     </select>
 </mapper>