From f8643a6b03cbc949a875f6018d0b2b5aa5a3a0f0 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期三, 14 五月 2025 14:28:55 +0800
Subject: [PATCH] 机房管理

---
 src/main/java/com/whyc/service/StationInfService.java |   91 +++++++++++++++++++--------------------------
 1 files changed, 38 insertions(+), 53 deletions(-)

diff --git a/src/main/java/com/whyc/service/StationInfService.java b/src/main/java/com/whyc/service/StationInfService.java
index 9725c68..521a760 100644
--- a/src/main/java/com/whyc/service/StationInfService.java
+++ b/src/main/java/com/whyc/service/StationInfService.java
@@ -2,12 +2,15 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.whyc.dto.Response;
 import com.whyc.dto.Station.Provice;
+import com.whyc.dto.StationDto;
 import com.whyc.mapper.BaojigroupMapper;
 import com.whyc.mapper.StationInfMapper;
 import com.whyc.pojo.db_station.StationInf;
-import com.whyc.pojo.db_user.Baojigroup;
+import com.whyc.util.ActionUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -18,8 +21,6 @@
     @Autowired(required = false)
     private StationInfMapper mapper;
 
-    @Autowired(required = false)
-    private BaojigroupMapper groupMapper;
 
     //鑾峰彇宸︿晶鍒楄〃
     public Response getLeftStation(int uid) {
@@ -47,41 +48,36 @@
         return new Response().setII(1,list.size()>0,list,"鑾峰彇鐪佸競鍖哄幙涓嬬殑绔欑偣");
     }
     //娣诲姞鏈烘埧
-   /* public Response addStatiaon(StationInf addsinf) {
+   public Response addStatiaon(StationInf addsinf) {
         //鍒ゆ柇娣诲姞閿佺殑鏃跺�欐満鎴挎槸涓嶆槸鏂版満鎴�
-        String stationName=addsinf.getStationName1()+"_"+addsinf.getStationName2()+"_"+addsinf.getStationName3()+"_"+addsinf.getStationName4();
+        String fullName=addsinf.getProvice()+"_"+addsinf.getCity()+"_"+addsinf.getCountry()+"_"+addsinf.getStationName();
         //鍒ゆ柇鏈烘埧鏄惁瀛樺湪
         QueryWrapper wrapper=new QueryWrapper();
-        wrapper.eq("station_name",stationName);
+        wrapper.eq("full_name",fullName);
         wrapper.last("limit 1");
         StationInf sinf=mapper.selectOne(wrapper);
         int stationId=0;
-        int lockId=0;
         if(sinf!=null){
             return new Response().set(1,false,"鏈烘埧宸插瓨鍦�");
         }else {
-            //鑾峰彇褰撳墠鏈�澶х殑鏈烘埧id
-            Integer maxStationNum=mapper.getMaxStationNum();
-            if(maxStationNum==0){//鏁版嵁搴撲腑娌℃湁绔欑偣
+            //鑾峰彇瀵瑰簲鐨勬満鎴縤d
+            stationId=mapper.getMaxStationId();
+            if(stationId==0){//鏁版嵁搴撲腑娌℃湁绔欑偣
                 stationId=40000001;
             }else{
-                //鑾峰彇瀵瑰簲鐨勬満鎴縤d
-                stationId=mapper.getStaitonIdByNum(maxStationNum);
                 stationId+=1;
             }
             StationInf newSinf=new StationInf();
             newSinf.setStationId(stationId);
-            newSinf.setStationName(stationName);
-            newSinf.setStationNum(maxStationNum+1);
-            newSinf.setStationName1(addsinf.getStationName1());
-            newSinf.setStationName2(addsinf.getStationName2());
-            newSinf.setStationName3(addsinf.getStationName3());
-            newSinf.setStationName4(addsinf.getStationName4());
+            newSinf.setStationName(fullName);
+            newSinf.setProvice(addsinf.getProvice());
+            newSinf.setCity(addsinf.getCity());
+            newSinf.setCountry(addsinf.getCountry());
+            newSinf.setStationName(addsinf.getStationName());
             mapper.insert(newSinf);
-            linfService.insertInbaoji(stationId,lockId);
             return new Response().set(1,true,"娣诲姞鏈烘埧");
         }
-    }*/
+    }
     //鍒犻櫎鏈烘埧
     public Response delStatiaon(Integer stationId) {
         UpdateWrapper wrapper=new UpdateWrapper();
@@ -90,56 +86,45 @@
         return new Response().set(1,true);
     }
     //淇敼鏈烘埧
