浏览代码

查询位置

shs 1 年之前
父节点
当前提交
c5251b6452

+ 1 - 1
aidex-system/src/main/java/com/aidex/common/plush/mapper/SysShipExtendMapper.java

@@ -13,5 +13,5 @@ import com.aidex.common.plush.domain.SysShipExtend;
 public interface SysShipExtendMapper extends BaseMapper<SysShipExtend>
 {
 
-
+    void updateByMacId(SysShipExtend sysShipExtend);
 }

+ 16 - 10
aidex-system/src/main/java/com/aidex/common/plush/mapper/SysShipExtendMapper.xml

@@ -25,8 +25,6 @@
 
         a.travel as "travel",
 
-        a.remark as "remark",
-
         a.id as "id",
 
         a.update_time as "updateTime",
@@ -100,12 +98,8 @@
 
             travel,
 
-            remark,
-
             id,
 
-            update_time,
-
             del_flag
 
         ) VALUES (
@@ -131,12 +125,8 @@
 
             #{travel},
 
-            #{remark},
-
             #{id},
 
-            #{updateTime},
-
             #{delFlag}
 
         )
@@ -144,6 +134,22 @@
 
     <update id="update">
         UPDATE sys_ship_extend SET
+           mac_id = #{macId},
+           speed = #{speed},
+           is_stop = #{isStop},
+           dir = #{dir},
+           next_wharf = #{nextWharf},
+           wharf_stop = #{wharfStop},
+           lat = #{lat},
+           lon = #{lon},
+           mileage = #{mileage},
+           travel = #{travel},
+           update_time = #{updateTime},
+           WHERE ship_id = #{macId}
+    </update>
+
+    <update id="updateByMacId">
+        UPDATE sys_ship_extend SET
             mac_id = #{macId},
             speed = #{speed},
             is_stop = #{isStop},

+ 5 - 0
aidex-system/src/main/java/com/aidex/common/plush/service/SysShipExtendService.java

@@ -12,4 +12,9 @@ import com.aidex.common.plush.domain.SysShipExtend;
 public interface SysShipExtendService {
 
 
+    void save(SysShipExtend sysShipExtend);
+
+    void update(SysShipExtend sysShipExtend);
+
+    SysShipExtend findById(String id);
 }

+ 18 - 0
aidex-system/src/main/java/com/aidex/common/plush/service/impl/SysShipExtendServiceImpl.java

@@ -1,6 +1,8 @@
 package com.aidex.common.plush.service.impl;
 
 import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -24,4 +26,20 @@ public class SysShipExtendServiceImpl implements SysShipExtendService {
 
     private static final Logger log = LoggerFactory.getLogger(SysShipExtendServiceImpl.class);
 
+    @Autowired
+    private SysShipExtendMapper sysShipExtendMapper;
+
+
+    public void save(SysShipExtend sysShipExtend){
+            sysShipExtendMapper.insert(sysShipExtend);
+    }
+
+    public void update(SysShipExtend sysShipExtend){
+        sysShipExtendMapper.update(sysShipExtend);
+    }
+
+    public SysShipExtend findById(String id){
+       return sysShipExtendMapper.get(id);
+    }
+
 }

+ 3 - 0
aidex-system/src/main/java/com/aidex/system/mapper/SysShipMapper.xml

@@ -60,6 +60,9 @@
             <if test="shipNum != null and shipNum != ''">
                 and a.ship_num like concat('%', #{shipNum}, '%')
             </if>
+            <if test="status != null and status != ''">
+                and a.status = #{status}
+            </if>
             <if test="shipNanme != null and shipNanme != ''">
                 and a.ship_nanme like concat('%', #{shipNanme}, '%')
             </if>

+ 22 - 1
aidex-system/src/main/java/com/aidex/system/service/impl/SysShipServiceImpl.java

@@ -1,6 +1,10 @@
 package com.aidex.system.service.impl;
 
 import java.util.List;
+
+import com.aidex.common.plush.domain.SysShipExtend;
+import com.aidex.common.plush.service.SysShipExtendService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -24,6 +28,9 @@ public class SysShipServiceImpl extends BaseServiceImpl<SysShipMapper, SysShip>
 
     private static final Logger log = LoggerFactory.getLogger(SysShipServiceImpl.class);
 
+    @Autowired
+    private SysShipExtendService sysShipExtendService;
+
     /**
      * 获取单条数据
      * @param sysShip 船只管理
@@ -75,7 +82,21 @@ public class SysShipServiceImpl extends BaseServiceImpl<SysShipMapper, SysShip>
      */
     @Override
     public boolean save(SysShip sysShip) {
-        return super.save(sysShip);
+        if(super.save(sysShip)) {
+            SysShipExtend shipExtend = new SysShipExtend();
+            shipExtend.setShipId(sysShip.getId());
+            shipExtend.setId(sysShip.getId());
+            shipExtend.setMacId(sysShip.getShipNum());
+            if (sysShip.getIsNewRecord()) {
+                sysShipExtendService.save(shipExtend);
+            }else {
+                if(sysShipExtendService.findById(sysShip.getId()) == null){
+                    sysShipExtendService.save(shipExtend);
+                }
+            }
+            return Boolean.TRUE;
+        }else
+            return Boolean.FALSE;
     }
 
     /**