Commit 06089ffb authored by chang's avatar chang

车辆+设备详情查询

parent 0d60ea8e
package com.yeejoin.amos.boot.module.jg.api.vo;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
/**
* @author chang xiangyu 2024/11/12
*/
@Data
@AllArgsConstructor
public class CarAndEquVo {
private ShCar shCar;
private List<ShCarEquVo> shCarEquVoList;
}
package com.yeejoin.amos.boot.module.jg.api.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import lombok.Data;
import java.util.Date;
/**
* @author chang xiangyu 2024/11/12
*/
@Data
public class ShCarEquVo {
/**
* primary key
*/
private String sequenceNbr;
/**
* tzs_sh_car表主键
*/
private String carId;
/**
* 设备编号sequenceCode
*/
private String sequenceCode;
/**
* 设备代码
*/
private String equCode;
/**
* 制造日期
*/
private Date produceDate;
/**
* 安装日期
*/
private Date equInstalldate;
/**
* 检查日期
*/
private Date equCheckdate;
/**
* firstDate
*/
private Date equFirstdate;
/**
* 序号
*/
private String serialNumber;
/**
* sub_DM 代码
*/
private String equDm;
/**
* 单位编号 equDwbh
*/
private String UseInnerCode;
/**
* 公称工作压力(MPa) equQpgc
*/
private String nominalWorkingPressure;
/**
* 气瓶批号
*/
private String batchNumber;
/**
* PFZZDW PF制造单位
*/
private String equPfzzdw;
/**
* isChange
*/
private Integer ischange;
/**
* 报告编号
*/
private String reportcode;
/**
* BFReportCode
*/
private String bfreportcode;
/**
* 操作方式
*/
private String equCzfs;
/**
* 是否认领
*/
private String claimedFlag;
public ShCarEquVo(ShCarEqu shCarEqu) {
this.setSequenceNbr(shCarEqu.getSequenceNbr());
this.setCarId(shCarEqu.getCarId());
this.setEquCode(shCarEqu.getEquCode());
this.setUseInnerCode(shCarEqu.getEquDwbh());
this.setNominalWorkingPressure(shCarEqu.getEquQpgc());
}
}
......@@ -61,6 +61,7 @@ public class ShCarController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<ShCar> updateBySequenceNbrShCar(@RequestBody ShCar entity,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
// entity.setSequenceNbr(sequenceNbr);
entity.setSequenceNbr(String.valueOf(sequenceNbr));
return ResponseHelper.buildResponse(shCarServiceImpl.updateWithModel(entity));
}
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.yeejoin.amos.boot.module.jg.api.vo.CarAndEquVo;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -55,6 +56,7 @@ public class ShCarEquController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<ShCarEqu> updateBySequenceNbrShCarEqu(@RequestBody ShCarEqu entity,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
// entity.setSequenceNbr(sequenceNbr);
entity.setSequenceNbr(String.valueOf(sequenceNbr));
return ResponseHelper.buildResponse(shCarEquServiceImpl.updateWithModel(entity));
}
......@@ -113,4 +115,11 @@ public class ShCarEquController extends BaseController {
public ResponseModel<List<ShCarEqu>> selectForList() {
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryForShCarEquList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "汽车详细信息列表", notes = "汽车详细信息列表")
@GetMapping(value = "/selectByCarId")
public ResponseModel<CarAndEquVo> selectByCarId(@RequestParam String carId) {
return ResponseHelper.buildResponse(shCarEquServiceImpl.queryByCarId(carId));
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.yeejoin.amos.boot.module.jg.api.mapper.ShCarEquMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IShCarEquService;
import com.yeejoin.amos.boot.module.jg.api.vo.CarAndEquVo;
import com.yeejoin.amos.boot.module.jg.api.vo.ShCarEquVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.stream.Collectors;
/**
* 服务实现类
......@@ -16,6 +22,9 @@ import java.util.List;
*/
@Service
public class ShCarEquServiceImpl extends BaseService<ShCarEqu,ShCarEqu,ShCarEquMapper> implements IShCarEquService {
@Autowired
ShCarServiceImpl shCarServiceImpl;
/**
* 分页查询
*/
......@@ -29,4 +38,23 @@ public class ShCarEquServiceImpl extends BaseService<ShCarEqu,ShCarEqu,ShCarEquM
public List<ShCarEqu> queryForShCarEquList() {
return this.queryForList("" , false);
}
public CarAndEquVo queryByCarId(String carId){
//根据carId获取Car
LambdaQueryWrapper<ShCar> queryWrapper1= new LambdaQueryWrapper<>();
queryWrapper1.eq(ShCar::getSequenceNbr,carId);
ShCar shCar = shCarServiceImpl.getOne(queryWrapper1);
//根据carId获取设备列表
LambdaQueryWrapper<ShCarEqu> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShCarEqu::getCarId,carId);
List<ShCarEqu> list = this.list(queryWrapper);
//将设备列表转换为前端可识别bean
List<ShCarEquVo> collect = list.stream().map(shCarEqu -> new ShCarEquVo(shCarEqu)).collect(Collectors.toList());
//封装返回VO
CarAndEquVo carAndEquVo = new CarAndEquVo(shCar, collect);
return carAndEquVo;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment