Commit 1a6ce210 by 刘宇峰

新增车辆-车型管理

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