| | |
| | | //根据mac检测蓝牙锁是否有权限 |
| | | public Response getAuthByUidAndMac(Integer mac) { |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | //获取锁的id |
| | | List areaList=new ArrayList(); |
| | | areaList.add(uinf.getAreaId()); |
| | | areaInfService.getAllAreaId(uinf.getAreaId(),areaList); |
| | | //获取锁是否在人管理的区域下面 |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("lock_mac",mac); |
| | | wrapper.last("limit 1"); |
| | | wrapper.in("area_id",areaList); |
| | | LockInf linf=lockInfMapper.selectOne(wrapper); |
| | | //检测是否有权限 |
| | | QueryWrapper wrapper1=new QueryWrapper(); |
| | | wrapper1.eq("uname",uinf.getUname()); |
| | | wrapper1.eq("lock_id",linf.getLockId()); |
| | | wrapper1.last("limit 1"); |
| | | AuthiruzeInf auth=mapper.selectOne(wrapper1); |
| | | return new Response().set(1,auth!=null,"根据mac检测蓝牙锁是否有权限"); |
| | | if(linf==null){ |
| | | return new Response().set(1,false,"没有权限"); |
| | | }else{ |
| | | //检测是否有权限 |
| | | QueryWrapper wrapper1=new QueryWrapper(); |
| | | wrapper1.eq("uname",uinf.getUname()); |
| | | wrapper1.eq("lock_id",linf.getLockId()); |
| | | wrapper1.last("limit 1"); |
| | | AuthiruzeInf auth=mapper.selectOne(wrapper1); |
| | | return new Response().set(1,auth!=null,"有权限"); |
| | | } |
| | | } |
| | | } |