45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
package com.muyu.controller;
|
|
|
|
import com.muyu.common.Result;
|
|
import com.muyu.domain.Vehicle;
|
|
import com.muyu.service.VehicleService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author DongZeLiang
|
|
* @version 1.0
|
|
* @description 用户控制层
|
|
* @date 2023/11/9
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/vehicle")
|
|
public class VehicleController {
|
|
|
|
@Autowired
|
|
private VehicleService vehicleService;
|
|
|
|
@GetMapping("/list")
|
|
public Result<List<Vehicle>> list(){
|
|
return Result.success(vehicleService.list());
|
|
}
|
|
|
|
/**
|
|
* 根据输入的数量进行车辆随机生成
|
|
* @param sum 车辆总数
|
|
* @return 结果集
|
|
*/
|
|
@GetMapping("/gen/{sum}")
|
|
public Result<String> generate(@PathVariable(value = "sum") Integer sum){
|
|
vehicleService.generate(sum);
|
|
return Result.success();
|
|
}
|
|
|
|
|
|
}
|