package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.whyc.dto.Response; import com.whyc.mapper.StationInfMapper; import com.whyc.pojo.db_batt.StationInf; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class StationInfService { @Autowired(required = false) private StationInfMapper mapper; //查询左侧机房信息列表 public Response getAllSinf() { List list=mapper.getAllSinf(); return new Response().setII(1,list!=null,list,"查询左侧机房信息列表"); } public StationInf getByStationName(String stationName) { QueryWrapper query = Wrappers.query(); query.eq("sinf_name",stationName); return mapper.selectOne(query); } public StationInf add(StationInf stationNew) { int stationId = mapper.getMaxStationId(); stationNew.setSinfId(stationId+1); mapper.insert(stationNew); return stationNew; } public int getMaxStationId() { return mapper.getMaxStationId(); } }