Преглед изворни кода

feat(system): 添加用户权限对应的金刚区查询功能

- 在 AppKongfuZoneServiceImpl 中实现 queryKongfuZone 方法
- 在 AppUserController 中添加 queryKongfuZone 接口
- 在 IAppKongfuZoneService 中声明 queryKongfuZone 接口- 优化了 AppKongfuZoneMapper 接口
SheepHy пре 4 дана
родитељ
комит
9d09b22de6

+ 16 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/AppUserController.java

@@ -5,15 +5,17 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.util.RedisUtil;
 import org.jeecg.modules.app.service.IUserService;
 import org.jeecg.modules.app.vo.LoginUserVO;
+import org.jeecg.modules.system.app.entity.AppKongfuZone;
+import org.jeecg.modules.system.app.service.IAppKongfuZoneService;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @Slf4j
 @Tag(name = "App用户相关接口")
@@ -22,9 +24,9 @@ import javax.annotation.Resource;
 public class AppUserController {
     @Resource
     private IUserService userService;
-    @Resource
-    private RedisUtil redisUtil;
 
+    @Resource
+    private IAppKongfuZoneService appKongfuZoneService;
 
     /**
      * 登录
@@ -66,4 +68,15 @@ public class AppUserController {
         return Result.ok(userService.getUserInfo());
     }
 
+
+    /**
+     * @Author SheepHy
+     * @Description 根据用户权限获取对应金刚区
+     * @Date 13:56 2025/8/13
+     **/
+    @GetMapping("/queryKongfuZone")
+    @Operation(summary = "根据用户权限获取对应金刚区")
+    public Result<List<AppKongfuZone>> queryKongfuZone(){
+        return Result.ok(appKongfuZoneService.queryKongfuZone());
+    }
 }

+ 0 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppKongfuZoneMapper.java

@@ -10,5 +10,4 @@ import org.jeecg.modules.system.app.entity.AppKongfuZone;
  * @Version: V1.0
  */
 public interface AppKongfuZoneMapper extends BaseMapper<AppKongfuZone> {
-
 }

+ 8 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppKongfuZoneService.java

@@ -3,8 +3,16 @@ package org.jeecg.modules.system.app.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.system.app.entity.AppKongfuZone;
 
+import java.util.List;
+
 /**
  * @Description: 首页金刚区管理
  */
 public interface IAppKongfuZoneService extends IService<AppKongfuZone> {
+    /**
+     * @Author SheepHy
+     * @Description 根据用户权限获取对应金刚区
+     * @Date 13:56 2025/8/13
+     **/
+    List<AppKongfuZone> queryKongfuZone();
 }

+ 13 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppKongfuZoneServiceImpl.java

@@ -1,11 +1,16 @@
 package org.jeecg.modules.system.app.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.system.app.entity.AppKongfuZone;
 import org.jeecg.modules.system.app.mapper.AppKongfuZoneMapper;
 import org.jeecg.modules.system.app.service.IAppKongfuZoneService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @Description: 首页金刚区管理
  * @Author: jeecg-boot
@@ -15,4 +20,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class AppKongfuZoneServiceImpl extends ServiceImpl<AppKongfuZoneMapper, AppKongfuZone> implements IAppKongfuZoneService {
 
+    @Override
+    public List<AppKongfuZone> queryKongfuZone() {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        return this.baseMapper.selectList(Wrappers.<AppKongfuZone>lambdaQuery()
+                .like(AppKongfuZone::getRoleCode, sysUser.getRoleCode())
+                .eq(AppKongfuZone::getIzShow, 1)
+                .orderByDesc(AppKongfuZone::getOrderNumber));
+    }
 }