| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.paramter.PowerInfPar; |
| | | import com.whyc.mapper.PowerInfMapper; |
| | | import com.whyc.pojo.PowerInf; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class PowerInfService { |
| | |
| | | return new Response().set(1,list,"查询成功"); |
| | | } |
| | | |
| | | public Response getExistStations(String stationName1,String stationName2,String stationName5){ |
| | | List<PowerInf> list = mapper.getExistStations(stationName1,stationName2,stationName5); |
| | | return new Response().set(1,list,"查询成功"); |
| | | public Response getExistStations(String stationName1, String stationName2, String stationName5) { |
| | | List<PowerInf> list = mapper.getExistStations(stationName1, stationName2, stationName5); |
| | | return new Response().set(1, list, "查询成功"); |
| | | } |
| | | |
| | | public Response getStations(Long userId,String stationName5){ |
| | | List<PowerInf> list = mapper.getStations(userId,stationName5); |
| | | return new Response().set(1,list,"查询成功"); |
| | | public Response getStations(Long userId, String stationName5) { |
| | | List<PowerInf> list = mapper.getStations(userId, stationName5); |
| | | return new Response().set(1, list, "查询成功"); |
| | | } |
| | | |
| | | public Response getPowerDevicesPage(int pageNum,int pageSize,Long uId,String stationId, String stationName1,String stationName2,String stationName5){ |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<PowerInf> list = mapper.getPowerDevicesPage(uId,stationId, stationName1, stationName2,stationName5); |
| | | public Response getPowerDevicesPage(int pageNum, int pageSize, Long uId, PowerInfPar powerInfPar) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<PowerInf> list = mapper.getPowerDevicesPage(uId, powerInfPar); |
| | | PageInfo<PowerInf> pageInfo = new PageInfo<>(list); |
| | | return new Response().set(1,pageInfo,"查询成功"); |
| | | return new Response().set(1, pageInfo, "查询成功"); |
| | | } |
| | | |
| | | public Response getPowerDevices(String stationId){ |
| | | public Response getPowerDevices(String stationId) { |
| | | QueryWrapper<PowerInf> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("stationid",stationId); |
| | | queryWrapper.eq("stationid", stationId); |
| | | List<PowerInf> list = mapper.selectList(queryWrapper); |
| | | return new Response().set(1,list,"查询成功"); |
| | | return new Response().set(1, list, "查询成功"); |
| | | } |
| | | |
| | | //查询某个电源的详细信息 |
| | |
| | | return new Response().set(1, powerInf); |
| | | } |
| | | |
| | | public Response getPwrInf(Long userId) { |
| | | List<PowerInf> list = mapper.getPwrInf(userId); |
| | | public Response getPwrInf(Long uId) { |
| | | List<PowerInf> list = mapper.getPwrInf(uId); |
| | | return new Response().set(1, list, "查询成功"); |
| | | } |
| | | |
| | | //获取所有的电源品牌 |
| | | public Response getPwrProducer() { |
| | | List<String> list = mapper.getPwrProducer(); |
| | | return new Response().setII(1, list.size() > 0 ? true : false, list, "获取所有的电源品牌"); |
| | | } |
| | | |
| | | public Response getModelList() { |
| | | QueryWrapper<PowerInf> query = Wrappers.query(); |
| | | query.select("distinct model"); |
| | | List<PowerInf> powerInfList = mapper.selectList(query); |
| | | List<String> modelList = powerInfList.stream().filter(model -> model != null).map(PowerInf::getModel).collect(Collectors.toList()); |
| | | return new Response().set(1, modelList); |
| | | |
| | | } |
| | | |
| | | //根据品牌查询型号 |
| | | public Response getModelListByPwrProducer(List<String> producer) { |
| | | QueryWrapper<PowerInf> query = Wrappers.query(); |
| | | query.select("distinct model"); |
| | | if (producer != null && producer.size() > 0) { |
| | | query.in("PowerProducer", producer); |
| | | } |
| | | List<PowerInf> powerInfList = mapper.selectList(query); |
| | | List<String> modelList = powerInfList.stream().filter(model -> model != null).map(PowerInf::getModel).collect(Collectors.toList()); |
| | | return new Response().set(1, modelList); |
| | | } |
| | | } |