Merge remote-tracking branch 'origin/server_five_fufanrui' into server_five_xiaoyao
commit
de572170ec
|
@ -20,4 +20,14 @@ public class ServiceNameConstants {
|
|||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "couplet-file";
|
||||
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 车辆管理模块
|
||||
* @date
|
||||
*/
|
||||
public static final String VEHICLE_SERVICE = "couplet-vehicle";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?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.couplet</groupId>
|
||||
<artifactId>couplet-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>couplet-common-vehicle</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>
|
||||
<!-- MuYu Common Core-->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,89 @@
|
|||
package com.couplet.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/26
|
||||
* @Description: 车辆信息表
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("couplet_vehicle")
|
||||
public class Vehicle{
|
||||
/*
|
||||
*车辆id
|
||||
* */
|
||||
@TableId(type = IdType.AUTO, value = "vehicle_id")
|
||||
private Long vehicleId;
|
||||
|
||||
/*
|
||||
*车辆类型
|
||||
* */
|
||||
@TableField(value = "vehicle_type")
|
||||
private Long vehicleType;
|
||||
|
||||
/*
|
||||
* 车辆类型名称
|
||||
* */
|
||||
@TableField(exist = false)
|
||||
private String vehicleTypeName;
|
||||
|
||||
|
||||
/*
|
||||
*电机厂商
|
||||
* */
|
||||
@TableField(value = "motor_manufacturer")
|
||||
private String motorManufacturer;
|
||||
|
||||
/*
|
||||
*电池厂商
|
||||
* */
|
||||
@TableField(value = "battery_manufacturer")
|
||||
private String batteryManufacturer;
|
||||
|
||||
/*
|
||||
*电机编号
|
||||
* */
|
||||
@TableField(value = "motor_number")
|
||||
private String motorNumber;
|
||||
|
||||
/*
|
||||
*电池编号
|
||||
* */
|
||||
@TableField(value = "battery_number")
|
||||
private String batteryNumber;
|
||||
|
||||
/*
|
||||
*vin码
|
||||
* */
|
||||
@TableField(value = "vin")
|
||||
private String vin;
|
||||
|
||||
/*
|
||||
*0离线 1在线
|
||||
* */
|
||||
@TableField(value = "vehicle_state")
|
||||
private Integer vehicleState;
|
||||
|
||||
/*
|
||||
*0未删除 1删除
|
||||
* */
|
||||
@TableField(value = "isdelete")
|
||||
private Integer isdelete;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.couplet.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/30
|
||||
* @Description: 车辆和标志中间表
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("couplet_vehicle_and_logo")
|
||||
public class VehicleAndLogo {
|
||||
|
||||
/*
|
||||
* 车辆、标志中间表id
|
||||
* */
|
||||
@TableId(type = IdType.AUTO, value = "vehicle_logo_middle_id")
|
||||
private Long vehicleLogoMiddleId;
|
||||
|
||||
/*
|
||||
* 车辆id
|
||||
* */
|
||||
@TableField("vehicle_id")
|
||||
private Long vehicleId;
|
||||
|
||||
/*
|
||||
* 标志id
|
||||
* */
|
||||
@TableField("logo_id")
|
||||
private Long logoId;
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.couplet.common.system.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2024/4/2 11:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@ToString
|
||||
public class VehicleMiddle{
|
||||
|
||||
private Long middleId;
|
||||
private Long userId;
|
||||
private Long vehicleId;
|
||||
private Long delFlag;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.couplet.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/31
|
||||
* @Description: 车辆类型
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("couplet_vehicle_type")
|
||||
public class VehicleType {
|
||||
|
||||
/*
|
||||
* 车辆类型id
|
||||
* */
|
||||
@TableId(type = IdType.AUTO, value = "vehicle_type_id")
|
||||
private Long vehicleTypeId;
|
||||
|
||||
/*
|
||||
* 车辆类型名称
|
||||
* */
|
||||
@TableField(value = "vehicle_type_name")
|
||||
private String vehicleTypeName;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.couplet.common.system.remote;
|
||||
|
||||
import com.couplet.common.core.constant.ServiceNameConstants;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.Vehicle;
|
||||
import com.couplet.common.system.domain.VehicleMiddle;
|
||||
import com.couplet.common.system.remote.factory.RemoteVehicleFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(contextId = "remoteVehicleService" ,
|
||||
value = ServiceNameConstants.VEHICLE_SERVICE,
|
||||
fallbackFactory = RemoteVehicleFallbackFactory.class,
|
||||
path = "/vehicle"
|
||||
)
|
||||
public interface RemoteVehicleService {
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 根据员工id查询员工下有哪些车
|
||||
* @date
|
||||
*/
|
||||
@PostMapping("UserUnderTheVehicle/{userId}")
|
||||
public Result<List<Vehicle>> UserUnderTheVehicleList(@PathVariable(value = "userId") Long userId);
|
||||
|
||||
|
||||
/*
|
||||
* @param middleId:
|
||||
* @return Result<Integer>
|
||||
* @author 付凡芮
|
||||
* @description 删除员工管理的车辆
|
||||
* @date
|
||||
*/
|
||||
@DeleteMapping("/{middleId}")
|
||||
public Result<Integer> deleteVehicle(@PathVariable(value = "middleId") Long middleId);
|
||||
|
||||
|
||||
@PostMapping
|
||||
public Result<Integer> addVehicle(@RequestBody VehicleMiddle vehicleMiddle);
|
||||
|
||||
|
||||
|
||||
@PostMapping("vehicleAll")
|
||||
public Result<List<Vehicle>> VehicleManageList();
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.couplet.common.system.remote.factory;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.Vehicle;
|
||||
import com.couplet.common.system.domain.VehicleMiddle;
|
||||
import com.couplet.common.system.remote.RemoteVehicleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2024/4/2 14:46
|
||||
*/
|
||||
public class RemoteVehicleFallbackFactory implements FallbackFactory<RemoteVehicleService> {
|
||||
|
||||
|
||||
@Override
|
||||
public RemoteVehicleService create(Throwable cause) {
|
||||
return new RemoteVehicleService() {
|
||||
@Override
|
||||
public Result<List<Vehicle>> UserUnderTheVehicleList(Long userId) {
|
||||
return Result.error("调用失败...."+cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> deleteVehicle(Long middleId) {
|
||||
return Result.error("调用失败...."+cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> addVehicle(VehicleMiddle vehicleMiddle) {
|
||||
return Result.error("调用失败....."+cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Vehicle>> VehicleManageList() {
|
||||
return Result.error("调用失败....."+cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.couplet.common.system.remote.factory.RemoteVehicleFallbackFactory
|
|
@ -19,6 +19,7 @@
|
|||
<module>couplet-common-datasource</module>
|
||||
<module>couplet-common-system</module>
|
||||
<module>couplet-trouble-log</module>
|
||||
<module>couplet-common-vehicle</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>couplet-common</artifactId>
|
||||
|
|
|
@ -82,6 +82,17 @@
|
|||
<artifactId>couplet-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-vehicle</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-vehicle</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package com.couplet.server.controller;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.Vehicle;
|
||||
import com.couplet.common.system.domain.VehicleMiddle;
|
||||
import com.couplet.server.service.VehicleManageService;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 车辆管理控制层
|
||||
* @date 2024/4/2 9:05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/VehicleManage")
|
||||
public class VehicleManageController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VehicleManageService vehicleManageService;
|
||||
|
||||
/*
|
||||
* @param :
|
||||
* @return Result<List<Vehicle>>
|
||||
* @author 付凡芮
|
||||
* @description Y管理车辆列表
|
||||
* @date
|
||||
*/
|
||||
@PostMapping("/VehicleManageList")
|
||||
public Result<List<Vehicle>> VehicleManageList(){
|
||||
List<Vehicle> vehicles = vehicleManageService.VehicleManageList();
|
||||
Result<List<Vehicle>> success = Result.success(vehicles);
|
||||
return success;
|
||||
}
|
||||
/*
|
||||
* @param middleId:
|
||||
* @return Result<Integer>
|
||||
* @author 付凡芮
|
||||
* @description 删除员工管理的车辆
|
||||
* @date
|
||||
*/
|
||||
|
||||
@DeleteMapping("/{middleId}")
|
||||
public Result deleteVehicle(@PathVariable(value = "middleId") Long middleId){
|
||||
return vehicleManageService.deleteVehicle(middleId);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param middle:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 添加车辆
|
||||
* @date
|
||||
*/
|
||||
@PostMapping
|
||||
public Result addVehicle(@RequestBody VehicleMiddle middle){
|
||||
return vehicleManageService.addVehicle(middle);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("vehicleAll")
|
||||
public Result<List<Vehicle>> vehicleAll(){
|
||||
List<Vehicle> vehicles = vehicleManageService.vehicleAll();
|
||||
return Result.success(vehicles);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.couplet.server.service;
|
||||
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.Vehicle;
|
||||
import com.couplet.common.system.domain.VehicleMiddle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VehicleManageService {
|
||||
List<Vehicle> VehicleManageList();
|
||||
|
||||
|
||||
Result deleteVehicle(Long middleId);
|
||||
|
||||
Result addVehicle(VehicleMiddle middle);
|
||||
|
||||
List<Vehicle> vehicleAll();
|
||||
|
||||
}
|
|
@ -91,6 +91,14 @@ public class EmployeeServiceImpl implements EmployeeService{
|
|||
return remoteEmployeeService.changeStatus(user);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param user:
|
||||
* @return List<SysUser>
|
||||
* @author 付凡芮
|
||||
* @description 员工管理列表
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> userList(SysUser user) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.couplet.server.service.impl;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.security.utils.SecurityUtils;
|
||||
import com.couplet.common.system.domain.Vehicle;
|
||||
import com.couplet.common.system.domain.VehicleMiddle;
|
||||
import com.couplet.common.system.remote.RemoteVehicleService;
|
||||
import com.couplet.server.service.VehicleManageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 车辆管理服务实现类
|
||||
* @date 2024/4/2 9:05
|
||||
*/
|
||||
@Service
|
||||
public class VehicleManageServiceImpl implements VehicleManageService{
|
||||
|
||||
|
||||
@Autowired
|
||||
private RemoteVehicleService remoteVehicleService;
|
||||
|
||||
/*
|
||||
* @description: 车辆管理列表
|
||||
* @param: []
|
||||
* @return: com.couplet.common.core.domain.Result<java.util.List<com.couplet.common.system.domain.Vehicle>>
|
||||
*/
|
||||
@Override
|
||||
public List<Vehicle> VehicleManageList() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Result<List<Vehicle>> listResult = remoteVehicleService.UserUnderTheVehicleList(userId);
|
||||
List<Vehicle> list = listResult.getData();
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param middleId:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 删除员工管理车辆
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public Result deleteVehicle(Long middleId) {
|
||||
Result<Integer> integerResult = remoteVehicleService.deleteVehicle(middleId);
|
||||
Integer resultData = integerResult.getData();
|
||||
|
||||
return resultData==1?Result.success():Result.error("删除失败");
|
||||
}
|
||||
|
||||
/*
|
||||
* @param middle:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 添加车辆
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public Result addVehicle(VehicleMiddle middle) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
middle.setUserId(userId);
|
||||
Result<Integer> integerResult = remoteVehicleService.addVehicle(middle);
|
||||
Integer resultData = integerResult.getData();
|
||||
return resultData==1?Result.success():Result.error("添加失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Vehicle> vehicleAll() {
|
||||
Result<List<Vehicle>> listResult = remoteVehicleService.VehicleManageList();
|
||||
return listResult.getData();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ import com.couplet.common.log.annotation.Log;
|
|||
import com.couplet.common.log.enums.BusinessType;
|
||||
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||
import com.couplet.vehicle.domain.Vehicle;
|
||||
import com.couplet.vehicle.domain.VehicleMiddle;
|
||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
|
@ -118,4 +119,63 @@ public class VehicleController extends BaseController {
|
|||
|
||||
return Result.success(bindLogoById);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 根据员工id查询员工下有哪些车
|
||||
* @date
|
||||
*/
|
||||
@PostMapping("UserUnderTheVehicle/{userId}")
|
||||
public Result<List<Vehicle>> UserUnderTheVehicleList(@PathVariable Long userId){
|
||||
List<Vehicle> userVehicleList = vehicleService.UserUnderTheVehicleList(userId);
|
||||
Result<List<Vehicle>> success = Result.success(userVehicleList);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 删除员工所管理的车辆
|
||||
* @date
|
||||
*/
|
||||
@DeleteMapping("/{middleId}")
|
||||
public Result<Integer> deleteVehicle(@PathVariable Long middleId){
|
||||
Integer remove = vehicleService.deleteVehicle(middleId);
|
||||
return Result.success(remove);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 添加员工车辆
|
||||
* @date
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<Integer> addVehicle(@RequestBody VehicleMiddle vehicleMiddle){
|
||||
Integer i = vehicleService.addVehicle(vehicleMiddle);
|
||||
return Result.success(i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 车辆列表查询
|
||||
* @date
|
||||
*/
|
||||
@PostMapping("vehicleAll")
|
||||
public Result<List<Vehicle>> VehicleManageList(){
|
||||
List<Vehicle> vehicleAll = vehicleService.vehicleAll();
|
||||
return Result.success(vehicleAll);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@ import lombok.experimental.SuperBuilder;
|
|||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("couplet_vehicle")
|
||||
public class Vehicle {
|
||||
public class Vehicle{
|
||||
|
||||
|
||||
/*
|
||||
*车辆id
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.couplet.vehicle.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2024/4/2 11:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class VehicleMiddle{
|
||||
|
||||
private Long middleId;
|
||||
private Long userId;
|
||||
private Long vehicleId;
|
||||
private Long delFlag;
|
||||
}
|
|
@ -2,9 +2,12 @@ package com.couplet.vehicle.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.couplet.vehicle.domain.Vehicle;
|
||||
import com.couplet.vehicle.domain.VehicleMiddle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
|
@ -14,4 +17,11 @@ import org.springframework.stereotype.Component;
|
|||
@Mapper
|
||||
@Component
|
||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||
List<Vehicle> UserUnderTheVehicleList(Long userId);
|
||||
|
||||
Integer deleteVehicle(Long middleId);
|
||||
|
||||
Integer addVehicle(VehicleMiddle vehicleMiddle);
|
||||
|
||||
List<Vehicle> vehicleAll();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.couplet.vehicle.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.couplet.vehicle.domain.Vehicle;
|
||||
import com.couplet.vehicle.domain.VehicleMiddle;
|
||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
|
@ -25,4 +26,13 @@ public interface VehicleService extends IService<Vehicle> {
|
|||
String insert(VehicleInsertParams insertParams);
|
||||
|
||||
List<Long> getBindLogoById(Long vehicleId);
|
||||
|
||||
List<Vehicle> UserUnderTheVehicleList(Long userId);
|
||||
|
||||
Integer deleteVehicle(Long middleId);
|
||||
|
||||
Integer addVehicle(VehicleMiddle vehicleMiddle);
|
||||
|
||||
List<Vehicle> vehicleAll();
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.core.utils.StringUtils;
|
||||
import com.couplet.common.security.utils.SecurityUtils;
|
||||
import com.couplet.vehicle.domain.Vehicle;
|
||||
import com.couplet.vehicle.domain.VehicleMiddle;
|
||||
import com.couplet.vehicle.domain.VehicleType;
|
||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
|
@ -243,4 +245,32 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
|
|||
return logoIds;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param userId:
|
||||
* @return List<Vehicle>
|
||||
* @author 付凡芮
|
||||
* @description 根据登入人id查询管理车辆
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public List<Vehicle> UserUnderTheVehicleList(Long userId) {
|
||||
return vehicleMapper.UserUnderTheVehicleList(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteVehicle(Long middleId) {
|
||||
return vehicleMapper.deleteVehicle(middleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer addVehicle(VehicleMiddle vehicleMiddle) {
|
||||
|
||||
return vehicleMapper.addVehicle(vehicleMiddle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Vehicle> vehicleAll() {
|
||||
return vehicleMapper.vehicleAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,4 +5,59 @@
|
|||
<mapper namespace="com.couplet.vehicle.mapper.VehicleMapper">
|
||||
|
||||
|
||||
<sql id="selectMiddleUserOrVehicle">
|
||||
SELECT
|
||||
m.middle_id,
|
||||
m.user_id,
|
||||
m.vehicle_id,
|
||||
m.del_flag,
|
||||
v.vehicle_type,
|
||||
v.motor_manufacturer,
|
||||
v.battery_manufacturer,
|
||||
v.motor_number,
|
||||
v.battery_number,
|
||||
v.vin,
|
||||
v.vehicle_state,
|
||||
t.vehicle_type_name
|
||||
FROM
|
||||
`couplet_middle` m
|
||||
LEFT JOIN couplet_vehicle v ON m.vehicle_id = v.vehicle_id
|
||||
LEFT JOIN couplet_vehicle_type t ON v.vehicle_id = t.vehicle_type_id
|
||||
WHERE m.del_flag = 0
|
||||
</sql>
|
||||
<sql id="selectVehicle">
|
||||
select
|
||||
v.vehicle_id,
|
||||
v.motor_manufacturer,
|
||||
v.battery_manufacturer,
|
||||
v.motor_number,
|
||||
v.battery_number,
|
||||
v.vin,
|
||||
v.vehicle_state,
|
||||
t.vehicle_type_name
|
||||
from couplet_vehicle v
|
||||
left join couplet_vehicle_type t on v.vehicle_type = t.vehicle_type_id
|
||||
where v.isdelete = 0
|
||||
</sql>
|
||||
<insert id="addVehicle">
|
||||
INSERT INTO `couplet-cloud`.`couplet_middle` (`user_id`, `vehicle_id`, `del_flag`) VALUES
|
||||
<foreach collection="vehicleId" item="vehicleId" separator=",">
|
||||
(#{userId}, #{vehicleId}, 0)
|
||||
</foreach>
|
||||
</insert>
|
||||
<delete id="deleteVehicle">
|
||||
update couplet_middle
|
||||
set del_flag = '2'
|
||||
where middle_id = #{middleId}
|
||||
</delete>
|
||||
|
||||
<select id="UserUnderTheVehicleList" resultType="com.couplet.vehicle.domain.Vehicle">
|
||||
<include refid="selectMiddleUserOrVehicle"/>
|
||||
<if test="userId!=null">
|
||||
AND m.user_id = #{userId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="vehicleAll" resultType="com.couplet.vehicle.domain.Vehicle">
|
||||
<include refid="selectVehicle"/>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -122,7 +122,7 @@ public class SysDeptController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*根据deptId获取企业名称
|
||||
*/
|
||||
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId){
|
||||
|
|
Loading…
Reference in New Issue