whyclxw
2024-12-20 83dc30f4462a26a89b78fc5ec382e75260eb7062
根据mac检测蓝牙锁是否有权限
3个文件已修改
26 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/AuthiruzeInfController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/LockInfController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/AuthiruzeInfService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/AuthiruzeInfController.java
@@ -44,4 +44,10 @@
    public Response updateAuth(@RequestBody AuthiruzeInf auth){
        return service.updateAuth(auth);
    }
    @ApiOperation(value = "根据mac检测蓝牙锁是否有权限")
    @GetMapping("getAuthByUidAndMac")
    public Response getAuthByUidAndMac(@RequestParam Integer mac){
        return service.getAuthByUidAndMac(mac);
    }
}
src/main/java/com/whyc/controller/LockInfController.java
@@ -58,4 +58,5 @@
    public Response getLockRt(@RequestParam Integer areaId){
        return service.getLockRt(areaId);
    }
}
src/main/java/com/whyc/service/AuthiruzeInfService.java
@@ -9,10 +9,13 @@
import com.whyc.mapper.LockInfMapper;
import com.whyc.pojo.db_area.AuthiruzeInf;
import com.whyc.pojo.db_area.LockInf;
import com.whyc.pojo.db_user.UserInf;
import com.whyc.util.ActionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -94,4 +97,20 @@
        mapper.update(null,wrapper);
        return new Response().set(1,true);
    }
    //根据mac检测蓝牙锁是否有权限
    public Response getAuthByUidAndMac(Integer mac) {
        UserInf uinf= ActionUtil.getUser();
        //获取锁的id
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("lock_mac",mac);
        wrapper.last("limit 1");
        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检测蓝牙锁是否有权限");
    }
}