whyclxw
2024-11-13 c9f510b90f62a39e2c634578727dc0fb4b674e86
添加动环机房
2个文件已修改
27 ■■■■ 已修改文件
src/main/java/com/whyc/controller/CircleInfController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/CircleInfService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/CircleInfController.java
@@ -41,9 +41,9 @@
        int userId = ActionUtil.getUser().getUId().intValue();
        Response res = new Response();
        //校验机房站点是否存在,存在则不需要新建StationId
        StationInf sinf = sinfService.judgeStationName(circleInf.getStationName());
        if (sinf!=null) {
            circleInf.setStationId(sinf.getStationId());
        Battinf binf = service.judgeBattStationName3(circleInf);
        if (binf!=null) {
            circleInf.setStationId(binf.getStationId());
        }else {
            //站点不存在,需要新建站点记录
            String nextStationId = binfService.getNextStationId();
src/main/java/com/whyc/service/CircleInfService.java
@@ -5,8 +5,12 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.BattInfMapper;
import com.whyc.mapper.CircleInfMapper;
import com.whyc.pojo.Battinf;
import com.whyc.pojo.CircleInf;
import com.whyc.pojo.PowerInf;
import com.whyc.pojo.StationInf;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
@@ -18,6 +22,9 @@
    @Resource
    private CircleInfMapper mapper;
    @Resource
    private BattInfMapper battInfMapper;
    public int add(CircleInf circleInf){
        return mapper.insert(circleInf);
@@ -54,4 +61,18 @@
        List<CircleInf> list=mapper.selectList(null);
        return new Response().setII(1,list!=null,list,"获取动环下拉资产信息");
    }
    /**
     * 新:从站点表校验站点是否存在
     * 旧:电源添加前校验是否站点存在,从电池表+电源表查询,弃用
     * */
    public Battinf judgeBattStationName3(CircleInf cinf){
        Battinf battinf = new Battinf();
        battinf.setStationName1(cinf.getStationName1());
        battinf.setStationName2(cinf.getStationName2());
        battinf.setStationName3(cinf.getStationName3());
        battinf.setStationName5(cinf.getStationName5());
        return battInfMapper.judgeBattStationName3(battinf);
    }
}