Browse Source

机车表修改

gao.qiang 8 months ago
parent
commit
7171a59bc9

+ 2 - 0
business-service/src/main/java/com/ozs/entity/vo/BaseVehicleVo.java

@@ -62,4 +62,6 @@ public class BaseVehicleVo extends PageVo {
      * 挂载终端ID terminal_id
      */
     private long terminalId;
+    
+    private String ends;
 }

+ 1 - 1
business-service/src/main/java/com/ozs/mapper/BaseVehicleTerminalMapper.java

@@ -18,5 +18,5 @@ public interface BaseVehicleTerminalMapper extends BaseMapper<BaseVehicleTermina
 
     List<String> selectMountCode(@Param("vehicleCode") String vehicleCode);
 
-    BaseVehicleTerminal selectTerminal(@Param("vehicleCode") String vehicleCode);
+    BaseVehicleTerminal selectTerminal(@Param("vehicleCode") String vehicleCode,@Param("ends") String ends);
 }

+ 6 - 4
business-service/src/main/java/com/ozs/service/impl/BaseVehicleServiceImpl.java

@@ -71,7 +71,7 @@ public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseV
                 .doSelectPage(() -> baseVehicleMapper.selectList(wrapper));
         if (!StringUtils.isEmptySunhh(page) && page.getResult().size() > 0) {
             List<BaseVehicle> dto1 = page.getResult().stream().map(o -> {
-                BaseVehicleTerminal baseVehicleTerminal = baseVehicleTerminalMapper.selectTerminal(o.getVehicleCode());
+                BaseVehicleTerminal baseVehicleTerminal = baseVehicleTerminalMapper.selectTerminal(o.getVehicleCode(),o.getEnds());
                 if (!StringUtils.isEmptySunhh(baseVehicleTerminal) && !StringUtils.isEmptySunhh(baseVehicleTerminal.getVehicleCode())) {
                     LambdaQueryWrapper<BaseTerminal> wrapperBaseTerminal = new LambdaQueryWrapper<>();
                     if (!StringUtils.isEmptySunhh(baseVehicleTerminal) && !StringUtils.isEmptySunhh(baseVehicleTerminal.getTerminalCode())) {
@@ -223,7 +223,7 @@ public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseV
         }
         List<BaseVehicle> baseVehicles = baseVehicleMapper.selectList(wrapper);
         for (BaseVehicle baseVehicle1 : baseVehicles) {
-            BaseVehicleTerminal baseTerminal = baseVehicleTerminalMapper.selectTerminal(baseVehicle1.getVehicleCode());
+            BaseVehicleTerminal baseTerminal = baseVehicleTerminalMapper.selectTerminal(baseVehicle1.getVehicleCode(),baseVehicle1.getEnds());
             if (!StringUtils.isEmptySunhh(baseTerminal) && !StringUtils.isEmptySunhh(baseTerminal.getVehicleCode())) {
                 LambdaQueryWrapper<BaseTerminal> wrapperBaseVehicleTerminal = new LambdaQueryWrapper<>();
                 if (!StringUtils.isEmptySunhh(baseTerminal) && !StringUtils.isEmptySunhh(baseTerminal.getTerminalCode())) {
@@ -242,7 +242,7 @@ public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseV
 
     @Override
     public IPage<BaseVehicleTerminalVo> vehicleTerminal(BaseVehicleVo baseVehicleVo) {
-        BaseVehicleTerminal baseTerminal = baseVehicleTerminalMapper.selectTerminal(baseVehicleVo.getVehicleCode());
+        BaseVehicleTerminal baseTerminal = baseVehicleTerminalMapper.selectTerminal(baseVehicleVo.getVehicleCode(),baseVehicleVo.getEnds());
         List<String> terminalCodeList = baseVehicleTerminalMapper.selectMountCode(baseVehicleVo.getVehicleCode());
         // List<String> collect = terminalCodeList.stream().map(BaseTerminal::getTerminalCode).collect(Collectors.toList());
         LambdaQueryWrapper<BaseTerminal> wrapper = new LambdaQueryWrapper<>();
@@ -302,6 +302,7 @@ public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseV
             baseTerminal2.setTerminalCode(baseTerminal1.getTerminalCode());
             baseTerminal2.setCreateBy(userId);
             baseTerminal2.setUpdateBy(userId);
+            baseTerminal2.setEnds(baseTerminal1.getEnds());
             Date date = new Date();
             baseTerminal2.setCreateTime(date);
             baseTerminal2.setUpdateTime(date);
@@ -311,6 +312,7 @@ public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseV
             baseTerminal.setUpdateTime(new Date());
             baseTerminal.setVehicleCode(baseTerminal1.getVehicleCode());
             baseTerminal.setTerminalCode(baseTerminal1.getTerminalCode());
+            baseTerminal.setEnds(baseTerminal1.getEnds());
             int updateById = baseVehicleTerminalMapper.updateById(baseTerminal);
         }
         return AjaxResult.success();
@@ -360,7 +362,7 @@ public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseV
             List<String> terminalCodeList = new ArrayList<>();
             baseVehicles = baseVehicles.stream().map(o -> {
                 //查到已保存的关联信息
-                BaseVehicleTerminal baseVehicleTerminal = baseVehicleTerminalMapper.selectTerminal(o.getVehicleCode());
+                BaseVehicleTerminal baseVehicleTerminal = baseVehicleTerminalMapper.selectTerminal(o.getVehicleCode(),o.getEnds());
                 if (!StringUtils.isEmptySunhh(baseVehicleTerminal) && !StringUtils.isEmptySunhh(baseVehicleTerminal.getVehicleCode())) {
                     terminalCodeList.add(baseVehicleTerminal.getVehicleCode());
                     LambdaQueryWrapper<BaseTerminal> wrapperBaseVehicleTerminal = new LambdaQueryWrapper<>();

+ 1 - 1
business-service/src/main/resources/mapper/BaseVehicleTerminalMapper.xml

@@ -7,6 +7,6 @@
     </select>
 
     <select id="selectTerminal" parameterType="java.lang.String" resultType="com.ozs.entity.BaseVehicleTerminal">
-        select * from base_vehicle_terminal where vehicle_code = #{vehicleCode} limit 1
+        select * from base_vehicle_terminal where vehicle_code = #{vehicleCode} and ends=#{ends} limit 1
     </select>
 </mapper>