| | |
| | | package com.whyc.service; |
| | | |
| | | import com.alibaba.druid.sql.visitor.functions.Isnull; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | //4.将单文件的数据存入数据库 |
| | | private FileInfo insertFileInDataBase(String stationName,int stationIdMax,int fileIdMax, FileInfo fileInfo) { |
| | | int count=0; |
| | | int stationId=0; |
| | | Integer stationId=0; |
| | | //查询最大的电池组号 |
| | | int battGroupId=groupInfoMapper.selectMaxId(); |
| | | if(fileInfo!=null){ |
| | | //查询站点的机房是否存在stationId |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | stationId=mapper.selectIdByName(stationName); |
| | | if(stationId!=0){ |
| | | if(stationId!=null||stationId!=0){ |
| | | fileInfo.setStationId(String.valueOf(stationId)); |
| | | }else{ |
| | | fileInfo.setStationId(String.valueOf(stationIdMax+1)); |
| | |
| | | } |
| | | wrapper.eq("station_name",stationName); |
| | | //1.先查出机房的id |
| | | int stationId=mapper.selectIdByName(stationName); |
| | | if(stationId==0){ |
| | | Integer stationId=mapper.selectIdByName(stationName); |
| | | if(stationId==null||stationId==0){ |
| | | return new Response().set(1,false,"机房不存在"); |
| | | }else { |
| | | //3.删除所有文件数据 |
| | |
| | | @Transactional |
| | | public Response delFileFromStation(String stationName, String filePath) { |
| | | //1.先查出机房的id |
| | | int stationId=mapper.selectIdByName(stationName); |
| | | if(stationId==0){ |
| | | Integer stationId=mapper.selectIdByName(stationName); |
| | | if(stationId==null||stationId==0){ |
| | | return new Response().set(1,false,"机房不存在"); |
| | | }else{ |
| | | //2.查出文件对应的文件id |
| | | int fileId=infoMapper.selectFileId(stationId,filePath); |
| | | if(fileId==0){ |
| | | Integer fileId=infoMapper.selectFileId(stationId,filePath); |
| | | if(fileId==null||fileId==0){ |
| | | return new Response().set(1,false,"文件不存在"); |
| | | }else{ |
| | | //3.删除fileid对应的数据(stationId,fileId) |