多对多
parent
86d2643da9
commit
ae34564232
5
pom.xml
5
pom.xml
|
@ -250,6 +250,11 @@
|
||||||
<version>${mqttv3.version}</version>
|
<version>${mqttv3.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-business</artifactId>
|
||||||
|
<version>${zhilian.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<module>zhilian-common-datasource</module>
|
<module>zhilian-common-datasource</module>
|
||||||
<module>zhilian-common-system</module>
|
<module>zhilian-common-system</module>
|
||||||
<module>zhilian-common-resolver</module>
|
<module>zhilian-common-resolver</module>
|
||||||
|
<module>zhilian-common-business</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>zhilian-common</artifactId>
|
<artifactId>zhilian-common</artifactId>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>zhilian-common-business</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- zhilian Common Core-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -28,7 +28,8 @@ public class Markers extends BaseEntity {
|
||||||
@Excel(name = "标识名称")
|
@Excel(name = "标识名称")
|
||||||
private String markersName;
|
private String markersName;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
List<Fence> fenceList;
|
List<Long> fenceIds;
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,6 +9,8 @@ import com.zhilian.common.core.web.domain.BaseEntity;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息对象 business_vehicle
|
* 车辆信息对象 business_vehicle
|
||||||
*/
|
*/
|
||||||
|
@ -31,50 +33,39 @@ public class Vehicle extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 车辆VIN
|
* 车辆VIN
|
||||||
*/
|
*/
|
||||||
@Excel(name = "车辆VIN")
|
@TableField("vehicle_vin")
|
||||||
@TableField(value = "vehicle_vin")
|
|
||||||
private String vehicleVIN;
|
private String vehicleVIN;
|
||||||
/**
|
/**
|
||||||
* 车辆类型编号
|
* 车辆类型编号
|
||||||
*/
|
*/
|
||||||
@Excel(name = "车辆类型编号")
|
|
||||||
@TableField(value = "vehicle_type_id")
|
|
||||||
private Long vehicleTypeId;
|
private Long vehicleTypeId;
|
||||||
/**
|
|
||||||
* 电子围栏编号
|
|
||||||
*/
|
@TableField(exist = false)
|
||||||
@Excel(name = "电子围栏")
|
private Long vehicleTypeName;
|
||||||
@TableField(value = "fence_id")
|
|
||||||
private Long fenceId;
|
|
||||||
/**
|
/**
|
||||||
* 电机厂商
|
* 电机厂商
|
||||||
*/
|
*/
|
||||||
@Excel(name = "电机厂商")
|
private String vehicleMotor;
|
||||||
@TableField(value = "vehicle_motor")
|
|
||||||
private String motorBusiness;
|
|
||||||
/**
|
/**
|
||||||
* 电池厂商
|
* 电池厂商
|
||||||
*/
|
*/
|
||||||
@Excel(name = "电池厂商")
|
private String vehicleBattery;
|
||||||
@TableField(value = "vehicle_battery")
|
|
||||||
private String batteryBusiness;
|
|
||||||
/**
|
/**
|
||||||
* 电机ID
|
* 电机ID
|
||||||
*/
|
*/
|
||||||
@Excel(name = "电机ID")
|
private String motorId;
|
||||||
@TableField(value = "motor_id")
|
|
||||||
private String motorID;
|
|
||||||
/**
|
/**
|
||||||
* 电池ID
|
* 电池ID
|
||||||
*/
|
*/
|
||||||
@Excel(name = "电池ID")
|
private String batteryId;
|
||||||
@TableField(value = "battery_id")
|
|
||||||
private String batteryID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆状态
|
* 车辆状态
|
||||||
*/
|
*/
|
||||||
@Excel(name = "车辆状态")
|
|
||||||
@TableField(value = "vehicle_state")
|
|
||||||
private Long vehicleState;
|
private Long vehicleState;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Long> markersIds;
|
||||||
}
|
}
|
|
@ -1,13 +1,9 @@
|
||||||
package com.zhilian.business.domain.middle;
|
package com.zhilian.business.domain.middle;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.zhilian.business.domain.Fence;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
@TableName("business_markers_fence")
|
@TableName("business_markers_fence")
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.zhilian.business.remote;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public interface RemoteFenceService {
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.zhilian.business.remote.factory;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.constant.ServiceNameConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
|
||||||
|
//@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||||
|
public class RemoteFenceFallbackFactory {
|
||||||
|
}
|
|
@ -73,6 +73,12 @@
|
||||||
<artifactId>zhilian-common-log</artifactId>
|
<artifactId>zhilian-common-log</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-business</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- zhilian Common Swagger -->
|
<!-- zhilian Common Swagger -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zhilian</groupId>
|
<groupId>com.zhilian</groupId>
|
||||||
|
@ -106,4 +112,4 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.zhilian.business.controller;
|
||||||
import com.zhilian.common.core.domain.Result;
|
import com.zhilian.common.core.domain.Result;
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
import com.zhilian.common.core.web.controller.BaseController;
|
||||||
import com.zhilian.business.domain.Fence;
|
import com.zhilian.business.domain.Fence;
|
||||||
import com.zhilian.business.domain.vo.FenceVo;
|
|
||||||
import com.zhilian.business.service.FenceService;
|
import com.zhilian.business.service.FenceService;
|
||||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
import com.zhilian.common.core.web.page.TableDataInfo;
|
||||||
import com.zhilian.common.security.utils.SecurityUtils;
|
import com.zhilian.common.security.utils.SecurityUtils;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.zhilian.business.controller;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.zhilian.business.domain.Markers;
|
import com.zhilian.business.domain.Markers;
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
import com.zhilian.business.domain.middle.MarkersFence;
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
|
||||||
import com.zhilian.business.service.MarkersFenceService;
|
import com.zhilian.business.service.MarkersFenceService;
|
||||||
import com.zhilian.business.service.MarkersService;
|
import com.zhilian.business.service.MarkersService;
|
||||||
import com.zhilian.common.core.domain.Result;
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
@ -34,6 +33,12 @@ public class MarkersController extends BaseController {
|
||||||
return getDataTable(result);
|
return getDataTable(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("markersVehicle")
|
||||||
|
public Result<List<Markers>> markersVehicle() {
|
||||||
|
List<Markers> listMarkers = markersService.listMarkers();
|
||||||
|
return Result.success(listMarkers);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("insert")
|
@PostMapping("insert")
|
||||||
public Result insert(@RequestBody Markers markers){
|
public Result insert(@RequestBody Markers markers){
|
||||||
return toAjax(markersService.save(markers));
|
return toAjax(markersService.save(markers));
|
||||||
|
@ -44,8 +49,8 @@ public class MarkersController extends BaseController {
|
||||||
return toAjax(markersService.updateById(markers));
|
return toAjax(markersService.updateById(markers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("delete")
|
@PostMapping("delete/{markersId}")
|
||||||
public Result delete(@RequestParam Long markersId) {
|
public Result delete(@PathVariable Long markersId) {
|
||||||
markersFenceList(markersId).forEach(markersFence -> {
|
markersFenceList(markersId).forEach(markersFence -> {
|
||||||
markersFenceService.removeById(markersId);
|
markersFenceService.removeById(markersId);
|
||||||
});
|
});
|
||||||
|
@ -57,7 +62,8 @@ public class MarkersController extends BaseController {
|
||||||
return toAjax(markersFenceService.save(markersFence));
|
return toAjax(markersFenceService.save(markersFence));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MarkersFence> markersFenceList(Long markersId){
|
@PostMapping("markersFenceList/{markersId}")
|
||||||
|
public List<MarkersFence> markersFenceList(@PathVariable Long markersId){
|
||||||
LambdaQueryWrapper<MarkersFence> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MarkersFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(MarkersFence::getMarkerId, markersId);
|
queryWrapper.eq(MarkersFence::getMarkerId, markersId);
|
||||||
return markersFenceService.list(queryWrapper);
|
return markersFenceService.list(queryWrapper);
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package com.zhilian.business.controller;
|
package com.zhilian.business.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.zhilian.business.domain.Markers;
|
||||||
import com.zhilian.business.domain.Vehicle;
|
import com.zhilian.business.domain.Vehicle;
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
import com.zhilian.business.domain.middle.VehicleMarkers;
|
||||||
|
import com.zhilian.business.service.MarkersService;
|
||||||
import com.zhilian.business.service.VehicleMarkersService;
|
import com.zhilian.business.service.VehicleMarkersService;
|
||||||
import com.zhilian.business.service.VehicleService;
|
import com.zhilian.business.service.VehicleService;
|
||||||
import com.zhilian.common.core.domain.Result;
|
import com.zhilian.common.core.domain.Result;
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
import com.zhilian.common.core.web.controller.BaseController;
|
||||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
import com.zhilian.common.core.web.page.TableDataInfo;
|
||||||
import com.zhilian.common.security.utils.SecurityUtils;
|
import com.zhilian.common.security.utils.SecurityUtils;
|
||||||
|
@ -25,12 +26,17 @@ public class VehicleController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleMarkersService vehicleMarkersService;
|
private VehicleMarkersService vehicleMarkersService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MarkersService markersService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆列表
|
* 查询车辆列表
|
||||||
* @param vehicle
|
* @param vehicle
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
public Result<TableDataInfo<Vehicle>> list(@RequestBody Vehicle vehicle) {
|
public Result<TableDataInfo<Vehicle>> list(@RequestBody Vehicle vehicle) {
|
||||||
startPage();
|
startPage();
|
||||||
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
||||||
|
@ -58,7 +64,16 @@ public class VehicleController extends BaseController {
|
||||||
public Result vehicleUpdate(@RequestBody Vehicle vehicle){
|
public Result vehicleUpdate(@RequestBody Vehicle vehicle){
|
||||||
vehicle.setUpdateBy(SecurityUtils.getUsername());
|
vehicle.setUpdateBy(SecurityUtils.getUsername());
|
||||||
vehicle.setUpdateTime(new Date());
|
vehicle.setUpdateTime(new Date());
|
||||||
return toAjax(vehicleService.updateById(vehicle));
|
|
||||||
|
//删除中间表全部关联数据
|
||||||
|
vehicleMarkersService.removeAllVehicle(vehicle);
|
||||||
|
|
||||||
|
//修改原表数据
|
||||||
|
boolean update =vehicleService.updateById(vehicle);
|
||||||
|
|
||||||
|
//重新添加中间表数据
|
||||||
|
vehicleMarkersService.insert(vehicle);
|
||||||
|
return toAjax(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,20 +81,30 @@ public class VehicleController extends BaseController {
|
||||||
* @param vehicleId
|
* @param vehicleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<VehicleMarkers> getVehicleMarkers(Long vehicleId){
|
@PostMapping("/getVehicleMarkers/{vehicleId}")
|
||||||
|
public List<VehicleMarkers> getVehicleMarkers(@PathVariable Long vehicleId){
|
||||||
LambdaQueryWrapper<VehicleMarkers> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<VehicleMarkers> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(VehicleMarkers::getVehicleId, vehicleId);
|
queryWrapper.eq(VehicleMarkers::getVehicleId, vehicleId);
|
||||||
return vehicleMarkersService.list(queryWrapper);
|
return vehicleMarkersService.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @PostMapping("/getMarkers/{vehicleId}")
|
||||||
|
// public List<Markers> getMarkers(@PathVariable Long vehicleId){
|
||||||
|
// LambdaQueryWrapper<VehicleMarkers> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// queryWrapper.eq(VehicleMarkers::getVehicleId, vehicleId);
|
||||||
|
// List<VehicleMarkers> list = vehicleMarkersService.list(queryWrapper);
|
||||||
|
// list.forEach(vehicleMarkers -> {
|
||||||
|
// Markers markers = markersService.getById(vehicleMarkers.getMarkersId());
|
||||||
|
// });
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
/**
|
/**
|
||||||
* 删除车辆
|
* 删除车辆
|
||||||
* @param vehicleId
|
* @param vehicleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/vehicleDelete")
|
@PostMapping("/vehicleDelete/{vehicleId}")
|
||||||
public Result vehicleDelete(@RequestParam Long vehicleId){
|
public Result vehicleDelete(@PathVariable Long vehicleId){
|
||||||
getVehicleMarkers(vehicleId).forEach(vehicleMarkers -> {
|
getVehicleMarkers(vehicleId).forEach(vehicleMarkers -> {
|
||||||
vehicleMarkersService.removeById(vehicleId);
|
vehicleMarkersService.removeById(vehicleId);
|
||||||
});
|
});
|
||||||
|
@ -88,11 +113,12 @@ public class VehicleController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆绑定围栏
|
* 车辆绑定围栏
|
||||||
* @param vehicleMarkers
|
* @param vehicle
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/vehicleInsertMarkers")
|
@PostMapping("/vehicleInsertMarkers")
|
||||||
public Result vehicleInsertMarkers(@RequestBody VehicleMarkers vehicleMarkers){
|
public Result vehicleInsertMarkers(@RequestBody Vehicle vehicle){
|
||||||
return toAjax(vehicleMarkersService.save(vehicleMarkers));
|
boolean insert = vehicleMarkersService.insert(vehicle);
|
||||||
|
return toAjax(insert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.zhilian.business.controller;
|
package com.zhilian.business.controller;
|
||||||
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
import com.zhilian.business.domain.middle.VehicleMarkers;
|
||||||
import com.zhilian.business.service.VehicleMarkersService;
|
import com.zhilian.business.service.VehicleMarkersService;
|
||||||
import com.zhilian.common.core.domain.Result;
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package com.zhilian.business.service;
|
package com.zhilian.business.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.zhilian.business.domain.Fence;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
import com.zhilian.business.domain.middle.MarkersFence;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MarkersFenceService extends IService<MarkersFence> {
|
public interface MarkersFenceService extends IService<MarkersFence> {
|
||||||
// List<MarkersFence> selectFenceByIdAndMarkersBuyId(List<MarkersFence> list, List<Fence> list1, List<Markers> list2,MarkersFence markersFence);
|
// List<MarkersFence> selectFenceByIdAndMarkersBuyId(List<MarkersFence> list, List<Fence> list1, List<Markers> list2,MarkersFence markersFence);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,12 @@ package com.zhilian.business.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.zhilian.business.domain.Markers;
|
import com.zhilian.business.domain.Markers;
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface MarkersService extends IService<Markers> {
|
public interface MarkersService extends IService<Markers> {
|
||||||
List<Markers> selectMarkersList(Markers markers);
|
List<Markers> selectMarkersList(Markers markers);
|
||||||
|
|
||||||
|
List<Markers> listMarkers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package com.zhilian.business.service;
|
package com.zhilian.business.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhilian.business.domain.Vehicle;
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
import com.zhilian.business.domain.middle.VehicleMarkers;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface VehicleMarkersService extends IService<VehicleMarkers> {
|
public interface VehicleMarkersService extends IService<VehicleMarkers> {
|
||||||
|
|
||||||
|
boolean insert(Vehicle vehicle);
|
||||||
|
|
||||||
|
void removeAllVehicle(Vehicle vehicle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,10 @@ package com.zhilian.business.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import com.zhilian.business.domain.Fence;
|
import com.zhilian.business.domain.Fence;
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.vo.FenceVo;
|
|
||||||
import com.zhilian.business.mapper.FenceMapper;
|
import com.zhilian.business.mapper.FenceMapper;
|
||||||
import com.zhilian.business.mapper.MarkersFenceMapper;
|
|
||||||
import com.zhilian.business.mapper.MarkersMapper;
|
|
||||||
import com.zhilian.business.service.FenceService;
|
import com.zhilian.business.service.FenceService;
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
import com.zhilian.common.core.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
package com.zhilian.business.service.impl;
|
package com.zhilian.business.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhilian.business.domain.Fence;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
import com.zhilian.business.domain.middle.MarkersFence;
|
||||||
import com.zhilian.business.mapper.MarkersFenceMapper;
|
import com.zhilian.business.mapper.MarkersFenceMapper;
|
||||||
import com.zhilian.business.service.MarkersFenceService;
|
import com.zhilian.business.service.MarkersFenceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MarkersFenceServiceImpl extends ServiceImpl<MarkersFenceMapper, MarkersFence> implements MarkersFenceService {
|
public class MarkersFenceServiceImpl extends ServiceImpl<MarkersFenceMapper, MarkersFence> implements MarkersFenceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -3,17 +3,19 @@ package com.zhilian.business.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhilian.business.domain.Markers;
|
import com.zhilian.business.domain.Markers;
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.mapper.MarkersMapper;
|
import com.zhilian.business.mapper.MarkersMapper;
|
||||||
import com.zhilian.business.service.MarkersService;
|
import com.zhilian.business.service.MarkersService;
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
import com.zhilian.common.core.utils.StringUtils;
|
||||||
|
import com.zhilian.common.redis.service.RedisService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MarkersServiceImpl extends ServiceImpl<MarkersMapper, Markers> implements MarkersService {
|
public class MarkersServiceImpl extends ServiceImpl<MarkersMapper, Markers> implements MarkersService {
|
||||||
|
@Autowired
|
||||||
|
RedisService service;
|
||||||
@Override
|
@Override
|
||||||
public List<Markers> selectMarkersList(Markers markers) {
|
public List<Markers> selectMarkersList(Markers markers) {
|
||||||
LambdaQueryWrapper<Markers> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Markers> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
@ -22,4 +24,20 @@ public class MarkersServiceImpl extends ServiceImpl<MarkersMapper, Markers> impl
|
||||||
|
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部标识信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Markers> listMarkers() {
|
||||||
|
if(service.hasKey("markers")){
|
||||||
|
List<Markers> markers = service.getCacheList("markers");
|
||||||
|
return markers;
|
||||||
|
}
|
||||||
|
List<Markers> list = this.list();
|
||||||
|
service.setCacheList("markers",list);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,36 @@
|
||||||
package com.zhilian.business.service.impl;
|
package com.zhilian.business.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhilian.business.domain.Vehicle;
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
import com.zhilian.business.domain.middle.VehicleMarkers;
|
||||||
import com.zhilian.business.mapper.VehicleMarkersMapper;
|
import com.zhilian.business.mapper.VehicleMarkersMapper;
|
||||||
import com.zhilian.business.service.VehicleMarkersService;
|
import com.zhilian.business.service.VehicleMarkersService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class VehicleMarkersServiceImpl extends ServiceImpl<VehicleMarkersMapper, VehicleMarkers> implements VehicleMarkersService {
|
public class VehicleMarkersServiceImpl extends ServiceImpl<VehicleMarkersMapper, VehicleMarkers> implements VehicleMarkersService {
|
||||||
|
|
||||||
|
@Transactional(rollbackFor=Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean insert(Vehicle vehicle) {
|
||||||
|
vehicle.getMarkersIds().forEach(markerId -> {
|
||||||
|
VehicleMarkers vehicleMarkers = new VehicleMarkers();
|
||||||
|
vehicleMarkers.setVehicleId(vehicle.getVehicleId());
|
||||||
|
vehicleMarkers.setMarkersId(markerId);
|
||||||
|
this.save(vehicleMarkers);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeAllVehicle(Vehicle vehicle) {
|
||||||
|
List<VehicleMarkers> list = this.list(new LambdaQueryWrapper<VehicleMarkers>().eq(VehicleMarkers::getVehicleId, vehicle.getVehicleId()));
|
||||||
|
list.forEach(item -> {
|
||||||
|
this.removeById(item.getVehicleId());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,41 +3,61 @@ package com.zhilian.business.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhilian.business.domain.Vehicle;
|
import com.zhilian.business.domain.Vehicle;
|
||||||
|
import com.zhilian.business.domain.middle.VehicleMarkers;
|
||||||
import com.zhilian.business.mapper.VehicleMapper;
|
import com.zhilian.business.mapper.VehicleMapper;
|
||||||
|
import com.zhilian.business.mapper.VehicleMarkersMapper;
|
||||||
import com.zhilian.business.service.VehicleService;
|
import com.zhilian.business.service.VehicleService;
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
import com.zhilian.common.core.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
|
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Vehicle> selectVehicleList(Vehicle vehicle) {
|
public List<Vehicle> selectVehicleList(Vehicle vehicle) {
|
||||||
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
//模糊条件 查询车辆VIN
|
//模糊条件 查询VIN
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(vehicle.getVehicleVIN()), Vehicle::getVehicleVIN, vehicle.getVehicleVIN());
|
if (StringUtils.isNotEmpty(vehicle.getVehicleVIN())) {
|
||||||
|
queryWrapper.like(Vehicle::getVehicleVIN, vehicle.getVehicleVIN());
|
||||||
//精确查询 查询车辆类型
|
}
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(String.valueOf(vehicle.getVehicleTypeId())), Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId());
|
// 精确查询 - 查询类型
|
||||||
|
if (vehicle.getVehicleTypeId() != null) {
|
||||||
|
queryWrapper.eq(Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId());
|
||||||
|
}
|
||||||
//模糊查询 车辆电机厂商
|
//模糊查询 车辆电机厂商
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(vehicle.getMotorID()), Vehicle::getMotorID, vehicle.getMotorID());
|
if (StringUtils.isNotEmpty(vehicle.getMotorId())) {
|
||||||
|
queryWrapper.like(Vehicle::getMotorId, vehicle.getMotorId());
|
||||||
|
}
|
||||||
//模糊查询 车辆电池厂商
|
//模糊查询 车辆电池厂商
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(vehicle.getBatteryID()), Vehicle::getBatteryID, vehicle.getBatteryID());
|
if (StringUtils.isNotEmpty(vehicle.getBatteryId())) {
|
||||||
|
queryWrapper.like(Vehicle::getBatteryId, vehicle.getBatteryId());
|
||||||
|
}
|
||||||
//模糊查询 车辆电机ID
|
//模糊查询 车辆电机ID
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(vehicle.getMotorBusiness()),Vehicle::getMotorBusiness, vehicle.getMotorBusiness());
|
if (StringUtils.isNotEmpty(vehicle.getVehicleMotor())) {
|
||||||
|
queryWrapper.like(Vehicle::getVehicleMotor, vehicle.getVehicleMotor());
|
||||||
|
}
|
||||||
//模糊查询 车辆电池ID
|
//模糊查询 车辆电池ID
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(vehicle.getBatteryBusiness()),Vehicle::getBatteryBusiness,vehicle.getBatteryBusiness());
|
if (StringUtils.isNotEmpty(vehicle.getVehicleBattery())) {
|
||||||
|
queryWrapper.like(Vehicle::getVehicleBattery, vehicle.getVehicleBattery());
|
||||||
|
}
|
||||||
|
//精确查询 车辆状态
|
||||||
|
if (vehicle.getVehicleState() != null) {
|
||||||
|
queryWrapper.eq(Vehicle::getVehicleState, vehicle.getVehicleState());
|
||||||
|
}
|
||||||
|
|
||||||
|
// queryWrapper.like(StringUtils.isNotEmpty(vehicle.getVehicleVIN()), Vehicle::getVehicleVIN, vehicle.getVehicleVIN())
|
||||||
|
// .eq(vehicle.getVehicleTypeId() != null, Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId())
|
||||||
|
// .like(StringUtils.isNotEmpty(vehicle.getMotorID()), Vehicle::getMotorID, vehicle.getMotorID())
|
||||||
|
// .like(StringUtils.isNotEmpty(vehicle.getBatteryID()), Vehicle::getBatteryID, vehicle.getBatteryID())
|
||||||
|
// .like(StringUtils.isNotEmpty(vehicle.getMotorBusiness()), Vehicle::getMotorBusiness, vehicle.getMotorBusiness())
|
||||||
|
// .like(StringUtils.isNotEmpty(vehicle.getBatteryBusiness()), Vehicle::getBatteryBusiness, vehicle.getBatteryBusiness())
|
||||||
|
// .eq(vehicle.getVehicleState() != null, Vehicle::getVehicleState, vehicle.getVehicleState());
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,57 +3,5 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhilian.business.mapper.FenceMapper">
|
<mapper namespace="com.zhilian.business.mapper.FenceMapper">
|
||||||
<!-- <resultMap type="com.zhilian.business.domain.Fence" id="FenceResult">-->
|
|
||||||
<!-- <id property="fenceId" column="fence_id"/>-->
|
|
||||||
<!-- <result property="fenceName" column="fence_name"/>-->
|
|
||||||
<!-- <result property="fenceTypeId" column="fence_type_id"/>-->
|
|
||||||
<!-- <result property="fenceState" column="fence_state"/>-->
|
|
||||||
<!-- <result property="fenceMessage" column="fence_message"/>-->
|
|
||||||
<!-- <result property="createBy" column="create_by"/>-->
|
|
||||||
<!-- <result property="createTime" column="create_time"/>-->
|
|
||||||
<!-- <result property="updateBy" column="update_by"/>-->
|
|
||||||
<!-- <result property="updateTime" column="update_time"/>-->
|
|
||||||
<!-- <result property="remark" column="remark"/>-->
|
|
||||||
<!-- </resultMap>-->
|
|
||||||
<select id="fenceList" resultType="com.zhilian.business.domain.Fence">
|
|
||||||
select * from business_fence
|
|
||||||
<where>
|
|
||||||
<if test="fenceName!=null and fenceName!=''">
|
|
||||||
and fence_name like concat('%',#{fenceName},'%')
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="fenceTypeId!=null">
|
|
||||||
and fence_type_id=#{fenceTypeId}
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="fenceState!=null">
|
|
||||||
and fence_state=#{fenceState}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<!-- <sql id="selectFenceVo">-->
|
|
||||||
<!-- select fence_id,-->
|
|
||||||
<!-- fence_name,-->
|
|
||||||
<!-- fence_type_id,-->
|
|
||||||
<!-- fence_state,-->
|
|
||||||
<!-- fence_message,-->
|
|
||||||
<!-- create_by,-->
|
|
||||||
<!-- create_time,-->
|
|
||||||
<!-- update_by,-->
|
|
||||||
<!-- update_time,-->
|
|
||||||
<!-- remark-->
|
|
||||||
<!-- from business_fence-->
|
|
||||||
<!-- </sql>-->
|
|
||||||
|
|
||||||
<!-- <select id="fenceList" parameterType="com.zhilian.business.domain.Fence">-->
|
|
||||||
<!-- <include refid="selectFenceVo"/>-->
|
|
||||||
<!-- <where>-->
|
|
||||||
<!-- <if test="fenceName != null and fenceName != ''">-->
|
|
||||||
<!-- AND fence_name like concat('%', #{fenceName}, '%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="fenceTypeId != null">-->
|
|
||||||
<!-- AND fenceTypeId = #{fenceTypeId}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- </where>-->
|
|
||||||
<!-- </select>-->
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -4,6 +4,4 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhilian.business.mapper.VehicleMapper">
|
<mapper namespace="com.zhilian.business.mapper.VehicleMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue