whyclxw
2024-12-19 c27a9c7bce5b6b9607fa69ee5e5d1a3ad033e22c
查询当前用户授予权限的锁
2个文件已修改
31 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/UserInfController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/UserInfService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/UserInfController.java
@@ -75,5 +75,10 @@
    public Response getUnloadUinf(){
        return service.getUnloadUinf();
    }
    @GetMapping("getLockWithAuth")
    @ApiOperation(value = "查询当前用户授予权限的锁")
    public Response getLockWithAuth(){
        return service.getLockWithAuth();
    }
}
src/main/java/com/whyc/service/UserInfService.java
@@ -7,10 +7,17 @@
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.AreaInfMapper;
import com.whyc.mapper.AuthiruzeInfMapper;
import com.whyc.mapper.LockInfMapper;
import com.whyc.mapper.UserInfMapper;
import com.whyc.pojo.db_area.AreaInf;
import com.whyc.pojo.db_area.AuthiruzeInf;
import com.whyc.pojo.db_area.KeyInf;
import com.whyc.pojo.db_area.LockInf;
import com.whyc.pojo.db_user.UserInf;
import com.whyc.util.ActionUtil;
import com.whyc.util.MD5Util;
import com.whyc.util.PageInfoUtils;
import com.whyc.util.RSAUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UnknownAccountException;
@@ -33,6 +40,12 @@
    @Autowired(required = false)
    private AreaInfMapper ainfMapper;
    @Autowired(required = false)
    private AuthiruzeInfMapper authMapper;
    @Autowired(required = false)
    private LockInfMapper linfMapper;
    //查询所有用户信息
    public Response getAllUser(String uname,String realName,Integer role, int pageCurr, int pageSize) {
@@ -268,4 +281,17 @@
        List<UserInf> list=mapper.selectList(wrapper);
        return new Response().setII(1,list!=null,list,"查询未被指定区域的用户");
    }
    //查询当前用户授予权限的锁
    public Response getLockWithAuth() {
        UserInf uinf=ActionUtil.getUser();
        QueryWrapper authwrapper=new QueryWrapper();
        authwrapper.eq("uid",uinf.getUid());
        List<AuthiruzeInf> auth=authMapper.selectList(authwrapper);
        //获取锁信息
        List<Integer> lockIdList=auth.stream().map(AuthiruzeInf::getLockId).collect(Collectors.toList());
        QueryWrapper lockwrapper=new QueryWrapper();
        lockwrapper.in("lock_id",lockIdList);
        List<KeyInf> list=linfMapper.selectList(lockwrapper);
        return new Response().setII(1,list!=null,list,"查询当前用户授予权限的锁");
    }
}