问题修改

This commit is contained in:
jiang 2025-10-13 19:16:40 +08:00
parent 1de0d396b1
commit f527ce1bda
13 changed files with 1088 additions and 396 deletions

View File

@ -3,10 +3,7 @@ package com.bonus.material.devchange.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.contract.domain.BmContract;
import com.bonus.material.devchange.domain.DeviceCountBean;
import com.bonus.material.devchange.domain.DeviceTreeBean;
import com.bonus.material.devchange.domain.MaDevInfo;
import com.bonus.material.devchange.domain.MapBean;
import com.bonus.material.devchange.domain.*;
import com.bonus.material.devchange.service.MaDevInfoService;
import com.bonus.material.devchange.service.MaDevInfoServiceImpl;
import com.bonus.material.device.domain.vo.DevMergeVo;
@ -51,6 +48,7 @@ public class MaDevInfoController extends BaseController {
}
}
@ApiOperation(value = "设备台账-上下架")
@PostMapping("/updateDeviceStatus")
public AjaxResult updateDeviceStatus(@RequestBody DevMergeVo o) {
@ -84,6 +82,12 @@ public class MaDevInfoController extends BaseController {
}
}
@ApiOperation(value = "设备台账-获取单个设备详情")
@GetMapping("/getDevice/{maId}")
public AjaxResult getDevice(@PathVariable Integer maId) {
return AjaxResult.success(service.getDevice(maId));
}
@ApiOperation(value = "设备台账-删除")
@PostMapping("/delDevice/{ids}")
public AjaxResult delDevice(@PathVariable("ids") String[] ids) {

View File

@ -0,0 +1,197 @@
package com.bonus.material.devchange.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 装备实体类
* 存储装备的详细信息包括基本属性状态使用情况文档资料等
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Equipment {
/**
* 设备id
*/
private Integer maId;
/**
* 所属省份
* 说明装备当前所在的省份
*/
private String province;
/**
* 专业
* 说明装备所属的专业领域如机械电子建筑等
*/
private String major;
/**
* 主工序
* 说明装备主要参与的工序环节
*/
private String mainProcess;
/**
* 子工序
* 说明装备参与的具体子工序
*/
private String subProcess;
/**
* 装备大类目
* 说明装备所属的一级分类如工程机械仪器仪表等
*/
private String mainCategory;
/**
* 装备小类目
* 说明装备所属的二级分类主类目下的细分分类
*/
private String subCategory;
/**
* 装备分支
* 说明小类目下的更细分类代表具体的装备类型分支
*/
private String branch;
/**
* 装备名称
* 说明装备的具体名称用于标识和展示
*/
private String name;
/**
* 规格型号
* 说明装备的规格和型号信息反映装备的技术参数
*/
private String specificationModel;
/**
* 装备编码
* 说明系统内部为装备分配的唯一编码用于管理和识别
*/
private String code;
/**
* 装备状态
* 说明装备当前的状态如在用闲置维修中报废等
*/
private String status;
/**
* 使用年限
* 说明装备已使用的年限
*/
private String serviceLife;
/**
* 使用项目
* 说明装备当前正在使用的项目名称
*/
private String usingProject;
/**
* 使用到期时间
* 说明装备预计的使用到期时间或租赁到期时间
*/
private Date expirationTime;
/**
* 使用次数
* 说明装备累计的使用次数统计
*/
private Integer usageCount;
/**
* 维修次数
* 说明装备累计的维修次数统计
*/
private Integer repairCount;
/**
* 装备原始编码
* 说明装备出厂时厂家赋予的原始编码用于溯源
*/
private String originalCode;
/**
* 计量单位
* 说明装备的计量单位如台个等
*/
private String unit;
/**
* 生产厂家
* 说明装备的生产制造厂商名称
*/
private String manufacturer;
/**
* 出厂日期
* 说明装备从厂家生产出厂的日期
*/
private Date productionDate;
/**
* 采购日期
* 说明装备被采购入库的日期
*/
private Date purchaseDate;
/**
* 资产原值
* 说明装备的原始采购价值以元为单位
*/
private BigDecimal originalValue;
/**
* 最大使用年限
* 说明装备设计的最大可使用年限
*/
private Integer maxServiceLifeYears;
/**
* 下次维保日期
* 说明装备下一次需要进行维护保养的日期
*/
private Date nextMaintenanceDate;
/**
* 产权单位
* 说明装备的所有权所属单位
*/
private String propertyUnit;
/**
* 装备外观
* 说明装备外观图片的URL列表存储装备的外观照片
*/
private List<MaDevFile> appearanceImages;
/**
* 合格证
* 说明装备合格证的URL列表存储合格证扫描件或照片
*/
private List<MaDevFile> certificates;
/**
* 定期检验报告
* 说明装备定期检验报告的URL列表
*/
private List<MaDevFile> inspectionReports;
/**
* 采购发票
* 说明装备采购发票的URL列表存储发票扫描件或照片
*/
private List<MaDevFile> purchaseInvoices;
}

View File

@ -0,0 +1,74 @@
package com.bonus.material.devchange.domain;
import lombok.Data;
import java.util.Date;
/**
* 设备文件实体类
* 对应数据库表ma_dev_file
* 功能描述存储设备相关的图片及附件信息如装备主图详情图合格证等文件的元数据
*/
@Data
public class MaDevFile {
/**
* 主键ID
* 数据库字段id
* 特性自增唯一无业务含义仅用于数据唯一标识
*/
private Integer id;
/**
* 设备ID
* 数据库字段ma_id
* 关联关系外键关联设备表的主键标识当前文件属于哪个设备
* 可为null允许存在未关联设备的文件特殊业务场景
*/
private Integer maId;
/**
* 文件类型编码
* 数据库字段file_type
* 取值范围1-装备主图2-装备详情图3-合格证4-发票5-检验报告
* 建议使用DevFileType枚举进行类型管理避免硬编码
*/
private Integer fileType;
/**
* 文件名称
* 数据库字段file_name
* 长度限制最大120字符
* 用途存储文件的原始名称用于前端展示
*/
private String fileName;
/**
* 文件存储路径
* 数据库字段file_url
* 长度限制最大255字符
* 格式通常为相对路径或完整URL用于访问实际文件资源
*/
private String fileUrl;
/**
* 创建人ID
* 数据库字段creator
* 关联关系关联用户表的主键记录文件的上传者
*/
private Integer creator;
/**
* 创建时间
* 数据库字段create_time
* 特性通常为文件上传成功时的系统时间不可手动修改
*/
private Date createTime;
/**
* 数据状态标识
* 数据库字段is_active
* 取值说明1-启用正常显示0-删除逻辑删除不显示
* 默认值1新创建的文件默认为启用状态
*/
private Integer isActive = 1;
}

View File

@ -5,12 +5,14 @@ import java.util.Date;
import java.util.List;
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 设备信息表
* 装备实体类
* 存储装备的详细信息包括基本属性状态使用情况文档资料等
*/
@Data
@AllArgsConstructor
@ -20,300 +22,292 @@ public class MaDevInfo {
* 设备id
*/
private Integer maId;
/**
* 装备名称
*/
private String deviceName;
/**
* 装备整机重量
*/
private Double deviceWeight;
/**
* 设备数量
*/
private Double deviceCount;
/**
* 装备编号
*/
private String code;
/**
* 唯一标识符(如车架号等)
*/
private String identifyCode;
/**
* 类型id
*/
private Integer typeId;
/**
* 订单id
*/
private Integer orderId;
/**
* 所属省份
* 说明装备当前所在的省份
*/
private String province;
/**
* 专业Id
* 说明装备所属的专业领域如机械电子建筑等
*/
private Integer majorId;
/**
* 专业
* 说明装备所属的专业领域如机械电子建筑等
*/
private String major;
/**
* 管理模式
*/
private String manageType;
/**
* 数量
*/
private Integer count;
/**
* 主工序id
*/
private Integer mainProcessId;
/**
* 主工序
* 说明装备主要参与的工序环节
*/
private String mainProcess;
/**
* 子工序id
* 说明装备参与的具体子工序
*/
private String subProcessId;
/**
* 子工序
* 说明装备参与的具体子工序
*/
private String subProcess;
/**
* 设备状态(0:草稿 1:下架 2:上架 3:在租 4:自有)考虑数据字典
* 装备大类目id
* 说明装备所属的一级分类如工程机械仪器仪表等
*/
private String maStatus;
private String mainCategoryId;
/**
* 装备大类目
* 说明装备所属的一级分类如工程机械仪器仪表等
*/
private String mainCategory;
/**
* 装备小类目id
* 说明装备所属的二级分类主类目下的细分分类
*/
private Integer subCategoryId;
/**
* 装备小类目
* 说明装备所属的二级分类主类目下的细分分类
*/
private String subCategory;
/**
* 装备分支id
* 说明小类目下的更细分类代表具体的装备类型分支
*/
private String branchId;
/**
* 装备分支
* 说明小类目下的更细分类代表具体的装备类型分支
*/
private String branch;
/**
* 租赁范围
* 装备名称
* 说明装备的具体名称用于标识和展示
*/
private Integer leaseScope;
private String name;
/**
* 设备所在地
* 规格型号
* 说明装备的规格和型号信息反映装备的技术参数
*/
private String location;
private String specificationModel;
/**
* 装备品牌
* 装备编码
* 说明系统内部为装备分配的唯一编码用于管理和识别
*/
private String brand;
private String code;
/**
* 装备型号分类四级名称新增可不添加
* 装备状态
* 说明装备当前的状态如在用闲置维修中报废等
*/
private String modelName;
private String status;
/**
* 出厂日期
* 使用年限
* 说明装备已使用的年限
*/
private String productionDate;
private String serviceLife;
/**
* 设备使用年限
* 使用项目Id
* 说明装备当前正在使用的项目名称
*/
private String workingHours;
private String usingProjectId;
/**
* 使用项目
* 说明装备当前正在使用的项目名称
*/
private String usingProject;
/**
* 整机序列号
*/
private String serialNumber;
/**
* 设备月租价
*/
private BigDecimal monthLeasePrice;
/**
* 设备天租价
*/
private BigDecimal dayLeasePrice;
/**
* 设备主照片
*/
private String picUrl;
/**
* 机手月租金
*/
private BigDecimal jsMonthPrice;
/**
* 机手天租金
*/
private BigDecimal jsDayPrice;
/**
* 详细描述
*/
private String description;
/**
* gps编号
*/
private String gpsCode;
/**
* 设备所属公司
*/
private Integer ownCo;
/**
* 联系人
*/
private String person;
/**
* 联系电话
*/
private String personPhone;
/**
* 创建时间
*/
private String createTime;
/**
* 创建人
*/
private Integer creator;
/**
* 订金
*/
private BigDecimal deposit;
/**
* 是否删除0 1否
*/
private String isActive;
/**
* 修改时间
*/
private Date updateTime;
/**
* 修改人
*/
private Integer updateBy;
/**
* 是否配置机手
*/
private String isOperator;
/**
* 设备规格
*/
private String specification;
/**
* 设备所在省id
*/
private Integer provinceId;
/**
* 设备所在市id
*/
private Integer cityId;
/**
* 设备所在区id
*/
private Integer areaId;
/**
* 设备视频URL
*/
private String videoUrl;
/**
* 上传人id
*/
private Integer ownId;
/**
* 校验日期
*/
private Date checkDate;
/**
* 检验周期
*/
private Integer checkCycle;
/**
* 是否上传质检证书0 1
*/
private Integer isQc;
/**
* 是否上传安全证书0 1
*/
private Integer isSafeBook;
/**
* 是否上架专区 0: 1:
*/
private Boolean isZone;
/**
* 专区id
*/
private Integer zoneId;
private Integer totalUpDay;
private Integer totalLeaseDay;
private String originaValue;
/**
* 默认 1 变更状态 变更类型 1入库 23 出库(2是自用3共享) 3 4 退役 4 维修
*/
private String changeStatus;
/**
* 标准使用到期时间(和出粗和那个日期做对比)
* 使用到期时间
* 说明装备预计的使用到期时间或租赁到期时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expirationTime;
/**
* 设备录入状态 0待审核 1审核通过 2审核驳回
* 使用次数
* 说明装备累计的使用次数统计
*/
private String entryStatus;
private Integer usageCount;
/**
* 是否上下架 1上架 0下架
* 维修次数
* 说明装备累计的维修次数统计
*/
private String upDownStatus;
private Integer repairCount;
/**
* 特征值json
* 装备原始编码
* 说明装备出厂时厂家赋予的原始编码用于溯源
*/
private String jsonData;
private String originalCode;
/**
* 设备原值
* 计量单位
* 说明装备的计量单位如台个等
*/
private BigDecimal buyPrice;
private String unit;
/**
* 生产厂家id
* 说明装备的生产制造厂商名称
*/
private String manufacturerId;
/**
* 生产厂家
* 说明装备的生产制造厂商名称
*/
private String manufacturer;
/**
* 装备类型名称--录入数据用
* 出厂日期
* 说明装备从厂家生产出厂的日期
*/
private String itemTypeModel;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date productionDate;
// 新增开始出厂时间查询条件用于筛选 >= 该日期的记录
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startProductionDate;
// 新增结束出厂时间查询条件用于筛选 <= 该日期的记录
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endProductionDate;
/**
* 所在项目
* 采购日期
* 说明装备被采购入库的日期
*/
private String onProject;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date purchaseDate;
/**
* 开始采购日期
* 说明装备被采购入库的日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startPurchaseDate;
/**
* 结束采购日期
* 说明装备被采购入库的日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endPurchaseDate;
private String companyName;
/**
* 资产原值
* 说明装备的原始采购价值以元为单位
*/
private BigDecimal originalValue;
private String proType;
private String mainGx;
private String childGx;
private String devCategory;
private String devSubcategory;
private String devName;
private String devModel;
private String nextCheckTime;
/**
* 最小资产原值
* 说明装备的原始采购价值以元为单位
*/
private BigDecimal minOriginalValue;
/**
* 最大资产原值
* 说明装备的原始采购价值以元为单位
*/
private BigDecimal maxOriginalValue;
/**
* 最大使用年限
* 说明装备设计的最大可使用年限
*/
private Integer maxServiceLifeYears;
/**
* 下次维保日期
* 说明装备下一次需要进行维护保养的日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date nextMaintenanceDate;
/**
* 产权单位id
* 说明装备的所有权所属单位
*/
private Integer propertyUnitId;
/**
* 产权单位
* 说明装备的所有权所属单位
*/
private String propertyUnit;
/**
* 装备外观
* 说明装备外观图片的URL列表存储装备的外观照片
*/
private List<MaDevFile> appearanceImages;
/**
* 合格证
* 说明装备合格证的URL列表存储合格证扫描件或照片
*/
private List<MaDevFile> certificates;
/**
* 定期检验报告
* 说明装备定期检验报告的URL列表
*/
private List<MaDevFile> inspectionReports;
/**
* 采购发票
* 说明装备采购发票的URL列表存储发票扫描件或照片
*/
private List<MaDevFile> purchaseInvoices;
/**
* 特征项列表
*/
private List<DevInfoPropertyVo> propertyVoList;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建人
*/
private String orderCreateUser;
/**
* 订单时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date orderCreateTime;
/**
* 订单时间
*/
private String daysDiff;
private String deviceStatus;
private String remainingDays;
private String remainingYears;
private String yearsDiff;
private String unitName;
private String expirationYears;
private String actualStartYear;
private String actualStopYear;
private String remainingStartYear;
private String remainingStopYear;
private String isWarn;
private String proName;
private String orderStatus;
}

View File

@ -1,10 +1,8 @@
package com.bonus.material.devchange.mapper;
import com.bonus.material.devchange.domain.DeviceCountBean;
import com.bonus.material.devchange.domain.DeviceTreeBean;
import com.bonus.material.devchange.domain.MaDevInfo;
import com.bonus.material.devchange.domain.MapBean;
import com.bonus.material.devchange.domain.*;
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -20,6 +18,9 @@ public interface MaDevInfoMapper {
*/
List<MaDevInfo> list(MaDevInfo o);
List<MaDevFile> getFileList(@Param("maId") Integer maId, @Param("fileType") Integer fileType);
Integer updateDeviceStatus(List<MapBean> list);
Integer delDevice(String[] list);
@ -40,5 +41,6 @@ public interface MaDevInfoMapper {
void insertDevInfoProperties(@Param("list") List<DevInfoPropertyVo> item, @Param("maId") Integer maId);
MaDevInfo getDevice(Integer maId);
}

View File

@ -8,7 +8,7 @@ import com.bonus.material.device.domain.vo.DevMergeVo;
import java.util.List;
public interface MaDevInfoService{
public interface MaDevInfoService {
List<MaDevInfo> list(MaDevInfo o);
@ -25,4 +25,6 @@ public interface MaDevInfoService{
List<MapBean> companySel(String id);
Integer updateDeviceApi(MaDevInfo o);
MaDevInfo getDevice(Integer maId);
}

View File

@ -25,13 +25,17 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
@Override
public List<MaDevInfo> list(MaDevInfo o) {
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
o.setOwnCo(Math.toIntExact(thisLoginUserDeptId));
o.setPropertyUnitId(Math.toIntExact(thisLoginUserDeptId));
List<MaDevInfo> list = mapper.list(o);
list.forEach(item -> {
List<DevInfoPropertyVo> propertiiesList = mapper.getProperties(item);
if (propertiiesList != null && !propertiiesList.isEmpty()) {
item.setPropertyVoList(propertiiesList);
}
item.setAppearanceImages(mapper.getFileList(item.getMaId(), 1));
item.setCertificates(mapper.getFileList(item.getMaId(), 2));
item.setInspectionReports(mapper.getFileList(item.getMaId(), 3));
item.setPurchaseInvoices(mapper.getFileList(item.getMaId(), 4));
});
return list;
}
@ -87,6 +91,24 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
return mapper.updateDeviceApi(o);
}
/**
* @param maId
* @return
*/
@Override
public MaDevInfo getDevice(Integer maId) {
MaDevInfo item = mapper.getDevice(maId);
List<DevInfoPropertyVo> propertiiesList = mapper.getProperties(item);
if (propertiiesList != null && !propertiiesList.isEmpty()) {
item.setPropertyVoList(propertiiesList);
}
item.setAppearanceImages(mapper.getFileList(item.getMaId(), 1));
item.setCertificates(mapper.getFileList(item.getMaId(), 2));
item.setInspectionReports(mapper.getFileList(item.getMaId(), 3));
item.setPurchaseInvoices(mapper.getFileList(item.getMaId(), 4));
return item;
}
/**
* 将扁平列表构建成树并添加一个总的根节点
*/

View File

@ -7,6 +7,7 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.material.devchange.domain.MaDevInfo;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo;
@ -48,7 +49,6 @@ public class DevMergeController extends BaseController {
/**
* 查询设备信息列表(首页装备共享大厅查询列表专用)
*/
// @RequiresPermissions("equip:info:list")
@ApiOperation(value = "装备新增台账-列表")
@GetMapping("/orderList")
public AjaxResult orderList(DevMergeVo devInfo) {
@ -58,19 +58,6 @@ public class DevMergeController extends BaseController {
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**
* 获取台账中设备信息详细信息
*/
@ApiOperation(value = "装备台账-单个台账设备列表")
@GetMapping("/devList")
public AjaxResult devList(DevInfoVo devInfo) {
List<DevInfoVo> list = service.devList(devInfo);
Integer pageIndex = Convert.toInt(devInfo.getPageNum(), 1);
Integer pageSize = Convert.toInt(devInfo.getPageSize(), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**
* 获取台账中设备信息详细信息
*/
@ -86,24 +73,64 @@ public class DevMergeController extends BaseController {
}
/**
* 获取台账中设备信息详细信息
* 提交设备台账
*/
@ApiOperation(value = "装备台账-新增单个设备草稿")
@PostMapping("/addDevice")
public AjaxResult addDevice(@RequestBody @Valid DevInfo devInfo) {
@ApiOperation(value = "装备台账-提交设备台账")
@PostMapping("/submitOrder")
public AjaxResult submitOrder(@RequestBody DevMergeVo o) {
try {
devInfo.setEntryStatus("3");
AjaxResult ajaxResult = devInfoService.insertDevInfo(devInfo);
if (ajaxResult.isSuccess()) {
service.insertOrderDevReal(devInfo.getOrderId(), devInfo.getMaId());
}
return ajaxResult;
return service.submitOrder(o);
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
}
}
/**
* 提交设备台账
*/
@ApiOperation(value = "装备台账-删除")
@PostMapping("/delOrder")
public AjaxResult delOrder(@RequestBody DevMergeVo o) {
try {
return service.delOrder(o);
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
}
}
/**
* cha
*
* @param o
* @return
*/
@ApiOperation(value = "设备台账")
@GetMapping("/getDevice")
public AjaxResult getDevice(MaDevInfo o) {
try {
startPage();
List<MaDevInfo> list = service.getDevice(o);
return AjaxResult.success(getDataTable(list));
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
}
}
/**
* 获取台账中设备信息详细信息
*/
@ApiOperation(value = "装备台账-新增单个设备草稿")
@PostMapping("/interDevice")
public AjaxResult interDevice(@RequestBody MaDevInfo maDevInfo) {
return service.interDevice(maDevInfo);
}
/**
* 获取台账中设备信息详细信息
*/
@ -118,6 +145,20 @@ public class DevMergeController extends BaseController {
}
}
/**
* 获取台账中设备信息详细信息
*/
@ApiOperation(value = "装备台账-单个台账设备列表")
@GetMapping("/devList")
public AjaxResult devList(DevInfoVo devInfo) {
List<DevInfoVo> list = service.devList(devInfo);
Integer pageIndex = Convert.toInt(devInfo.getPageNum(), 1);
Integer pageSize = Convert.toInt(devInfo.getPageSize(), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ApiOperation(value = "装备台账-删除增单个设备草稿")
@PostMapping("/delDevice")
public AjaxResult delDevice(@RequestBody Long[] maIds) {
@ -129,34 +170,6 @@ public class DevMergeController extends BaseController {
}
}
/**
* 提交设备台账
*/
@ApiOperation(value = "装备台账-提交设备台账")
@PostMapping("/submitOrder")
public AjaxResult submitOrder(@RequestBody DevMergeVo o) {
try {
return service.submitOrder(o);
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
}
}
/**
* 提交设备台账
*/
@ApiOperation(value = "装备台账-删除")
@PostMapping("/delOrder")
public AjaxResult delOrder(@RequestBody DevMergeVo o) {
try {
return service.delOrder(o);
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
}
}
/**
* 提交设备台账
@ -172,6 +185,35 @@ public class DevMergeController extends BaseController {
}
}
/**
* 获取台账中设备信息详细信息
*/
@ApiOperation(value = "装备台账-新增单个设备草稿")
@PostMapping("/addDevice")
public AjaxResult addDevice(@RequestBody @Valid DevInfo devInfo) {
try {
devInfo.setEntryStatus("3");
AjaxResult ajaxResult = devInfoService.insertDevInfo(devInfo);
if (ajaxResult.isSuccess()) {
service.insertOrderDevReal(devInfo.getOrderId(), devInfo.getMaId());
}
return ajaxResult;
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
}
}
/**
* 查询所有一级类型顶级类型
*

View File

@ -4,6 +4,7 @@ package com.bonus.material.device.mapper;
import com.bonus.common.biz.domain.*;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.devchange.domain.MaDevInfo;
import com.bonus.material.devchange.domain.MapBean;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.MaDevQc;
@ -66,5 +67,12 @@ public interface DevMergeMapper {
@MapKey("value")
List<Map<String, Object>> getSecondToFifthLevelTypes(Long firstLevelId);
Integer interDevice(MaDevInfo maDevInfo);
List<MaDevInfo> getDevice(MaDevInfo o);
List<MaDevInfo> getDeviceByOrderId(MaDevInfo o);
}

View File

@ -3,6 +3,7 @@ package com.bonus.material.device.service;
import com.bonus.common.biz.domain.BmCompanyInfo;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.devchange.domain.MaDevInfo;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.dto.DevInfoImpDto;
import com.bonus.material.device.domain.dto.InfoMotionDto;
@ -60,4 +61,8 @@ public interface DevMergeService {
* @return 六级类型列表
*/
AjaxResult getFourthToSixthLevelTypes(Long thirdLevelId);
AjaxResult interDevice(MaDevInfo maDevInfo);
List<MaDevInfo> getDevice(MaDevInfo o);
}

View File

@ -16,7 +16,9 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.devchange.domain.MaDevInfo;
import com.bonus.material.devchange.domain.MapBean;
import com.bonus.material.devchange.mapper.MaDevInfoMapper;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.MaDevQc;
import com.bonus.material.device.domain.Table;
@ -38,6 +40,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -74,6 +77,8 @@ public class DevMergeServiceImpl implements DevMergeService {
@Resource
private DevMergeMapper devMergeMapper;
@Autowired
private MaDevInfoMapper mapper;
@Override
public List<DevMergeVo> list(DevMergeVo devInfo) {
@ -211,6 +216,43 @@ public class DevMergeServiceImpl implements DevMergeService {
}
}
/**
* @param maDevInfo
* @return
*/
@Override
public AjaxResult interDevice(MaDevInfo maDevInfo) {
try {
Integer i = devMergeMapper.interDevice(maDevInfo);
return i > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* @param o
* @return
*/
@Override
public List<MaDevInfo> getDevice(MaDevInfo o) {
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
o.setPropertyUnitId(Math.toIntExact(thisLoginUserDeptId));
List<MaDevInfo> list = devMergeMapper.getDevice(o);
list.forEach(item -> {
List<DevInfoPropertyVo> propertiiesList = mapper.getProperties(item);
if (propertiiesList != null && !propertiiesList.isEmpty()) {
item.setPropertyVoList(propertiiesList);
}
item.setAppearanceImages(mapper.getFileList(item.getMaId(), 1));
item.setCertificates(mapper.getFileList(item.getMaId(), 2));
item.setInspectionReports(mapper.getFileList(item.getMaId(), 3));
item.setPurchaseInvoices(mapper.getFileList(item.getMaId(), 4));
});
return list;
}
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd");
private static final String SEPARATOR = "-";

View File

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.bonus.material.devchange.domain.MaDevInfo">
<id column="ma_id" property="maId"/>
<result column="device_name" property="deviceName"/>
<result column="device_weight" property="deviceWeight"/>
<result column="device_count" property="deviceCount"/>
<result column="code" property="code"/>
<result column="identify_code" property="identifyCode"/>
@ -12,16 +13,18 @@
<result column="lease_scope" property="leaseScope"/>
<result column="location" property="location"/>
<result column="brand" property="brand"/>
<result column="item_type_model" property="modelName"/>
<result column="production_date" property="productionDate"/>
<result column="working_hours" property="workingHours"/>
<result column="serial_number" property="serialNumber"/>
<result column="month_lease_price" property="monthLeasePrice"/>
<result column="day_lease_price" property="dayLeasePrice"/>
<result column="pic_url" property="picUrl"/>
<result column="js_month_price" property="jsMonthPrice"/>
<result column="js_day_price" property="jsDayPrice"/>
<result column="description" property="description"/>
<result column="gps_code" property="gpsCode"/>
<result column="on_company" property="ownCo"/>
<result column="own_co" property="ownCo"/>
<result column="person" property="person"/>
<result column="person_phone" property="personPhone"/>
<result column="create_time" property="createTime"/>
@ -68,10 +71,10 @@
</resultMap>
<sql id="Base_Column_List">
ma_id, device_name, device_count, code, identify_code, type_id, ma_status,
lease_scope, `location`, brand, production_date, working_hours, serial_number,
month_lease_price, day_lease_price, js_month_price, js_day_price, description,
gps_code, on_company, person, person_phone, create_time, creator, deposit, is_active,
ma_id, device_name, device_weight, device_count, code, identify_code, type_id, ma_status,
lease_scope, `location`, brand, model_name, production_date, working_hours, serial_number,
month_lease_price, day_lease_price, pic_url, js_month_price, js_day_price, description,
gps_code, own_co, person, person_phone, create_time, creator, deposit, is_active,
update_time, update_by, is_operator, specification, province_id, city_id, area_id,
video_url, own_id, check_date, check_cycle, is_qc, is_safe_book, is_zone, zone_id,
total_up_day, total_lease_day, origina_value, change_status, expiration_time, entry_status,
@ -82,6 +85,7 @@
from ma_dev_info_properties
where ma_id = #{maId}
</delete>
<insert id="insertDevInfoProperties">
insert into
ma_dev_info_properties(ma_id, property_name, property_value, create_time)
@ -95,88 +99,6 @@
)
</foreach>
</insert>
<select id="list" resultMap="BaseResultMap">
SELECT DISTINCT
mtv.proType,
mtv.mainGx,
mtv.childGx,
mtv.devCategory,
mtv.devSubcategory,
mtv.devName,
mtv.devModel,
mtv.unit_name,
mdi.ma_id,
mdi.device_name,
mdi.ma_status,
mdi.`code`,
mdi.expiration_time,
c.company_name,
mdi.buy_price,
mdi.production_date,
mdi.working_hours,
mdi.on_project,
jsp.pro_name,
mdi.person,
mdi.person_phone,
mdi.change_status,
mdi.up_down_status,
mdq.next_check_time,
mdi.brand
FROM
ma_dev_info mdi
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON jsp.pro_code = mdi.on_project
WHERE mdi.is_active = 1 and mdi.entry_status = 1
<if test="typeId != null">
and (
mtv.mainGxId = #{typeId}
or mtv.childGxId = #{typeId}
or mtv.devCategoryId = #{typeId}
or mtv.devSubcategoryId = #{typeId}
or mtv.devNameId = #{typeId}
or mtv.devModelId = #{typeId}
or mtv.maxTypeId = #{typeId}
)
</if>
<if test="companyName != null and companyName !=''">
and c.company_name like concat('%',#{companyName},'%')
</if>
<if test="onProject != null and onProject !=''">
and mdi.on_project like concat('%',#{onProject},'%')
</if>
<if test="deviceName != null and deviceName !=''">
and mdi.device_name like concat('%',#{deviceName},'%')
</if>
<if test="code != null and code !=''">
and mdi.`code` like concat('%',#{code},'%')
</if>
<if test="changeStatus != null and changeStatus !=''">
and mdi.change_status like concat('%',#{changeStatus},'%')
</if>
<if test="brand != null and brand !=''">
and mdi.brand like concat('%',#{brand},'%')
</if>
<if test="productionDate != null and productionDate !=''">
and mdi.production_date like concat('%',#{brand},'%')
</if>
<if test="workingHours != null and workingHours !=''">
and mdi.working_hours like concat('%',#{workingHours},'%')
</if>
<if test="buyPrice != null and buyPrice !=''">
and mdi.buy_price like concat('%',#{buyPrice},'%')
</if>
<if test="nextCheckTime != null and nextCheckTime !=''">
and mdq.next_check_time like concat('%',#{nextCheckTime},'%')
</if>
</select>
<update id="updateDeviceStatus">
<foreach collection="list" item="data" index="index" separator=";">
@ -191,6 +113,10 @@
<if test="deviceName != null and deviceName != ''">
device_name = #{deviceName},
</if>
<if test="deviceWeight != null">
device_weight = #{deviceWeight},
</if>
<if test="deviceCount != null">
device_count = #{deviceCount},
</if>
@ -217,6 +143,9 @@
<if test="brand != null and brand != ''">
brand = #{brand},
</if>
<if test="modelName != null and modelName != ''">
model_name = #{modelName},
</if>
<if test="productionDate != null">
production_date = #{productionDate},
</if>
@ -265,6 +194,9 @@
</if>
<!-- 其他信息字段 -->
<if test="picUrl != null and picUrl != ''">
pic_url = #{picUrl},
</if>
<if test="videoUrl != null and videoUrl != ''">
video_url = #{videoUrl},
</if>
@ -363,4 +295,146 @@
</if>
</where>
</select>
<select id="list" resultType="com.bonus.material.devchange.domain.MaDevInfo">
select mdi.ma_id AS maId,
mdi.type_id AS typeId,
mdi.manage_type AS manageType,
mdi.device_count AS count,
mtv.maxTypeId AS majorId,
mtv.proType AS major,
mtv.mainGxId AS mainProcessId,
mtv.mainGx AS mainProcess,
mtv.childGxId AS subProcessId,
mtv.childGx AS subProcess,
mtv.devCategoryId AS mainCategoryId,
mtv.devCategory AS mainCategory,
mtv.devSubcategory AS subCategory,
mtv.devSubcategoryId AS subCategoryId,
mtv.devNameId AS branchId,
mtv.devName AS branch,
mdi.device_name AS name,
mdi.item_type_model As specificationModel,
mdi.code AS code,
mdi.change_status AS status,
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
jsp.pro_code AS usingProjectId,
jsp.pro_name AS usingProject,
mdi.identify_code AS originalCode,
mdi.brand AS manufacturerId,
ms.supplier_name AS manufacturer,
mdi.purchase_date AS purchaseDate,
mdi.production_date AS productionDate,
sd.dept_id AS propertyUnitId,
sd.dept_name AS propertyUnit,
mdi.buy_price AS originalValue,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears
from ma_dev_info mdi
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.brand
<where>
mdi.is_active = '1'
<if test="name != null and name != ''">
and mdi.device_name like concat('%', #{name}, '%')
</if>
<if test="specificationModel != null and specificationModel != ''">
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
</if>
<if test="majorId != null and majorId != ''">
and mtv.maxTypeId = #{majorId}
</if>
<if test="subProcessId != null and subProcessId != ''">
and mtv.childGxId = #{subProcessId}
</if>
<if test="code != null and code != ''">
and mdi.code like concat('%', #{code}, '%')
</if>
<if test="originalCode != null and originalCode != ''">
and mdi.identify_code like concat('%', #{originalCode}, '%')
</if>
<if test="propertyUnitId != null and propertyUnitId != ''">
and sd.dept_id = #{propertyUnitId}
</if>
<if test="manufacturerId != null and manufacturerId != ''">
and mdi.brand = #{manufacturerId}
</if>
<if test="minOriginalValue != null and minOriginalValue != '' and maxOriginalValue != null and maxOriginalValue != ''">
and mdi.buy_price &gt;= #{minOriginalValue} and mdi.buy_price &lt;= #{maxOriginalValue}
</if>
<if test="startProductionDate != null and startProductionDate != '' and endProductionDate != null and endProductionDate != ''">
and DATE_FORMAT(mdi.production_date,'%Y-%m-%d') between #{startProductionDate} and #{endProductionDate}
</if>
<if test="startPurchaseDate != null and startPurchaseDate != '' and endPurchaseDate != null and endPurchaseDate != ''">
and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate}
</if>
</where>
</select>
<select id="getFileList" resultType="com.bonus.material.devchange.domain.MaDevFile">
SELECT
id,
ma_id AS maId,
file_type AS fileType,
file_name AS fileName,
file_url AS fileUrl,
creator,
create_time AS createTime,
is_active AS isActive
FROM ma_dev_file
WHERE
-- 基础条件:逻辑未删除
is_active = 1
-- 可选条件按设备ID筛选如果需要根据maId查询取消注释并传入参数
<if test="maId != null">AND ma_id = #{maId}</if>
-- 可选条件:按文件类型筛选(如果需要,取消注释并传入参数)
<if test="fileType != null">AND file_type = #{fileType}</if>
ORDER BY
create_time DESC -- 按上传时间倒序,最新的文件在前
</select>
<select id="getDevice" resultType="com.bonus.material.devchange.domain.MaDevInfo">
select mdi.ma_id AS maId,
mdi.manage_type AS manageType,
mdi.device_count AS count,
mtv.maxTypeId AS majorId,
mtv.proType AS major,
mtv.mainGxId AS mainProcessId,
mtv.mainGx AS mainProcess,
mtv.childGxId AS subProcessId,
mtv.childGx AS subProcess,
mtv.devCategoryId AS mainCategoryId,
mtv.devCategory AS mainCategory,
mtv.devSubcategory AS subCategory,
mtv.devSubcategoryId AS subCategoryId,
mtv.devNameId AS branchId,
mtv.devName AS branch,
mdi.device_name AS name,
mdi.item_type_model As specificationModel,
mdi.code AS code,
mdi.change_status AS status,
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
jsp.pro_code AS usingProjectId,
jsp.pro_name AS usingProject,
mdi.identify_code AS originalCode,
mdi.brand AS manufacturer,
mdi.purchase_date AS purchaseDate,
mdi.production_date AS productionDate,
sd.dept_id AS propertyUnitId,
sd.dept_name AS propertyUnit,
mdi.buy_price AS originalValue,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears
from ma_dev_info mdi
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
<where>
mdi.is_active = '0' AND mdi.ma_id =#{maId}
</where>
</select>
</mapper>

View File

@ -80,6 +80,61 @@
INSERT INTO cs_device_real_dev (cs_id, dev_id)
VALUES (#{orderId}, #{maId})
</insert>
<insert id="interDevice">
INSERT INTO ma_dev_info (
<!-- 主键ma_id自增若手动传值可保留否则删除 -->
<if test="maId != null">ma_id,</if>
<!-- 必选字段若业务要求必须传值可去掉if判断 -->
device_name,
device_count,
item_type_model,
manage_type,
code,
<!-- 非必填字段:有值才插入 -->
<if test="originalCode != null and originalCode != ''">identify_code,</if>
<if test="typeId != null">type_id,</if>
<if test="status != null and status != ''">ma_status,</if>
<if test="manufacturerId != null and manufacturerId != ''">brand,</if>
<if test="productionDate != null">production_date,</if>
<if test="maxServiceLifeYears != null">max_working_hours,</if>
<if test="expirationTime != null">expiration_time,</if>
<if test="originalValue != null">buy_price,</if>
<if test="deviceType != null and deviceType != ''">device_type,</if>
<if test="purchaseDate != null">purchase_date,</if>
<if test="createTime != null and createTime != ''">create_time,</if>
<if test="creator != null">creator,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<!-- 默认值字段:无值时插入默认值'1'(未删除) -->
is_active
)
VALUES (
<if test="maId != null">#{maId},</if>
<!-- 必选字段对应值 -->
#{name},
#{count},
#{specificationModel},
#{manageType},
#{code},
<!-- 非必填字段对应值 -->
<if test="originalCode != null and originalCode != ''">#{originalCode},</if>
<if test="typeId != null">#{typeId},</if>
<if test="manufacturerId != null and manufacturerId != ''">#{manufacturerId},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="maxServiceLifeYears != null">#{maxServiceLifeYears},</if>
<if test="changeStatus != null and changeStatus != ''">#{changeStatus},</if>
<if test="expirationTime != null">#{expirationTime},</if>
<if test="originalValue != null">#{originalValue},</if>
<if test="deviceType != null and deviceType != ''">#{deviceType},</if>
<if test="purchaseDate != null">#{purchaseDate},</if>
<if test="createTime != null and createTime != ''">#{createTime},</if>
<if test="creator != null">#{creator},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<!-- 默认值:即使实体类无该属性,也插入'1' -->
#{isActive,jdbcType=VARCHAR,defaultValue='1'}
)
</insert>
<update id="submitOrder">
UPDATE cs_device_status
@ -138,7 +193,7 @@
OR t1.type_id = (SELECT parent_id FROM ma_type WHERE type_id = t2.parent_id)
WHERE t1.type_id = #{firstLevelId} -- 一级类型ID
AND t1.parent_id IS NULL -- 确保t1是一级类型
AND t2.del_flag = '0';
AND t2.del_flag = '0'
</select>
<select id="getFourthToSixthLevelTypes" resultType="java.util.Map">
@ -155,7 +210,7 @@
FROM ma_type
WHERE type_id = (SELECT parent_id FROM ma_type WHERE type_id = t.parent_id))
WHERE t3.type_id = #{thirdLevelId} -- 三级类型ID
AND t.del_flag = '0';
AND t.del_flag = '0'
</select>
<select id="getSecondToFifthLevelTypes" resultType="java.util.Map">
-- MySQL 5.x兼容版本查询二至五级类型
@ -201,7 +256,7 @@
) AS all_levels ON t.type_id = all_levels.type_id
WHERE t1.type_id = #{firstLevelId}
AND t1.parent_id IS NULL -- 确保是一级类型
AND t.del_flag = '0';
AND t.del_flag = '0'
</select>
<select id="selectTodayOrderCount" resultType="java.lang.Integer">
SELECT COUNT(*)
@ -209,4 +264,175 @@
WHERE DATE(create_time) = CURDATE()
AND order_number IS NOT NULL
</select>
<select id="getDevice" resultType="com.bonus.material.devchange.domain.MaDevInfo">
select mdi.ma_id AS maId,
mdi.type_id AS typeId,
cds.id AS orderId,
cds.order_number AS orderNumber,
cds.create_user AS orderCreateUser,
cds.create_time AS orderCreateTime,
cds.status AS orderStatus,
mdi.manage_type AS manageType,
mdi.device_count AS count,
mtv.maxTypeId AS majorId,
mtv.proType AS major,
mtv.mainGxId AS mainProcessId,
mtv.mainGx AS mainProcess,
mtv.childGxId AS subProcessId,
mtv.childGx AS subProcess,
mtv.devCategoryId AS mainCategoryId,
mtv.devCategory AS mainCategory,
mtv.devSubcategory AS subCategory,
mtv.devSubcategoryId AS subCategoryId,
mtv.devNameId AS branchId,
mtv.devName AS branch,
mdi.device_name AS name,
mdi.item_type_model As specificationModel,
mdi.code AS code,
mdi.change_status AS status,
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
jsp.pro_code AS usingProjectId,
jsp.pro_name AS usingProject,
mdi.identify_code AS originalCode,
mdi.brand AS manufacturerId,
ms.supplier_name AS manufacturer,
mdi.purchase_date AS purchaseDate,
mdi.production_date AS productionDate,
sd.dept_id AS propertyUnitId,
sd.dept_name AS propertyUnit,
mdi.buy_price AS originalValue,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears
from cs_device_status cds
LEFT JOIN cs_device_real_dev cdrd ON cdrd.cs_id = cds.id
LEFT JOIN ma_dev_info mdi ON cdrd.dev_id = mdi.ma_id
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.brand
<where>
mdi.is_active = '1'
<if test="name != null and name != ''">
and mdi.device_name like concat('%', #{name}, '%')
</if>
<if test="specificationModel != null and specificationModel != ''">
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
</if>
<if test="majorId != null and majorId != ''">
and mtv.maxTypeId = #{majorId}
</if>
<if test="subProcessId != null and subProcessId != ''">
and mtv.childGxId = #{subProcessId}
</if>
<if test="code != null and code != ''">
and mdi.code like concat('%', #{code}, '%')
</if>
<if test="originalCode != null and originalCode != ''">
and mdi.identify_code like concat('%', #{originalCode}, '%')
</if>
<if test="propertyUnitId != null and propertyUnitId != ''">
and sd.dept_id = #{propertyUnitId}
</if>
<if test="manufacturerId != null and manufacturerId != ''">
and mdi.brand = #{manufacturerId}
</if>
<if test="minOriginalValue != null and minOriginalValue != '' and maxOriginalValue != null and maxOriginalValue != ''">
and mdi.buy_price &gt;= #{minOriginalValue} and mdi.buy_price &lt;= #{maxOriginalValue}
</if>
<if test="startProductionDate != null and startProductionDate != '' and endProductionDate != null and endProductionDate != ''">
and DATE_FORMAT(mdi.production_date,'%Y-%m-%d') between #{startProductionDate} and #{endProductionDate}
</if>
<if test="startPurchaseDate != null and startPurchaseDate != '' and endPurchaseDate != null and endPurchaseDate != ''">
and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate}
</if>
</where>
</select>
<select id="getDeviceByOrderId" resultType="com.bonus.material.devchange.domain.MaDevInfo">
select mdi.ma_id AS maId,
mdi.type_id AS typeId,
cds.order_number AS orderNumber,
cds.create_user AS orderCreateUser,
cds.create_time AS orderCreateTime,
cds.status AS orderStatus,
mdi.manage_type AS manageType,
mdi.device_count AS count,
mtv.maxTypeId AS majorId,
mtv.proType AS major,
mtv.mainGxId AS mainProcessId,
mtv.mainGx AS mainProcess,
mtv.childGxId AS subProcessId,
mtv.childGx AS subProcess,
mtv.devCategoryId AS mainCategoryId,
mtv.devCategory AS mainCategory,
mtv.devSubcategory AS subCategory,
mtv.devSubcategoryId AS subCategoryId,
mtv.devNameId AS branchId,
mtv.devName AS branch,
mdi.device_name AS name,
mdi.item_type_model As specificationModel,
mdi.code AS code,
mdi.change_status AS status,
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
jsp.pro_code AS usingProjectId,
jsp.pro_name AS usingProject,
mdi.identify_code AS originalCode,
mdi.brand AS manufacturerId,
ms.supplier_name AS manufacturer,
mdi.purchase_date AS purchaseDate,
mdi.production_date AS productionDate,
sd.dept_id AS propertyUnitId,
sd.dept_name AS propertyUnit,
mdi.buy_price AS originalValue,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears
from cs_device_status cds
LEFT JOIN cs_device_real_dev cdrd ON cdrd.cs_id = cds.id
LEFT JOIN ma_dev_info mdi ON cdrd.dev_id = mdi.ma_id
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.brand
<where>
mdi.is_active = '0' and cds.id = #{orderId}
<if test="name != null and name != ''">
and mdi.device_name like concat('%', #{name}, '%')
</if>
<if test="specificationModel != null and specificationModel != ''">
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
</if>
<if test="majorId != null and majorId != ''">
and mtv.maxTypeId = #{majorId}
</if>
<if test="subProcessId != null and subProcessId != ''">
and mtv.childGxId = #{subProcessId}
</if>
<if test="code != null and code != ''">
and mdi.code like concat('%', #{code}, '%')
</if>
<if test="originalCode != null and originalCode != ''">
and mdi.identify_code like concat('%', #{originalCode}, '%')
</if>
<if test="propertyUnitId != null and propertyUnitId != ''">
and sd.dept_id = #{propertyUnitId}
</if>
<if test="manufacturerId != null and manufacturerId != ''">
and mdi.brand = #{manufacturerId}
</if>
<if test="minOriginalValue != null and minOriginalValue != '' and maxOriginalValue != null and maxOriginalValue != ''">
and mdi.buy_price &gt;= #{minOriginalValue} and mdi.buy_price &lt;= #{maxOriginalValue}
</if>
<if test="startProductionDate != null and startProductionDate != '' and endProductionDate != null and endProductionDate != ''">
and DATE_FORMAT(mdi.production_date,'%Y-%m-%d') between #{startProductionDate} and #{endProductionDate}
</if>
<if test="startPurchaseDate != null and startPurchaseDate != '' and endPurchaseDate != null and endPurchaseDate != ''">
and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate}
</if>
</where>
</select>
</mapper>