|
@@ -0,0 +1,57 @@
|
|
|
+package com.sqx.modules.car.controller.app;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.sqx.common.utils.Result;
|
|
|
+import com.sqx.modules.app.annotation.Login;
|
|
|
+import com.sqx.modules.car.entity.Car;
|
|
|
+import com.sqx.modules.car.service.CarService;
|
|
|
+import com.sqx.modules.emergencyContact.entity.EmergencyContact;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@Api(value = "车辆管理", tags = {"车辆管理"})
|
|
|
+@RequestMapping("/app/car")
|
|
|
+public class AppCarController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CarService carService;
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @GetMapping("/selectCarList")
|
|
|
+ @ApiOperation("查询用户车辆")
|
|
|
+ public Result selectCarList(@RequestAttribute("userId")Long userId){
|
|
|
+ return Result.success().put("data",carService.list(new QueryWrapper<Car>().eq("user_id",userId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @PostMapping("/insertCar")
|
|
|
+ @ApiOperation("新增车辆")
|
|
|
+ public Result insertCar(@RequestAttribute("userId")Long userId, Car car){
|
|
|
+ car.setUserId(userId);
|
|
|
+ car.setStatus(1L);
|
|
|
+ carService.insert(car);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectCarById")
|
|
|
+ @ApiOperation("根据ID查询车辆")
|
|
|
+ public Result selectCarById(Long carId){
|
|
|
+ return Result.success().put("data",carService.getOne(new QueryWrapper<Car>().eq("car_id",carId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/updateCar")
|
|
|
+ @ApiOperation("修改车辆信息")
|
|
|
+ public Result updateEmergency(Car car){
|
|
|
+ return carService.updateCar(car);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/deleteCar")
|
|
|
+ @ApiOperation("删除车辆信息")
|
|
|
+ public Result deleteCar(Long carId){
|
|
|
+ return carService.deleteCar(carId);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|