| 
					
				 | 
			
			
				@@ -1,11 +1,21 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ozs.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.core.metadata.IPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.entity.BaseVehicle; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.entity.vo.BaseVehicleVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.mapper.BaseVehicleMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.BaseVehicleService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * <p> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 机车信息表 服务实现类 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -17,4 +27,69 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class BaseVehicleServiceImpl extends ServiceImpl<BaseVehicleMapper, BaseVehicle> implements BaseVehicleService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private BaseVehicleMapper baseVehicleMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public IPage<BaseVehicle> vehicleList(BaseVehicleVo baseVehicle) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LambdaQueryWrapper<BaseVehicle> wrapper = new LambdaQueryWrapper<BaseVehicle>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isEmptySunhh(baseVehicle) && !StringUtils.isEmptySunhh(baseVehicle.getVehicleName())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wrapper.eq(BaseVehicle::getVehicleName, baseVehicle.getVehicleName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isEmptySunhh(baseVehicle) && !StringUtils.isEmptySunhh(baseVehicle.getVehicleCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wrapper.eq(BaseVehicle::getVehicleCode, baseVehicle.getVehicleCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int pageNum = Integer.parseInt(baseVehicle.getPageNum().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int pageSize = Integer.parseInt(baseVehicle.getPageSize().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        com.github.pagehelper.Page<BaseVehicle> page = PageHelper.startPage(pageNum, pageSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .doSelectPage(() -> baseVehicleMapper.selectList(wrapper)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        com.baomidou.mybatisplus.extension.plugins.pagination.Page<BaseVehicle> pageR = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pageR.setRecords(page.getResult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pageR.setTotal(page.getTotal()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return pageR; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult vehicleAdd(BaseVehicle baseVehicle, String userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LambdaQueryWrapper<BaseVehicle> wrapper = new LambdaQueryWrapper<BaseVehicle>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isEmptySunhh(baseVehicle) && !StringUtils.isEmptySunhh(baseVehicle.getVehicleCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wrapper.eq(BaseVehicle::getVehicleCode, baseVehicle.getVehicleCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<BaseVehicle> baseVehicles = baseVehicleMapper.selectList(wrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (baseVehicles.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.error("机车编码已存在!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        baseVehicle.setCreateBy(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        baseVehicle.setUpdateBy(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        baseVehicle.setCreateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        baseVehicle.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int insert = baseVehicleMapper.insert(baseVehicle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (insert > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.error(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AjaxResult vehicleUpdate(BaseVehicle baseVehicle, String userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LambdaQueryWrapper<BaseVehicle> wrapper = new LambdaQueryWrapper<BaseVehicle>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isEmptySunhh(baseVehicle) && !StringUtils.isEmptySunhh(baseVehicle.getVehicleCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            wrapper.eq(BaseVehicle::getVehicleCode, baseVehicle.getVehicleCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<BaseVehicle> baseVehicles = baseVehicleMapper.selectList(wrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (baseVehicles.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.error("机车编码已存在!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        baseVehicle.setUpdateBy(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        baseVehicle.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int update = baseVehicleMapper.updateById(baseVehicle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (update > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return AjaxResult.error(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |