Commit 1a6ce210 by 刘宇峰

新增车辆-车型管理

1 parent 26154d57
......@@ -197,21 +197,21 @@ public class VehicleController {
@ApiOperation(value = "车辆子品牌查询")
@GetMapping("/subbrands")
public R<List<Carbrand>> subBrands(@RequestParam Long brandId) {
public R<List<Carbrand>> subBrands(@RequestParam Integer brandId) {
List<Carbrand> carBrandList = vehicleService.getSubBrandsByBrandId(brandId);
return R.ok().data(carBrandList);
}
@ApiOperation(value = "车辆系别查询")
@GetMapping("/series")
public R<List<Carseries>> series(@RequestParam Long brandId) {
public R<List<Carseries>> series(@RequestParam Integer brandId) {
List<Carseries> carSeriesList = vehicleService.getSeriesByBrandId(brandId);
return R.ok().data(carSeriesList);
}
@ApiOperation(value = "车辆类型查询")
@GetMapping("/types")
public R<List<Cartype>> types(@RequestParam Long seriesId) {
public R<List<Cartype>> types(@RequestParam Integer seriesId) {
List<Cartype> carTypeList = vehicleService.getTypesBySeriesId(seriesId);
return R.ok().data(carTypeList);
}
......
......@@ -23,7 +23,7 @@ public class TenantTypesDTO {
@JsonIgnore
private String types;
private List<Long> typeIds;
private List<Integer> typeIds;
private Long createdBy;
......
......@@ -22,6 +22,7 @@ public class VehicleTypesBO {
* 启用状态:0关闭;1开启
*/
private Integer enableStatus;
private List<Long> typeIds;
private List<Integer> typeIds;
}
......@@ -761,23 +761,28 @@ public class VehicleService {
}
@Cacheable(value = "carbrands", key = "#brandId")
public List<Carbrand> getSubBrandsByBrandId(Long brandId) {
return carbrandService.listSubCarbrandByParentId(Math.toIntExact(brandId));
public List<Carbrand> getSubBrandsByBrandId(Integer brandId) {
return carbrandService.listSubCarbrandByParentId(brandId);
}
@Cacheable(value = "carseries", key = "#brandId")
public List<Carseries> getSeriesByBrandId(Long brandId) {
return carseriesService.getByCarbrandId(Math.toIntExact(brandId));
public List<Carseries> getSeriesByBrandId(Integer brandId) {
return carseriesService.getByCarbrandId(brandId);
}
@Cacheable(value = "cartypes", key = "#seriesId")
public List<Cartype> getTypesBySeriesId(Long seriesId) {
return cartypeService.getBySeiesId(Math.toIntExact(seriesId));
public List<Cartype> getTypesBySeriesId(Integer seriesId) {
return cartypeService.getBySeiesId(seriesId);
}
@Cacheable(value = "carbrand", key = "#brandId")
public Carbrand getByBrandId(Integer brandId) {
return carbrandService.getParentBrandByBrandId(brandId);
}
@Cacheable(value = "cartype", key = "#typeId")
public Cartype getByTypeId(Long typeId) {
return cartypeService.getByCarTypeId(Math.toIntExact(typeId));
public Cartype getByTypeId(Integer typeId) {
return cartypeService.getByCarTypeId(typeId);
}
public void saveVehicleTypes(VehicleTypesBO typesBO) {
......@@ -789,7 +794,7 @@ public class VehicleService {
typesBO.getTypeIds().forEach(tId -> {
Cartype carType = this.getByTypeId(tId);
if (carType != null) {
Carbrand carBrand = carbrandService.getParentBrandByBrandId(carType.getCarBrandId());
Carbrand carBrand = this.getByBrandId(carType.getCarBrandId());
TenantVehicleType tvType = new TenantVehicleType();
tvType.setTenantId(typesBO.getTenantId());
......@@ -822,7 +827,7 @@ public class VehicleService {
TenantTypesDTO typesDTO = tenantVehicleTypeMapper.selectByTenantId(tenantId);
if (typesDTO != null) {
String[] typeStrs = typesDTO.getTypes().split(",");
Long[] types = (Long[]) ConvertUtils.convert(typeStrs, Long.class);
Integer[] types = (Integer[]) ConvertUtils.convert(typeStrs, Integer.class);
typesDTO.setTypeIds(Arrays.asList(types));
}
return typesDTO;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!