-   /* public Response updateStatiaon(StationInf sinf) {
+    public Response updateStatiaon(StationInf sinf) {
         UpdateWrapper wrapper=new UpdateWrapper();
         wrapper.eq("station_id",sinf.getStationId());
-        if(sinf.getStationName1()!=null){
-            wrapper.set("station_name1",sinf.getStationName1());
+        if(sinf.getProvice()!=null){
+            wrapper.set("provice",sinf.getProvice());
         }
-        if(sinf.getStationName2()!=null){
-            wrapper.set("station_name2",sinf.getStationName2());
+        if(sinf.getCity()!=null){
+            wrapper.set("city",sinf.getCity());
         }
-        if(sinf.getStationName3()!=null){
-            wrapper.set("station_name3",sinf.getStationName3());
+        if(sinf.getCountry()!=null){
+            wrapper.set("country",sinf.getCountry());
         }
-        if(sinf.getStationName4()!=null){
-            wrapper.set("station_name4",sinf.getStationName4());
+        if(sinf.getStationName()!=null){
+            wrapper.set("station_name",sinf.getStationName());
         }
-        String stationName=sinf.getStationName1()+"_"+sinf.getStationName2()+"_"+sinf.getStationName3()+"_"+sinf.getStationName4();
-        wrapper.set("station_name",stationName);
+        String fullName=sinf.getProvice()+"_"+sinf.getCity()+"_"+sinf.getCountry()+"_"+sinf.getStationName();
+        wrapper.set("full_name",fullName);
         mapper.update((StationInf) ActionUtil.objeNull,wrapper);
         return new Response().set(1,true);
-    }*/
+    }
     //鏌ヨ鏈烘埧
-    /*public Response getStatiaon(StationDto dto) {
+    public Response getStatiaon(StationDto dto) {
         PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
         QueryWrapper wrapper=new QueryWrapper();
-        if(dto.getStationName1()!=null){
-            wrapper.eq("station_name1",dto.getStationName1());
+        if(dto.getProvice()!=null){
+            wrapper.eq("provice",dto.getProvice());
         }
-        if(dto.getStationName2()!=null){
-            wrapper.eq("station_name2",dto.getStationName2());
+        if(dto.getCity()!=null){
+            wrapper.eq("city",dto.getCity());
         }
-        if(dto.getStationName3()!=null){
-            wrapper.eq("station_name3",dto.getStationName3());
+        if(dto.getCountry()!=null){
+            wrapper.eq("country",dto.getCountry());
         }
-        if(dto.getStationName4()!=null){
-            wrapper.eq("station_name4",dto.getStationName4());
+        if(dto.getStationName()!=null){
+            wrapper.eq("station_name",dto.getStationName());
         }
         List<StationInf> list=mapper.selectList(wrapper);
         PageInfo pageInfo=new PageInfo(list);
         return new Response().setII(1,list!=null,pageInfo,"鏌ヨ鏈烘埧");
-    }*/
-    //鏍规嵁stationid鍜屽寘鏈虹粍id鏌ヨ鏈烘埧鍚嶅拰鍖呮満缁勫悕
-    public Response getNamebyId(Integer stationId, Integer baojiId) {
-        QueryWrapper wrapper=new QueryWrapper();
-        wrapper.eq("station_id",stationId);
-        wrapper.last("limit 1");
-        StationInf sinf=mapper.selectOne(wrapper);
-        QueryWrapper wrapper1=new QueryWrapper();
-        wrapper1.eq("id",baojiId);
-        wrapper1.last("limit 1");
-        Baojigroup baoji=groupMapper.selectOne(wrapper1);
-        return new Response().setIII(1,true,sinf,baoji,"鏍规嵁stationid鍜屽寘鏈虹粍id鏌ヨ鏈烘埧鍚嶅拰鍖呮満缁勫悕");
     }
+
 }
\ No newline at end of file

--
Gitblit v1.9.1