| | |
| | | public Response addFileInStation(@RequestParam String stationName,@RequestParam String FilePath){ |
| | | return service.addFileInStation(stationName,FilePath); |
| | | } |
| | | |
| | | @ApiOperation(value = "移除台站下文件(单个文件)") |
| | | @GetMapping("delFileFromStation") |
| | | public Response delFileFromStation(@RequestParam String stationName,@RequestParam(required = false) String FilePath){ |
| | | return service.delFileFromStation(stationName,FilePath); |
| | | } |
| | | } |
| | |
| | | |
| | | List<BattgroupData> getListWithTestTime(int battGroupId); |
| | | |
| | | //删除fileid对应的数据(stationId,fileId) |
| | | int deleteDataAndInfo(int stationId, int fileId); |
| | | } |
| | |
| | | |
| | | //查询出最大文件id |
| | | int selectMaxId(); |
| | | |
| | | //查出文件对应的文件id |
| | | int selectFileId(int stationId, String filePath); |
| | | |
| | | //删除机房下文件信息(stationId,fileId) |
| | | int deleteFileInStation(int stationId, int fileId); |
| | | } |
| | |
| | | List<Integer> getMonVolStd(); |
| | | //按照筛选条件查询数据库信息 |
| | | List<FileParam> getDataByCondition(Date testTime1, Date testTime2, int battVol); |
| | | //删除fileid对应的参数 |
| | | int deleteParamByFileId(int fileId); |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.whyc.dto.FileOpreate; |
| | |
| | | return new Response().set(1,flag>0,"修改操作"); |
| | | } |
| | | //删除台站 |
| | | @Transactional |
| | | public Response deleteStation(String stationName1, String stationName2, String stationName3) { |
| | | String stationName=""; |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | |
| | | stationName=stationName+"-"+stationName3; |
| | | } |
| | | wrapper.eq("station_name",stationName); |
| | | //先删除该基站挂载的所有文件 |
| | | int flag=mapper.delete(wrapper); |
| | | return new Response().set(1,flag>0,"删除操作"); |
| | | } |
| | | //移除台站下文件(单个文件) |
| | | @Transactional |
| | | public Response delFileFromStation(String stationName, String filePath) { |
| | | //1.先查出机房的id |
| | | int stationId=mapper.selectIdByName(stationName); |
| | | if(stationId==0){ |
| | | return new Response().set(1,false,"机房不存在"); |
| | | }else{ |
| | | //2.查出文件对应的文件id |
| | | int fileId=infoMapper.selectFileId(stationId,filePath); |
| | | if(fileId==0){ |
| | | return new Response().set(1,false,"文件不存在"); |
| | | }else{ |
| | | //3.删除fileid对应的数据(stationId,fileId) |
| | | dataMapper.deleteDataAndInfo(stationId,fileId); |
| | | |
| | | //4.删除fileid对应的参数 |
| | | paramMapper.deleteParamByFileId(fileId); |
| | | |
| | | //5.删除机房下文件信息(stationId,fileId) |
| | | infoMapper.deleteFileInStation(stationId,fileId); |
| | | return new Response().set(1,true,"删除成功"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.BattGroupDataMapper"> |
| | | <delete id="deleteDataAndInfo"> |
| | | DELETE o,c |
| | | FROM tb_battgroup_data o |
| | | LEFT JOIN tb_battgroup_info c ON o.battGroup_id = c.battGroup_id |
| | | WHERE c.station_id=#{stationId} and c.file_id=#{fileId} |
| | | </delete> |
| | | |
| | | <select id="getListWithTestTime" resultType="com.whyc.pojo.BattgroupData"> |
| | | SELECT data.*,info.test_time FROM db_res_meter.tb_battgroup_data data,db_res_meter.tb_battgroup_info info |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.FileInfoMapper"> |
| | | |
| | | <delete id="deleteFileInStation"> |
| | | delete from tb_file_info where station_id=#{stationId} and file_id=#{fileId} |
| | | </delete> |
| | | |
| | | <select id="selectMaxId" resultType="java.lang.Integer"> |
| | | select ifnull(max(file_id),"10001") from db_res_meter.tb_file_info limit 1 |
| | | </select> |
| | | <select id="selectFileId" resultType="java.lang.Integer"> |
| | | select ifnull(max(file_id),0) from db_res_meter.tb_file_info |
| | | where station_id=#{stationId} and file_url=#{filePath} |
| | | </select> |
| | | </mapper> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.FileParamMapper"> |
| | | <delete id="deleteParamByFileId"> |
| | | delete from tb_file_param where file_id=#{fileId} |
| | | </delete> |
| | | |
| | | |
| | | <select id="getMonVolStd" resultType="Integer"> |