| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.mapper.AirconditionerStateMapper; |
| | | import com.whyc.pojo.AirconditionerState; |
| | | import com.whyc.pojo.Response; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class AirconditionerStateService { |
| | | @Autowired(required = false) |
| | | private AirconditionerStateMapper mapper; |
| | | |
| | | //获取空调实时数据 |
| | | public Response getStateSocket(int devId) { |
| | | QueryWrapper wrapper= Wrappers.query(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | AirconditionerState state=mapper.selectOne(wrapper); |
| | | return new Response().setII(1,state!=null,state,"获取空调实时数据"); |
| | | } |
| | | } |