| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.*; |
| | | import com.whyc.mapper.BattGroupDataMapper; |
| | | import com.whyc.mapper.FileInfoMapper; |
| | | import com.whyc.mapper.FileParamMapper; |
| | | import com.whyc.mapper.TestParamMapper; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.MathUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired(required = false) |
| | | private TestParamMapper testParamMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private BattgroupInfoMapper groupInfoMapper; |
| | | |
| | | //解析xml文件(传参一个文件) |
| | | public Response getXmlValue(String filePath) { |
| | |
| | | //删除基站下数据 |
| | | public Response deleteDataById(int stationId, int fileId) { |
| | | //删除所有文件数据(指定机房id和文件id) |
| | | dataMapper.deleteDataAndInfo(stationId,fileId); |
| | | //dataMapper.deleteDataAndInfo(stationId,fileId); |
| | | deleteDataAndInfo(stationId,fileId); |
| | | //删除所有文件参数 |
| | | paramMapper.deleteParamByFileId(fileId); |
| | | //移除机房下挂在的文件 |
| | | infoMapper.deleteFileInStation(stationId,fileId); |
| | | return new Response().set(1,"删除成功!"); |
| | | } |
| | | //3根据(stationId,fileId)删除groupinfo和groupdata数据 |
| | | public void deleteDataAndInfo(int stationId,int fileId){ |
| | | //先查询出对应的电池组id然后删除 |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("station_id",stationId); |
| | | wrapper.eq("file_id",fileId); |
| | | List<BattgroupInfo> list=groupInfoMapper.selectList(wrapper); |
| | | if(list!=null&&list.size()>0){ |
| | | for (BattgroupInfo ginfo:list) { |
| | | UpdateWrapper dataWrapper=new UpdateWrapper(); |
| | | dataWrapper.eq("battGroup_id",ginfo.getBattgroupId()); |
| | | dataMapper.delete(dataWrapper); |
| | | } |
| | | } |
| | | //再删除groupinfo |
| | | UpdateWrapper infoWrapper=new UpdateWrapper(); |
| | | infoWrapper.eq("station_id",stationId); |
| | | infoWrapper.eq("file_id",fileId); |
| | | groupInfoMapper.delete(infoWrapper); |
| | | } |
| | | } |