src/main/java/com/whyc/controller/AppController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/LockInfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/AuthiruzeInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/LockInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/AppController.java
@@ -24,7 +24,7 @@ @ApiOperation(value = "普通用户登录查看自己授权记录--普通用户") @ApiOperation(value = "普通用户登录查看自己授权锁记录--普通用户") @GetMapping("getAuthByUid") public Response getAuthByUid(String uname){ return authService.getAuthByUid(uname); src/main/java/com/whyc/mapper/LockInfMapper.java
@@ -15,6 +15,7 @@ //查看区域下所有的锁 List<LockInf> selectAllLockById(@Param("areaList") List<Integer> areaList); //根据锁的id查询锁的记录 LockInf selectlinfByLockId(Integer lockId); //根据锁的lockIds查询锁的记录 List<LockInf> selectlinfByLockIds(@Param("lockIds") List<Integer> lockIds); } src/main/java/com/whyc/service/AuthiruzeInfService.java
@@ -5,9 +5,11 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.dto.Response; import com.whyc.mapper.AreaUserMapper; import com.whyc.mapper.AuthiruzeInfMapper; import com.whyc.mapper.LockInfMapper; import com.whyc.mapper.UserInfMapper; import com.whyc.pojo.db_area.AreaUser; import com.whyc.pojo.db_area.AuthIdcard; import com.whyc.pojo.db_area.AuthiruzeInf; import com.whyc.pojo.db_area.LockInf; @@ -41,6 +43,7 @@ @Autowired(required = false) private UserInfMapper uinfMapper; //查询所有授权信息 public Response getAllAuthInf( String uname, int areaId,int pageNum, int pageSize) { @@ -199,20 +202,19 @@ return new Response().set(1,auth!=null,auth!=null?"有权限":"没有权限"); } } //普通用户登录查看自己授权记录-----app //普通用户登录查看自己授权锁记录-----app public Response getAuthByUid(String uname) { UserInf uinf=uinfMapper.getUinfByUname(uname); //UserInf uinf=uinfMapper.getUinfByUname(uname); //查询普通用户对应的区域 QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("uname",uinf.getUname()); wrapper.select("distinct lock_id"); wrapper.eq("uname",uname); wrapper.eq("key_id",0);//蓝牙钥匙 List<AuthiruzeInf> list=mapper.selectList(wrapper); if(list!=null){ for (AuthiruzeInf auth:list) { //根据锁的id查询锁的记录 LockInf linf=lockInfMapper.selectlinfByLockId(auth.getLockId()); auth.setLinf(linf); } } return new Response().setII(1,list!=null,list,"普通用户登录查看自己授权记录-----app"); List<Integer> lockIds=list.stream().map(AuthiruzeInf::getLockId) // 提取id .collect(Collectors.toList()); //根据锁的lockIds查询锁的记录 List<LockInf> linfs=lockInfMapper.selectlinfByLockIds(lockIds); return new Response().setII(1,linfs!=null,linfs,"普通用户登录查看自己授权记录-----app"); } } src/main/resources/mapper/LockInfMapper.xml
@@ -40,11 +40,17 @@ </where> order by id asc </select> <select id="selectlinfByLockId" resultType="com.whyc.pojo.db_area.LockInf"> <select id="selectlinfByLockIds" resultType="com.whyc.pojo.db_area.LockInf"> select tb_lock_inf.*,tb_area_inf.area_name,tb_area_inf.area_path from db_area.tb_lock_inf,db_area.tb_area_inf <where> tb_lock_inf.area_id=tb_area_inf.id and lock_id=#{lockId} <if test="lockIds!=null"> and lock_id in <foreach collection="lockIds" item="lockId" open="(" separator="," close=")"> #{lockId} </foreach> </if> </where> </select> </mapper>