Преглед на файлове

商家pc端 分权限 第四笔提交

liudongzhi преди 3 месеца
родител
ревизия
9a2e46f0e5

+ 1 - 1
alien-entity/src/main/resources/mapper/StorePlatformUserRoleMapper.xml

@@ -17,7 +17,7 @@
         INNER JOIN store_user sur ON spur.user_id = sur.id
         LEFT JOIN store_platform_role spr ON spur.role_id = spr.role_id
         WHERE spur.store_id = #{storeId}
-          AND sur.account_type = 2
+--           AND sur.account_type = 2
           AND sur.delete_flag = 0
         <if test="accountName != null and accountName != ''">
             AND (sur.name LIKE CONCAT('%', #{accountName}, '%') OR sur.nick_name LIKE CONCAT('%', #{accountName}, '%'))

+ 22 - 32
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/StorePlatformUserRoleController.java

@@ -1,11 +1,13 @@
 package shop.alien.storeplatform.controller;
 
 import io.swagger.annotations.*;
-import lombok.Data;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
+import shop.alien.entity.store.vo.SubAccountVo;
+import shop.alien.storeplatform.dto.AssignRolesDto;
+import shop.alien.storeplatform.dto.CreateAccountDto;
 import shop.alien.storeplatform.service.StorePlatformUserRoleService;
 import shop.alien.storeplatform.annotation.PlatformOperationLog;
 
@@ -133,39 +135,27 @@ public class StorePlatformUserRoleController {
         return R.fail("创建账号并分配角色失败");
     }
 
-    /**
-     * 分配角色请求DTO
-     */
-    @Data
-    @ApiModel(value = "AssignRolesDto", description = "分配角色请求参数")
-    static class AssignRolesDto {
-        @ApiModelProperty(value = "用户ID", required = true)
-        private Integer userId;
 
-        @ApiModelProperty(value = "角色ID列表", required = true)
-        private List<Long> roleIds;
-
-        @ApiModelProperty(value = "店铺ID", required = true)
-        private Integer storeId;
+    @ApiOperation("查询当前店铺下的子账号列表")
+    @ApiOperationSupport(order = 7)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "storeId", value = "店铺ID", dataType = "int", paramType = "query", required = true),
+            @ApiImplicitParam(name = "accountName", value = "账号名称(模糊查询)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "phone", value = "手机号(模糊查询)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "roleName", value = "角色名称(模糊查询)", dataType = "String", paramType = "query", required = false)
+    })
+    @GetMapping("/querySubAccounts")
+    public R<List<SubAccountVo>> querySubAccounts(
+            @RequestParam("storeId") Integer storeId,
+            @RequestParam(value = "accountName", required = false) String accountName,
+            @RequestParam(value = "phone", required = false) String phone,
+            @RequestParam(value = "roleName", required = false) String roleName) {
+        log.info("StorePlatformUserRoleController.querySubAccounts?storeId={}, accountName={}, phone={}, roleName={}",
+                storeId, accountName, phone, roleName);
+        List<SubAccountVo> subAccountList = storePlatformUserRoleService.querySubAccounts(
+                storeId, accountName, phone, roleName);
+        return R.data(subAccountList);
     }
 
-    /**
-     * 创建账号请求DTO
-     */
-    @Data
-    @ApiModel(value = "CreateAccountDto", description = "创建账号请求参数")
-    static class CreateAccountDto {
-        @ApiModelProperty(value = "手机号", required = true)
-        private String phone;
-
-        @ApiModelProperty(value = "账号名称")
-        private String accountName;
-
-        @ApiModelProperty(value = "店铺ID", required = true)
-        private Integer storeId;
-
-        @ApiModelProperty(value = "角色ID", required = true)
-        private Long roleId;
-    }
 }