装备分类中实现车辆分类,车辆类型维护的增删改查
This commit is contained in:
parent
1557fd9e35
commit
92a383a9b3
|
@ -2,24 +2,27 @@ package com.hivekion.baseData.controller;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.hivekion.baseData.domain.TblEntity;
|
||||
import com.hivekion.baseData.domain.tblhospitalVo.HospitalSearchVo;
|
||||
import com.hivekion.baseData.domain.tblhospitalVo.HospitalViewVo;
|
||||
import com.hivekion.baseData.domain.tblresourceVo.ResourcesTypeVo;
|
||||
import com.hivekion.baseData.service.ITblEntityService;
|
||||
import com.hivekion.common.annotation.AutoLog;
|
||||
import com.hivekion.common.entity.PagedResultVo;
|
||||
import com.hivekion.common.entity.ResponseData;
|
||||
import com.hivekion.common.enums.OperationTypeEnum;
|
||||
import com.hivekion.scenario.entity.Resource;
|
||||
import com.hivekion.scenario.service.IResourceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
@ -30,6 +33,10 @@ public class TblHospitalController {
|
|||
|
||||
@Autowired
|
||||
private IResourceService service;
|
||||
|
||||
@Autowired
|
||||
private ITblEntityService entityService;
|
||||
|
||||
@PostMapping("/getList")
|
||||
@ApiOperation(value = "获取医院列表", notes = "")
|
||||
@AutoLog(value = "获取医院列表", operationType = OperationTypeEnum.SELECT, module = "基础数据/医院")
|
||||
|
@ -45,6 +52,7 @@ public class TblHospitalController {
|
|||
hospitalViewVo.setDoctorNum(jsonObject.get("doctor_num").toString());
|
||||
hospitalViewVo.setHospitalBed(jsonObject.get("hospital_bed").toString());
|
||||
hospitalViewVo.setNurseNum(jsonObject.get("nurse_num").toString());
|
||||
hospitalViewVo.setResourceType("hospital");
|
||||
|
||||
// resource.getResourceAttribut()
|
||||
hospitalViewVos.add(hospitalViewVo);
|
||||
|
@ -52,4 +60,6 @@ public class TblHospitalController {
|
|||
hospitalViewVoPagedResultVo.setData(hospitalViewVos);
|
||||
return hospitalViewVoPagedResultVo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
package com.hivekion.baseData.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hivekion.baseData.domain.TblAircraftVo.ImgAircraftImageInfoVo;
|
||||
import com.hivekion.baseData.domain.TblAircraftVo.TblAircraftAddInputVo;
|
||||
import com.hivekion.baseData.domain.TblAircraftVo.TblAircraftModelVo;
|
||||
import com.hivekion.baseData.domain.tblhospitalVo.HospitalSearchVo;
|
||||
import com.hivekion.baseData.domain.tblhospitalVo.HospitalViewVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.ImgVehicleImageInfoVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleSearchVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleViewVo;
|
||||
import com.hivekion.baseData.service.IImgVehicleImageService;
|
||||
import com.hivekion.common.annotation.AutoLog;
|
||||
import com.hivekion.common.entity.PagedResultVo;
|
||||
import com.hivekion.common.enums.OperationTypeEnum;
|
||||
import com.hivekion.scenario.entity.Resource;
|
||||
import com.hivekion.scenario.entity.Vehicle;
|
||||
import com.hivekion.scenario.service.IVehicleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/basedata/vehicle")
|
||||
|
||||
@Api(value = "车辆", tags = {"装备管理-车辆"})
|
||||
public class TblVehicleController {
|
||||
|
||||
@Autowired
|
||||
private IVehicleService vehicleService;
|
||||
|
||||
@Autowired
|
||||
private IImgVehicleImageService iImgVehicleImageService;
|
||||
|
||||
@PostMapping("/getList")
|
||||
@ApiOperation(value = "获取车辆列表", notes = "")
|
||||
@AutoLog(value = "获取车辆列表", operationType = OperationTypeEnum.SELECT, module = "基础数据/车辆")
|
||||
public PagedResultVo<VehicleViewVo> getList(@RequestBody VehicleSearchVo vo) {
|
||||
Page<Vehicle> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
||||
LambdaQueryWrapper<Vehicle> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(vo.getVehicleType()),Vehicle::getVehicleType,vo.getVehicleType());
|
||||
IPage<Vehicle> vehicleList = this.vehicleService.page(page,lambdaQueryWrapper);
|
||||
PagedResultVo<VehicleViewVo> vehicleViewVoPagedResultVo = new PagedResultVo<>();
|
||||
List<VehicleViewVo> vehicleViewVos = CollectionUtil.newArrayList();
|
||||
|
||||
vehicleList.getRecords().stream().forEach(vehicle -> {
|
||||
VehicleViewVo vehicleViewVo = new VehicleViewVo();
|
||||
BeanUtil.copyProperties(vehicle,vehicleViewVo);
|
||||
vehicleViewVo.setId(vehicle.getId());
|
||||
|
||||
// resource.getResourceAttribut()
|
||||
vehicleViewVos.add(vehicleViewVo);
|
||||
});
|
||||
vehicleViewVoPagedResultVo.setData(vehicleViewVos);
|
||||
return vehicleViewVoPagedResultVo;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getInfo")
|
||||
@ApiOperation(value = "获取车辆详细信息", notes = "")
|
||||
@AutoLog(value = "获取车辆详细信息", operationType = OperationTypeEnum.SELECT, module = "基础数据/车辆信息")
|
||||
public VehicleViewVo getInfo(Integer id, boolean doFlag) {
|
||||
return vehicleService.getInfo(id,doFlag);
|
||||
}
|
||||
|
||||
@DeleteMapping("/remove")
|
||||
@ApiOperation(value = "删除车辆", notes = "")
|
||||
@AutoLog(value = "删除车辆", operationType = OperationTypeEnum.DELETE, module = "基础数据/车辆信息")
|
||||
public Boolean remove(String Guid) {
|
||||
return vehicleService.remove(Guid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
|
||||
@GetMapping("/getimglist")
|
||||
@ApiOperation(value = "获取车辆图片", notes = "")
|
||||
@AutoLog(value = "获取车辆图片", operationType = OperationTypeEnum.SELECT, module = "基础数据/获取车辆图片")
|
||||
public ImgVehicleImageInfoVo getImgList(Integer Id) throws IOException {
|
||||
return iImgVehicleImageService.getInfo(Id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成新Id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getNewId")
|
||||
@ApiOperation(value = "获取新id", notes = "")
|
||||
@AutoLog(value = "获取新id", operationType = OperationTypeEnum.SELECT, module = "基础数据/获取新id")
|
||||
public Integer getNewId() {
|
||||
return vehicleService.getNewId();
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "新增车辆信息", notes = "")
|
||||
@AutoLog(value = "新增车辆信息", operationType = OperationTypeEnum.INSERT, module = "基础数据/新增车辆信息")
|
||||
public boolean add(@RequestBody VehicleAddInputVo inputVo) throws Exception {
|
||||
// service.checkAircraft(inputVo);
|
||||
return vehicleService.add(inputVo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hivekion.baseData.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ImgVehicleImage {
|
||||
|
||||
private Integer id;
|
||||
private String guid;
|
||||
private byte[] icon;
|
||||
private byte[] image;
|
||||
private String model3D;
|
||||
|
||||
}
|
|
@ -7,4 +7,5 @@ public class TblEntityUpdateNameVo {
|
|||
private Integer id;
|
||||
private String EntityName;
|
||||
private Integer ParentId;
|
||||
private String EntityType;
|
||||
}
|
||||
|
|
|
@ -33,5 +33,7 @@ public class HospitalViewVo implements Serializable {
|
|||
private String nurseNum;
|
||||
private String hospitalBed;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.hivekion.baseData.domain.tblresourceVo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResourcesTypeVo {
|
||||
|
||||
private String resourceTypeCode;
|
||||
private String resourceTypeName;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hivekion.baseData.domain.tblvehicleVo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ImgVehicleImageInfoVo {
|
||||
|
||||
private Integer id;
|
||||
private String guid;
|
||||
private String icon;
|
||||
private String image;
|
||||
private String model3D;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.hivekion.baseData.domain.tblvehicleVo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class VehicleAddInputVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonProperty(value = "ID")
|
||||
private Integer id;
|
||||
|
||||
|
||||
private String vehicleName;
|
||||
|
||||
|
||||
private String vehicleSpreed;
|
||||
|
||||
|
||||
private String vehicleType;
|
||||
|
||||
|
||||
private Integer fuelAbility;
|
||||
|
||||
|
||||
private Integer medicalAbility;
|
||||
|
||||
|
||||
private Integer ammunitionAbility;
|
||||
|
||||
|
||||
private Integer vehicleUse;
|
||||
|
||||
|
||||
private String IconType;
|
||||
|
||||
private String Model3D;
|
||||
|
||||
private String Description;
|
||||
|
||||
private Integer ParentDirId;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.hivekion.baseData.domain.tblvehicleVo;
|
||||
|
||||
import com.hivekion.common.entity.SearchInputVo;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Data
|
||||
public class VehicleSearchVo extends SearchInputVo {
|
||||
|
||||
private String vehicleType;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.hivekion.baseData.domain.tblvehicleVo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class VehicleViewVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@JsonProperty("ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String vehicleName;
|
||||
|
||||
@ApiModelProperty("速度")
|
||||
private String vehicleSpreed;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private String vehicleType;
|
||||
|
||||
@ApiModelProperty("运油能力")
|
||||
private Integer fuelAbility;
|
||||
|
||||
@ApiModelProperty("运药能力")
|
||||
private Integer medicalAbility;
|
||||
|
||||
@ApiModelProperty("运弹药能力")
|
||||
private Integer ammunitionAbility;
|
||||
|
||||
private Integer vehicleUse;
|
||||
|
||||
private String Guid;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.hivekion.baseData.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hivekion.baseData.domain.ImgAircraftImage;
|
||||
import com.hivekion.baseData.domain.ImgVehicleImage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ImgVehicleImageMapper extends BaseMapper<ImgVehicleImage> {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.hivekion.baseData.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hivekion.baseData.domain.ImgAircraftImage;
|
||||
import com.hivekion.baseData.domain.ImgVehicleImage;
|
||||
import com.hivekion.baseData.domain.TblAircraftVo.ImgAircraftImageInfoVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.ImgVehicleImageInfoVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface IImgVehicleImageService extends IService<ImgVehicleImage> {
|
||||
ImgVehicleImageInfoVo getInfo(Integer id);
|
||||
// boolean add(ImgAircraftImageAddInputVo vo);
|
||||
boolean add(MultipartFile file, Integer id) throws IOException;
|
||||
boolean remove(String Guid);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.hivekion.baseData.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hivekion.baseData.domain.ImgVehicleImage;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.ImgVehicleImageInfoVo;
|
||||
import com.hivekion.baseData.mapper.ImgVehicleImageMapper;
|
||||
import com.hivekion.baseData.service.IImgVehicleImageService;
|
||||
import com.hivekion.common.exception.BusinessException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Base64Utils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Service
|
||||
public class ImgVehicleImageServiceImpl extends ServiceImpl<ImgVehicleImageMapper, ImgVehicleImage> implements IImgVehicleImageService {
|
||||
@Override
|
||||
public ImgVehicleImageInfoVo getInfo(Integer id){
|
||||
ImgVehicleImage img = this.getById(id);
|
||||
if(img==null){
|
||||
throw new BusinessException(500,"未找到该图片信息");
|
||||
}
|
||||
ImgVehicleImageInfoVo vo = new ImgVehicleImageInfoVo();
|
||||
BeanUtils.copyProperties(img,vo);
|
||||
// vo.setImage(Base64.byteArrayToAltBase64(img.getImage()));
|
||||
vo.setImage(Base64Utils.encodeToString(img.getImage()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean add(ImgAircraftImageAddInputVo vo) {
|
||||
// ImgAircraftImage img = new ImgAircraftImage();
|
||||
// BeanUtils.copyProperties(vo,img);
|
||||
// img.setImage(Base64Utils.decodeFromString(vo.getImage()));
|
||||
//// img.setImage(Base64.altBase64ToByteArray(vo.getImage()));
|
||||
// img.setGuid("hsfw-dataaircraft-" +String.format("%12d",vo.getId()).replace(" ", "0"));
|
||||
// return this.saveOrUpdate(img);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean add(MultipartFile file, Integer id) throws IOException {
|
||||
byte[] bytes = file.getBytes();
|
||||
ImgVehicleImage img = new ImgVehicleImage();
|
||||
img.setImage(bytes);
|
||||
// img.setImage(Base64.altBase64ToByteArray(vo.getImage()));
|
||||
img.setId(id);
|
||||
img.setGuid("hsfw-dataaircraft-" +String.format("%12d",id).replace(" ", "0"));
|
||||
|
||||
return this.saveOrUpdate(img);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(String Guid) {
|
||||
LambdaQueryWrapper<ImgVehicleImage> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ImgVehicleImage::getGuid,Guid);
|
||||
return this.remove(wrapper);
|
||||
}
|
||||
}
|
|
@ -56,6 +56,42 @@ public class Vehicle implements Serializable {
|
|||
@TableField(value = "upd_oper")
|
||||
private String updOper;
|
||||
|
||||
@ApiModelProperty("车辆用途")
|
||||
@TableField(value = "vehicle_use")
|
||||
private Integer vehicleUse;
|
||||
|
||||
@TableField("IconType")
|
||||
// // @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 10)
|
||||
// // @ColumnComment("二维标准军标名称")
|
||||
private String IconType;
|
||||
|
||||
@TableField
|
||||
// // @ColumnType(value = MySqlTypeConstant.LONGTEXT)
|
||||
// // @ColumnComment("三维模型存储路径,没有设置则将使用通用模型。")
|
||||
private String Model3D;
|
||||
@TableField
|
||||
// // @ColumnType(value = MySqlTypeConstant.LONGTEXT)
|
||||
// // @ColumnComment("对飞机的详细描述")
|
||||
private String Description;
|
||||
|
||||
@TableField
|
||||
// // @ColumnType(value = MySqlTypeConstant.INT, length = 11)
|
||||
// // @ColumnComment("用于数据库浏览时对装备分类使用,在模型中暂时没有使用。")
|
||||
private Integer ParentId;
|
||||
|
||||
@TableField
|
||||
// // @ColumnType(value = MySqlTypeConstant.VARCHAR, length = 36)
|
||||
// // @ColumnComment("Guid")
|
||||
private String Guid;
|
||||
|
||||
public String getGuid() {
|
||||
return Guid;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
Guid = guid;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -128,18 +164,64 @@ public class Vehicle implements Serializable {
|
|||
this.updOper = updOper;
|
||||
}
|
||||
|
||||
public Integer getVehicleUse() {
|
||||
return vehicleUse;
|
||||
}
|
||||
|
||||
public void setVehicleUse(Integer vehicleUse) {
|
||||
this.vehicleUse = vehicleUse;
|
||||
}
|
||||
|
||||
public String getIconType() {
|
||||
return IconType;
|
||||
}
|
||||
|
||||
public void setIconType(String iconType) {
|
||||
IconType = iconType;
|
||||
}
|
||||
|
||||
public String getModel3D() {
|
||||
return Model3D;
|
||||
}
|
||||
|
||||
public void setModel3D(String model3D) {
|
||||
Model3D = model3D;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return Description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return ParentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
ParentId = parentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vehicle{" +
|
||||
"id = " + id +
|
||||
", vehicleName = " + vehicleName +
|
||||
", vehicleSpreed = " + vehicleSpreed +
|
||||
", vehicleType = " + vehicleType +
|
||||
", fuelAbility = " + fuelAbility +
|
||||
", medicalAbility = " + medicalAbility +
|
||||
", ammunitionAbility = " + ammunitionAbility +
|
||||
", createOper = " + createOper +
|
||||
", updOper = " + updOper +
|
||||
"}";
|
||||
"id=" + id +
|
||||
", vehicleName='" + vehicleName + '\'' +
|
||||
", vehicleSpreed='" + vehicleSpreed + '\'' +
|
||||
", vehicleType='" + vehicleType + '\'' +
|
||||
", fuelAbility=" + fuelAbility +
|
||||
", medicalAbility=" + medicalAbility +
|
||||
", ammunitionAbility=" + ammunitionAbility +
|
||||
", createOper='" + createOper + '\'' +
|
||||
", updOper='" + updOper + '\'' +
|
||||
", vehicleUse=" + vehicleUse +
|
||||
", IconType='" + IconType + '\'' +
|
||||
", Model3D='" + Model3D + '\'' +
|
||||
", Description='" + Description + '\'' +
|
||||
", ParentId=" + ParentId +
|
||||
", Guid='" + Guid + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.hivekion.scenario.service;
|
||||
|
||||
import com.hivekion.baseData.domain.TblAircraftVo.TblAircraftAddInputVo;
|
||||
import com.hivekion.baseData.domain.TblAircraftVo.TblAircraftModelVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleViewVo;
|
||||
import com.hivekion.scenario.entity.Vehicle;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
@ -13,4 +17,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IVehicleService extends IService<Vehicle> {
|
||||
|
||||
VehicleViewVo getInfo(Integer id, boolean doFlag);
|
||||
|
||||
Integer getNewId();
|
||||
|
||||
boolean remove(String Guid);
|
||||
|
||||
boolean add(VehicleAddInputVo vo);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
package com.hivekion.scenario.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.hivekion.baseData.domain.TblAircraft;
|
||||
import com.hivekion.baseData.domain.TblEntity;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleViewVo;
|
||||
import com.hivekion.baseData.service.ITblEntityService;
|
||||
import com.hivekion.common.exception.BusinessException;
|
||||
import com.hivekion.scenario.entity.Vehicle;
|
||||
import com.hivekion.scenario.mapper.VehicleMapper;
|
||||
import com.hivekion.scenario.service.IVehicleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 车辆信息表 服务实现类
|
||||
|
@ -17,4 +33,55 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements IVehicleService {
|
||||
|
||||
@Autowired
|
||||
private ITblEntityService entityService;
|
||||
|
||||
@Override
|
||||
public VehicleViewVo getInfo(Integer id, boolean doFlag) {
|
||||
LambdaQueryWrapper<Vehicle> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(id != null,Vehicle::getId,id);
|
||||
Vehicle vehicle = this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
VehicleViewVo vehicleViewVo = new VehicleViewVo();
|
||||
if(!Objects.isNull(vehicle)){
|
||||
BeanUtil.copyProperties(vehicle,vehicleViewVo);
|
||||
vehicleViewVo.setId(vehicleViewVo.getId());
|
||||
}
|
||||
return vehicleViewVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getNewId() {
|
||||
LambdaQueryWrapper<Vehicle> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByDesc(Vehicle::getId);
|
||||
List<Vehicle> list = baseMapper.selectList(wrapper);
|
||||
Integer newId = list.get(0).getId() + 1;
|
||||
return newId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(String Guid) {
|
||||
LambdaQueryWrapper<Vehicle> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Vehicle::getGuid, Guid);
|
||||
|
||||
return this.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(VehicleAddInputVo vo) {
|
||||
LambdaQueryWrapper<TblEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(TblEntity::getParentId,vo.getParentDirId());
|
||||
List<TblEntity> aircraft = entityService.list(wrapper);
|
||||
if (aircraft.size()!=0){
|
||||
throw new BusinessException(500,"所属分类不是最终分类,请选择最终分类");
|
||||
}
|
||||
|
||||
Vehicle vehicle = new Vehicle();
|
||||
BeanUtils.copyProperties(vo, vehicle);
|
||||
vehicle.setParentId(vo.getParentDirId());
|
||||
vehicle.setGuid("dataaircraft-" + String.format("%12d", vo.getId()).replace(" ", "0"));
|
||||
LambdaUpdateWrapper<Vehicle> tWrapper = new LambdaUpdateWrapper<Vehicle>()
|
||||
.eq(Vehicle::getGuid, vehicle.getGuid());
|
||||
System.out.println(vehicle.toString());
|
||||
return this.save(vehicle);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user