From c98b2e32e869b6ad58330a1d43d5984e68763ea6 Mon Sep 17 00:00:00 2001
From: lxw <810412026@qq.com>
Date: 星期二, 20 九月 2022 12:53:38 +0800
Subject: [PATCH] 删除台站

---
 src/main/java/com/whyc/service/StationInfoService.java |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/whyc/service/StationInfoService.java b/src/main/java/com/whyc/service/StationInfoService.java
index 46b8dde..4806d78 100644
--- a/src/main/java/com/whyc/service/StationInfoService.java
+++ b/src/main/java/com/whyc/service/StationInfoService.java
@@ -1,5 +1,6 @@
 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;
@@ -126,14 +127,14 @@
     //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){
             //鏌ヨ绔欑偣鐨勬満鎴挎槸鍚﹀瓨鍦╯tationId
             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));
@@ -228,8 +229,8 @@
         }
         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.鍒犻櫎鎵�鏈夋枃浠舵暟鎹�
@@ -245,13 +246,13 @@
     @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.鏌ュ嚭鏂囦欢瀵瑰簲鐨勬枃浠秈d
-            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)

--
Gitblit v1.9.1