Selaa lähdekoodia

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

liudongzhi 3 kuukautta sitten
vanhempi
commit
12e65c0de0

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

@@ -20,6 +20,7 @@
         WHERE spur.store_id = #{storeId}
 --           AND sur.account_type = 2
           AND sur.delete_flag = 0
+          AND spur.delete_flag = 0
         <if test="accountName != null and accountName != ''">
             AND (sur.name LIKE CONCAT('%', #{accountName}, '%') OR sur.nick_name LIKE CONCAT('%', #{accountName}, '%'))
         </if>

+ 7 - 4
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/StorePlatformUserRoleController.java

@@ -167,14 +167,17 @@ public class StorePlatformUserRoleController {
     @ApiOperationSupport(order = 8)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "userId", value = "用户ID", dataType = "int", paramType = "query", required = true),
-            @ApiImplicitParam(name = "storeId", value = "店铺ID", dataType = "int", paramType = "query", required = true)
+            @ApiImplicitParam(name = "storeId", value = "店铺ID", dataType = "int", paramType = "query", required = true),
+            @ApiImplicitParam(name = "roleIdNew", value = "角色ID", dataType = "Long", paramType = "query", required = true)
     })
     @GetMapping("/getSubAccountDetail")
     public R<SubAccountDetailVo> getSubAccountDetail(
             @RequestParam("userId") Integer userId,
-            @RequestParam("storeId") Integer storeId) {
-        log.info("StorePlatformUserRoleController.getSubAccountDetail?userId={}, storeId={}", userId, storeId);
-        SubAccountDetailVo detail = storePlatformUserRoleService.getSubAccountDetail(userId, storeId);
+            @RequestParam("storeId") Integer storeId,
+            @RequestParam("roleIdNew") Long roleIdNew
+            ) {
+        log.info("StorePlatformUserRoleController.getSubAccountDetail?userId={}, storeId={},roleIdNew={}", userId, storeId,roleIdNew);
+        SubAccountDetailVo detail = storePlatformUserRoleService.getSubAccountDetail(userId, storeId, roleIdNew);
         if (detail == null) {
             return R.fail("子账号不存在");
         }

+ 1 - 1
alien-store-platform/src/main/java/shop/alien/storeplatform/service/StorePlatformUserRoleService.java

@@ -97,7 +97,7 @@ public interface StorePlatformUserRoleService extends IService<StorePlatformUser
      * @param storeId 店铺ID
      * @return 子账号详情
      */
-    SubAccountDetailVo getSubAccountDetail(Integer userId, Integer storeId);
+    SubAccountDetailVo getSubAccountDetail(Integer userId, Integer storeId, Long roleIdNew);
 
     /**
      * 批量逻辑删除子账号(删除用户角色关联关系)

+ 3 - 1
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StorePlatformUserRoleServiceImpl.java

@@ -158,6 +158,7 @@ public class StorePlatformUserRoleServiceImpl extends ServiceImpl<StorePlatformU
                 userRole.setUserId(userId);
                 userRole.setRoleId(roleId);
                 userRole.setStoreId(storeId);
+                userRole.setDeleteFlag(0);
                 userRole.setCreatedTime(new Date());
                 
                 boolean insertRoleResult = this.save(userRole);
@@ -208,7 +209,7 @@ public class StorePlatformUserRoleServiceImpl extends ServiceImpl<StorePlatformU
     }
 
     @Override
-    public SubAccountDetailVo getSubAccountDetail(Integer userId, Integer storeId) {
+    public SubAccountDetailVo getSubAccountDetail(Integer userId, Integer storeId , Long roleIdNew) {
         if (userId == null || storeId == null) {
             log.error("用户ID或店铺ID不能为空: userId={}, storeId={}", userId, storeId);
             return null;
@@ -236,6 +237,7 @@ public class StorePlatformUserRoleServiceImpl extends ServiceImpl<StorePlatformU
             // 2. 查询用户角色关联(根据userId和storeId查询)
             LambdaQueryWrapper<StorePlatformUserRole> userRoleQueryWrapper = new LambdaQueryWrapper<>();
             userRoleQueryWrapper.eq(StorePlatformUserRole::getUserId, userId)
+                    .eq(StorePlatformUserRole::getRoleId, roleIdNew)
                     .eq(StorePlatformUserRole::getStoreId, storeId);
             StorePlatformUserRole userRole = storePlatformUserRoleMapper.selectOne(userRoleQueryWrapper);