| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.AreaInfMapper; |
| | | import com.whyc.mapper.KeyInfMapper; |
| | | import com.whyc.mapper.LockInfMapper; |
| | | import com.whyc.mapper.UserInfMapper; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_area.AreaInf; |
| | | import com.whyc.pojo.db_area.KeyInf; |
| | | import com.whyc.pojo.db_area.LockInf; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class AreaInfService { |
| | |
| | | |
| | | @Autowired(required = false) |
| | | private UserInfMapper uInfMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private LockCtlLogMapper ctlLogMapper; |
| | | |
| | | |
| | | //查询所有区域信息 |
| | |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(list,pageNum,pageSize); |
| | | return new Response().setII(1,list!=null,pageInfo,"查询所有区域下所有钥匙信息"); |
| | | } |
| | | //查询所在区域下所有开锁日志 |
| | | public Response getLogById(Integer id, int pageNum, int pageSize) { |
| | | //获取获取id下所有的区域id |
| | | List areaList=new ArrayList(); |
| | | areaList.add(id); |
| | | getAllAreaId(id,areaList); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.in("area_id",areaList); |
| | | List<LockInf> lockList=linfMapper.selectList(wrapper); |
| | | List<Integer> lockIdList=lockList.stream().map(LockInf::getLockId).collect(Collectors.toList()); |
| | | QueryWrapper logwrapper=new QueryWrapper(); |
| | | wrapper.in("lock_id",lockIdList); |
| | | List<KeyInf> list=ctlLogMapper.selectList(logwrapper); |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(list,pageNum,pageSize); |
| | | return new Response().setII(1,list!=null,pageInfo,"查询所在区域下所有开锁日志"); |
| | | } |
| | | } |