修改类型

This commit is contained in:
wangwenhua 2025-09-14 17:50:46 +08:00
parent 5d1e4020f3
commit 79b353760d
7 changed files with 86 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package com.hivekion.baseData.entity;
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 java.io.Serializable;
@ -27,18 +28,23 @@ public class WeatherResource implements Serializable {
private Integer id;
@ApiModelProperty("想定房间编号")
@TableField(value="room_id")
private String roomId;
@ApiModelProperty("想定场景编号")
@TableField(value="scenario_id")
private Integer scenarioId;
@ApiModelProperty("天气类型")
@TableField(value = "weather_type")
private String weatherType;
@ApiModelProperty("持续开始时间")
@TableField(value = "last_beg_time")
private LocalDateTime lastBegTime;
@ApiModelProperty("持续结束时间")
@TableField(value = "last_end_time")
private LocalDateTime lastEndTime;
public Integer getId() {

View File

@ -1,7 +1,15 @@
package com.hivekion.scenario.controller;
import com.hivekion.scenario.entity.Vehicle;
import com.hivekion.scenario.service.IResourceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
@ -15,4 +23,19 @@ import org.springframework.stereotype.Controller;
@RequestMapping("/scenario/resource")
public class ResourceController {
@Resource
private IResourceService resourceService;
@GetMapping("/listVehiclesByType")
public List<Vehicle> listVehiclesByType(@RequestParam("type") Integer type, @RequestParam("resourceId") Integer resourceId){
List<Vehicle> vehicleList = new ArrayList<>();
try{
vehicleList = this.resourceService.listAllVehiclesByType(type,resourceId);
}catch (Exception e){
e.printStackTrace();
}
return vehicleList;
}
}

View File

@ -1,5 +1,6 @@
package com.hivekion.scenario.entity;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@ -31,28 +32,35 @@ public class Resource implements Serializable {
private Integer id;
@ApiModelProperty("设施名称")
@TableField(value = "resource_name")
private String resourceName;
@ApiModelProperty("设施图标")
@TableField(value = "icon")
private String icon;
@ApiModelProperty("纬度")
@TableField(value = "lat")
private String lat;
@ApiModelProperty("经度")
@TableField(value = "lng")
private String lng;
@ApiModelProperty("设施属性")
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String,Object> resourceAttribut;
@TableField(value = "resource_attribut")
private String resourceAttribut;
@ApiModelProperty("创建人")
@TableField(value = "create_oper")
private String createOper;
@ApiModelProperty("更新人")
@TableField(value = "upd_oper")
private String updOper;
@ApiModelProperty("保障建筑资源类型")
@TableField(value = "resource_type")
private Integer resourceType;
public Integer getId() {
@ -95,11 +103,12 @@ public class Resource implements Serializable {
this.lng = lng;
}
public Map<String, Object> getResourceAttribut() {
public String getResourceAttribut() {
return resourceAttribut;
}
public void setResourceAttribut(Map<String, Object> resourceAttribut) {
public void setResourceAttribut(String resourceAttribut) {
this.resourceAttribut = resourceAttribut;
}

View File

@ -1,5 +1,6 @@
package com.hivekion.scenario.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
@ -20,9 +21,11 @@ public class ResourceVehicleRela implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("资源id")
@TableField(value = "resource_id")
private Integer resourceId;
@ApiModelProperty("车辆id")
@TableField(value = "vehicle_id")
private Integer vehicleId;
public Integer getResourceId() {

View File

@ -1,5 +1,6 @@
package com.hivekion.scenario.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
@ -20,30 +21,39 @@ public class Vehicle implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("物理主键id")
@TableField(value = "id")
private Integer id;
@ApiModelProperty("名称")
@TableField(value="vehicle_name")
private String vehicleName;
@ApiModelProperty("速度")
@TableField(value = "vehicle_spreed")
private String vehicleSpreed;
@ApiModelProperty("类型")
@TableField(value = "vehicle_type")
private String vehicleType;
@ApiModelProperty("运油能力")
@TableField(value = "fuel_ability")
private Integer fuelAbility;
@ApiModelProperty("运药能力")
@TableField(value = "medical_ability")
private Integer medicalAbility;
@ApiModelProperty("运弹药能力")
@TableField(value = "ammunition_ability")
private Integer ammunitionAbility;
@ApiModelProperty("创建人")
@TableField(value = "create_oper")
private String createOper;
@ApiModelProperty("更新人")
@TableField(value = "upd_oper")
private String updOper;
public Integer getId() {

View File

@ -2,6 +2,7 @@ package com.hivekion.scenario.service;
import com.hivekion.scenario.entity.Resource;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hivekion.scenario.entity.Vehicle;
import java.util.List;
@ -17,4 +18,6 @@ public interface IResourceService extends IService<Resource> {
public List<Resource> listAllBuildResourceByType(Integer type);
public List<Vehicle> listAllVehiclesByType(Integer type,Integer resourceId);
}

View File

@ -2,12 +2,20 @@ package com.hivekion.scenario.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hivekion.scenario.entity.Resource;
import com.hivekion.scenario.entity.ResourceVehicleRela;
import com.hivekion.scenario.entity.Vehicle;
import com.hivekion.scenario.mapper.ResourceMapper;
import com.hivekion.scenario.service.IResourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hivekion.scenario.service.IResourceVehicleRelaService;
import com.hivekion.scenario.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@ -20,10 +28,29 @@ import java.util.List;
@Service
public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> implements IResourceService {
@Autowired
private IResourceVehicleRelaService resourceVehicleRelaService;
@Autowired
private ResourceMapper resourceMapper;
@Autowired
private IVehicleService vehicleService;
@Override
public List<Resource> listAllBuildResourceByType(Integer type) {
QueryWrapper<Resource> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(type != null,"resource_type",type);
return this.list(queryWrapper);
return this.resourceMapper.selectList(queryWrapper);
}
@Override
public List<Vehicle> listAllVehiclesByType(Integer type, Integer resourceId) {
List<ResourceVehicleRela> rVRela = this.resourceVehicleRelaService.list(new QueryWrapper<ResourceVehicleRela>().eq("resource_id",resourceId));
List<Integer> vehicleIds = rVRela.stream().map(ResourceVehicleRela::getResourceId).collect(Collectors.toList());
List<Vehicle> qryResult = new ArrayList<>();
if(!CollectionUtils.isEmpty(vehicleIds)){
qryResult = this.vehicleService.list(new QueryWrapper<Vehicle>().in("id",vehicleIds));
}
return qryResult;
}
}