实现设备中心模块数据库设计以及设备分页查询功能
This commit is contained in:
parent
4b46233805
commit
023455be47
|
@ -41,7 +41,7 @@ public class Schedule {
|
|||
List<ImageEntity> list = imageService.lambdaQuery().eq(ImageEntity::getPreTreatment, "0")
|
||||
.isNotNull(ImageEntity::getPartId)
|
||||
.isNotNull(ImageEntity::getProjectId).list();
|
||||
List<String> partIds = list.stream().map(ImageEntity::getPartId).toList();
|
||||
List<String> partIds = list.stream().map(ImageEntity::getPartId).collect(Collectors.toList());
|
||||
Map<String, PartResp> partRespMap = partService.listInfos(partIds).stream().collect(Collectors.toMap(PartResp::getPartId, Function.identity()));
|
||||
// 预处理
|
||||
List<ImageEntity> successList = new ArrayList<>();
|
||||
|
|
|
@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -27,6 +29,9 @@ public class EquipmentEntity extends AuditableEntity implements Serializable {
|
|||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String equipmentId;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
|
@ -45,6 +50,81 @@ public class EquipmentEntity extends AuditableEntity implements Serializable {
|
|||
@ApiModelProperty("设备序列号")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("采购时间")
|
||||
private LocalDateTime purchaseTime;
|
||||
|
||||
@ApiModelProperty("入库时间")
|
||||
private LocalDateTime inStockTime;
|
||||
|
||||
@ApiModelProperty("启用时间")
|
||||
private LocalDateTime activationTime;
|
||||
|
||||
@ApiModelProperty("预计报废时间")
|
||||
private LocalDateTime expectedScrapTime;
|
||||
|
||||
@ApiModelProperty("实际报废时间")
|
||||
private LocalDateTime actualScrapTime;
|
||||
|
||||
@ApiModelProperty("状态变更时间")
|
||||
private LocalDateTime statusChangeTime;
|
||||
|
||||
@ApiModelProperty("采购订单")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@ApiModelProperty("采购价格")
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty("当前净值")
|
||||
private BigDecimal currentNetValue;
|
||||
|
||||
@ApiModelProperty("折旧方法")
|
||||
private String depreciationMethod;
|
||||
|
||||
@ApiModelProperty("折旧年限")
|
||||
private Integer depreciationYears;
|
||||
|
||||
@ApiModelProperty("残值")
|
||||
private BigDecimal salvageValue;
|
||||
|
||||
@ApiModelProperty("保修截止日期")
|
||||
private LocalDateTime warrantyExpireDate;
|
||||
|
||||
@ApiModelProperty("上次维护日期")
|
||||
private LocalDateTime lastMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("下次维护日期")
|
||||
private LocalDateTime nextMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("当前使用记录id")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String useRecordId;
|
||||
|
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -26,4 +27,118 @@ public class EquipmentListReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("设备状态,0-空闲中,1-使用,3-保养中,4-维修中,5-已报废")
|
||||
private String equipmentStatus;
|
||||
|
||||
@ApiModelProperty("设备序列号")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("项目ID")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("设备型号")
|
||||
private String equipmentModel;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("采购时间开始")
|
||||
private LocalDateTime purchaseTimeStart;
|
||||
|
||||
@ApiModelProperty("采购时间结束")
|
||||
private LocalDateTime purchaseTimeEnd;
|
||||
|
||||
@ApiModelProperty("入库时间开始")
|
||||
private LocalDateTime inStockTimeStart;
|
||||
|
||||
@ApiModelProperty("入库时间结束")
|
||||
private LocalDateTime inStockTimeEnd;
|
||||
|
||||
@ApiModelProperty("启用时间开始")
|
||||
private LocalDateTime activationTimeStart;
|
||||
|
||||
@ApiModelProperty("启用时间结束")
|
||||
private LocalDateTime activationTimeEnd;
|
||||
|
||||
@ApiModelProperty("预计报废时间开始")
|
||||
private LocalDateTime expectedScrapTimeStart;
|
||||
|
||||
@ApiModelProperty("预计报废时间结束")
|
||||
private LocalDateTime expectedScrapTimeEnd;
|
||||
|
||||
@ApiModelProperty("保修截止日期开始")
|
||||
private LocalDateTime warrantyExpireDateStart;
|
||||
|
||||
@ApiModelProperty("保修截止日期结束")
|
||||
private LocalDateTime warrantyExpireDateEnd;
|
||||
|
||||
@ApiModelProperty("上次维护日期开始")
|
||||
private LocalDateTime lastMaintenanceDateStart;
|
||||
|
||||
@ApiModelProperty("上次维护日期结束")
|
||||
private LocalDateTime lastMaintenanceDateEnd;
|
||||
|
||||
@ApiModelProperty("下次维护日期开始")
|
||||
private LocalDateTime nextMaintenanceDateStart;
|
||||
|
||||
@ApiModelProperty("下次维护日期结束")
|
||||
private LocalDateTime nextMaintenanceDateEnd;
|
||||
|
||||
@ApiModelProperty("创建时间开始")
|
||||
private LocalDateTime createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间结束")
|
||||
private LocalDateTime createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间开始")
|
||||
private LocalDateTime updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间结束")
|
||||
private LocalDateTime updateTimeEnd;
|
||||
|
||||
@ApiModelProperty("当前页码")
|
||||
private Integer page = 1;
|
||||
|
||||
@ApiModelProperty("每页大小")
|
||||
private Integer pageSize = 10;
|
||||
|
||||
@ApiModelProperty("排序字段")
|
||||
private String orderBy;
|
||||
|
||||
@ApiModelProperty("排序方向")
|
||||
private String orderDirection = "desc";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -21,6 +23,9 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("设备ID")
|
||||
private String equipmentId;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
|
@ -36,6 +41,12 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("设备SN")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("设备状态, 枚举:EquipmentStatusEnum")
|
||||
private String equipmentStatus;
|
||||
|
||||
|
@ -45,6 +56,81 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("设备使用状态,0-空闲中,1-使用中")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("位置状态描述")
|
||||
private String locationStatusLabel;
|
||||
|
||||
@ApiModelProperty("设备当前物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("健康状态描述")
|
||||
private String healthStatusLabel;
|
||||
|
||||
@ApiModelProperty("采购时间")
|
||||
private LocalDateTime purchaseTime;
|
||||
|
||||
@ApiModelProperty("入库时间")
|
||||
private LocalDateTime inStockTime;
|
||||
|
||||
@ApiModelProperty("启用时间")
|
||||
private LocalDateTime activationTime;
|
||||
|
||||
@ApiModelProperty("预计报废时间")
|
||||
private LocalDateTime expectedScrapTime;
|
||||
|
||||
@ApiModelProperty("实际报废时间")
|
||||
private LocalDateTime actualScrapTime;
|
||||
|
||||
@ApiModelProperty("状态变更时间")
|
||||
private LocalDateTime statusChangeTime;
|
||||
|
||||
@ApiModelProperty("采购订单")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@ApiModelProperty("采购价格")
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty("当前净值")
|
||||
private BigDecimal currentNetValue;
|
||||
|
||||
@ApiModelProperty("折旧方法")
|
||||
private String depreciationMethod;
|
||||
|
||||
@ApiModelProperty("折旧年限")
|
||||
private Integer depreciationYears;
|
||||
|
||||
@ApiModelProperty("残值")
|
||||
private BigDecimal salvageValue;
|
||||
|
||||
@ApiModelProperty("保修截止日期")
|
||||
private LocalDateTime warrantyExpireDate;
|
||||
|
||||
@ApiModelProperty("上次维护日期")
|
||||
private LocalDateTime lastMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("下次维护日期")
|
||||
private LocalDateTime nextMaintenanceDate;
|
||||
|
||||
@ApiModelProperty("维护人员")
|
||||
private String maintenancePerson;
|
||||
|
||||
@ApiModelProperty("库存条码")
|
||||
private String inventoryBarcode;
|
||||
|
||||
@ApiModelProperty("资产备注")
|
||||
private String assetRemark;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
|
@ -56,4 +142,10 @@ public class EquipmentResp implements Serializable {
|
|||
|
||||
@ApiModelProperty("使用人")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/31/周四 15:30
|
||||
* @description 设备健康状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum HealthStatusEnum {
|
||||
EXCELLENT("excellent", "优秀"),
|
||||
GOOD("good", "良好"),
|
||||
NORMAL("normal", "一般"),
|
||||
POOR("poor", "较差"),
|
||||
BAD("bad", "差");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
HealthStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static HealthStatusEnum getByCode(String code) {
|
||||
for (HealthStatusEnum e : HealthStatusEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
HealthStatusEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(HealthStatusEnum.values().length);
|
||||
for (HealthStatusEnum e : HealthStatusEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/31/周四 15:30
|
||||
* @description 设备位置状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum LocationStatusEnum {
|
||||
IN_STOCK("in_stock", "库存中"),
|
||||
ALLOCATED("allocated", "已分配"),
|
||||
REPAIR("repair", "维修中"),
|
||||
SCRAP("scrap", "待报废"),
|
||||
SCRAPPED("scrapped", "已报废"),
|
||||
BORROWED("borrowed", "外借中"),
|
||||
LOST("lost", "丢失");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
LocationStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static LocationStatusEnum getByCode(String code) {
|
||||
for (LocationStatusEnum e : LocationStatusEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
LocationStatusEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(LocationStatusEnum.values().length);
|
||||
for (LocationStatusEnum e : LocationStatusEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -2,20 +2,14 @@ package com.dite.znpt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:38
|
||||
* @description
|
||||
*/
|
||||
@Mapper
|
||||
public interface EquipmentMapper extends BaseMapper<EquipmentEntity> {
|
||||
|
||||
List<EquipmentResp> selectEquipmentResp(@Param("req") EquipmentListReq req);
|
||||
|
||||
EquipmentResp getEquipmentRespByEquipmentId(@Param("equipmentId") String equipmentId);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentResp;
|
||||
import com.dite.znpt.domain.vo.EquipmentUseRecordReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -15,8 +13,7 @@ import java.util.List;
|
|||
* @description
|
||||
*/
|
||||
public interface EquipmentService extends IService<EquipmentEntity> {
|
||||
List<EquipmentResp> page(EquipmentListReq req);
|
||||
List<EquipmentResp> list(EquipmentListReq req);
|
||||
IPage<EquipmentResp> page(EquipmentListReq req);
|
||||
EquipmentResp detail(String equipmentId);
|
||||
void save(EquipmentReq req);
|
||||
void update(String equipmentId, EquipmentReq req);
|
||||
|
|
|
@ -1,94 +1,359 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.domain.entity.EquipmentUseRecordEntity;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentResp;
|
||||
import com.dite.znpt.domain.vo.EquipmentUseRecordReq;
|
||||
import com.dite.znpt.enums.EquipmentStatusEnum;
|
||||
import com.dite.znpt.enums.EquipmentTypeEnum;
|
||||
import com.dite.znpt.enums.HealthStatusEnum;
|
||||
import com.dite.znpt.enums.LocationStatusEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.EquipmentMapper;
|
||||
import com.dite.znpt.service.EquipmentService;
|
||||
import com.dite.znpt.service.EquipmentUseRecordService;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:39
|
||||
* @description
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, EquipmentEntity> implements EquipmentService {
|
||||
|
||||
@Resource
|
||||
private EquipmentUseRecordService equipmentUseRecordService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@Override
|
||||
public List<EquipmentResp> page(EquipmentListReq req) {
|
||||
PageUtil.startPage();
|
||||
return this.list(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentResp> list(EquipmentListReq req) {
|
||||
List<EquipmentResp> list = this.baseMapper.selectEquipmentResp(req);
|
||||
list.forEach(resp -> {
|
||||
resp.setEquipmentTypeLabel(EquipmentTypeEnum.getDescByCode(resp.getEquipmentType()));
|
||||
resp.setEquipmentStatusLabel(EquipmentStatusEnum.getDescByCode(resp.getEquipmentStatus()));
|
||||
});
|
||||
return list;
|
||||
public IPage<EquipmentResp> page(EquipmentListReq req) {
|
||||
log.info("开始执行设备分页查询,请求参数: {}", req);
|
||||
|
||||
// 创建分页对象
|
||||
Page<EquipmentEntity> page = new Page<>(req.getPage(), req.getPageSize());
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EquipmentEntity::getDelFlag, "0");
|
||||
|
||||
// 添加搜索条件并记录日志
|
||||
int conditionCount = 0;
|
||||
|
||||
if (StringUtils.hasText(req.getEquipmentName())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentName, req.getEquipmentName());
|
||||
log.info("添加设备名称查询条件: {}", req.getEquipmentName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentType())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentType, req.getEquipmentType());
|
||||
log.info("添加设备类型查询条件: {}", req.getEquipmentType());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentStatus, req.getEquipmentStatus());
|
||||
log.info("添加设备状态查询条件: {}", req.getEquipmentStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentSn())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentSn, req.getEquipmentSn());
|
||||
log.info("添加设备序列号查询条件: {}", req.getEquipmentSn());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetCode())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetCode, req.getAssetCode());
|
||||
log.info("添加资产编号查询条件: {}", req.getAssetCode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getBrand())) {
|
||||
queryWrapper.like(EquipmentEntity::getBrand, req.getBrand());
|
||||
log.info("添加品牌查询条件: {}", req.getBrand());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getLocationStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getLocationStatus, req.getLocationStatus());
|
||||
log.info("添加位置状态查询条件: {}", req.getLocationStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getHealthStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getHealthStatus, req.getHealthStatus());
|
||||
log.info("添加健康状态查询条件: {}", req.getHealthStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getResponsiblePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson());
|
||||
log.info("添加负责人查询条件: {}", req.getResponsiblePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getUseStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getUseStatus, req.getUseStatus());
|
||||
log.info("添加使用状态查询条件: {}", req.getUseStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 新增查询条件
|
||||
if (StringUtils.hasText(req.getEquipmentModel())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentModel, req.getEquipmentModel());
|
||||
log.info("添加设备型号查询条件: {}", req.getEquipmentModel());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSpecification())) {
|
||||
queryWrapper.like(EquipmentEntity::getSpecification, req.getSpecification());
|
||||
log.info("添加配置规格查询条件: {}", req.getSpecification());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getPhysicalLocation())) {
|
||||
queryWrapper.like(EquipmentEntity::getPhysicalLocation, req.getPhysicalLocation());
|
||||
log.info("添加物理位置查询条件: {}", req.getPhysicalLocation());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSupplierName())) {
|
||||
queryWrapper.like(EquipmentEntity::getSupplierName, req.getSupplierName());
|
||||
log.info("添加供应商名称查询条件: {}", req.getSupplierName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getMaintenancePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getMaintenancePerson, req.getMaintenancePerson());
|
||||
log.info("添加维护人员查询条件: {}", req.getMaintenancePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBarcode())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBarcode, req.getInventoryBarcode());
|
||||
log.info("添加库存条码查询条件: {}", req.getInventoryBarcode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetRemark())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetRemark, req.getAssetRemark());
|
||||
log.info("添加资产备注查询条件: {}", req.getAssetRemark());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 时间范围查询
|
||||
if (req.getPurchaseTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getPurchaseTime, req.getPurchaseTimeStart());
|
||||
log.info("添加采购时间开始查询条件: {}", req.getPurchaseTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getPurchaseTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getPurchaseTime, req.getPurchaseTimeEnd());
|
||||
log.info("添加采购时间结束查询条件: {}", req.getPurchaseTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getInStockTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getInStockTime, req.getInStockTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getInStockTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getInStockTime, req.getInStockTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getActivationTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getActivationTime, req.getActivationTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getActivationTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getActivationTime, req.getActivationTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getExpectedScrapTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getExpectedScrapTime, req.getExpectedScrapTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getExpectedScrapTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getExpectedScrapTime, req.getExpectedScrapTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getWarrantyExpireDateStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getWarrantyExpireDate, req.getWarrantyExpireDateStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getWarrantyExpireDateEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getWarrantyExpireDate, req.getWarrantyExpireDateEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getLastMaintenanceDateStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getLastMaintenanceDate, req.getLastMaintenanceDateStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getLastMaintenanceDateEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getLastMaintenanceDate, req.getLastMaintenanceDateEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getNextMaintenanceDateStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getNextMaintenanceDate, req.getNextMaintenanceDateStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getNextMaintenanceDateEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getNextMaintenanceDate, req.getNextMaintenanceDateEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getCreateTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getCreateTime, req.getCreateTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getCreateTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getCreateTime, req.getCreateTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getUpdateTimeStart() != null) {
|
||||
queryWrapper.ge(EquipmentEntity::getUpdateTime, req.getUpdateTimeStart());
|
||||
conditionCount++;
|
||||
}
|
||||
if (req.getUpdateTimeEnd() != null) {
|
||||
queryWrapper.le(EquipmentEntity::getUpdateTime, req.getUpdateTimeEnd());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
log.info("总共添加了 {} 个查询条件", conditionCount);
|
||||
|
||||
// 排序处理
|
||||
if (StringUtils.hasText(req.getOrderBy())) {
|
||||
String orderBy = req.getOrderBy();
|
||||
String orderDirection = "desc".equalsIgnoreCase(req.getOrderDirection()) ? "desc" : "asc";
|
||||
|
||||
switch (orderBy.toLowerCase()) {
|
||||
case "equipment_name":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentName);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentName);
|
||||
}
|
||||
break;
|
||||
case "equipment_sn":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentSn);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentSn);
|
||||
}
|
||||
break;
|
||||
case "asset_code":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getAssetCode);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getAssetCode);
|
||||
}
|
||||
break;
|
||||
case "equipment_type":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentType);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentType);
|
||||
}
|
||||
break;
|
||||
case "equipment_status":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentStatus);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentStatus);
|
||||
}
|
||||
break;
|
||||
case "brand":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getBrand);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getBrand);
|
||||
}
|
||||
break;
|
||||
case "responsible_person":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getResponsiblePerson);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getResponsiblePerson);
|
||||
}
|
||||
break;
|
||||
case "purchase_time":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getPurchaseTime);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getPurchaseTime);
|
||||
}
|
||||
break;
|
||||
case "purchase_price":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getPurchasePrice);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getPurchasePrice);
|
||||
}
|
||||
break;
|
||||
case "update_time":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getUpdateTime);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getUpdateTime);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// 默认按创建时间倒序
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
break;
|
||||
}
|
||||
log.info("添加排序条件: {} {}", orderBy, orderDirection);
|
||||
} else {
|
||||
// 默认按创建时间倒序
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
log.info("使用默认排序: 按创建时间倒序");
|
||||
}
|
||||
|
||||
log.info("执行分页查询,SQL条件: {}", queryWrapper.getTargetSql());
|
||||
|
||||
// 执行分页查询
|
||||
IPage<EquipmentEntity> equipmentPage = this.page(page, queryWrapper);
|
||||
|
||||
log.info("查询完成,总记录数: {}, 当前页记录数: {}", equipmentPage.getTotal(), equipmentPage.getRecords().size());
|
||||
|
||||
// 转换为响应对象
|
||||
List<EquipmentResp> equipmentRespList = equipmentPage.getRecords().stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 创建响应分页对象
|
||||
Page<EquipmentResp> respPage = new Page<>(equipmentPage.getCurrent(), equipmentPage.getSize(), equipmentPage.getTotal());
|
||||
respPage.setRecords(equipmentRespList);
|
||||
|
||||
return respPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipmentResp detail(String equipmentId) {
|
||||
EquipmentResp resp = this.baseMapper.getEquipmentRespByEquipmentId(equipmentId);
|
||||
resp.setEquipmentTypeLabel(EquipmentTypeEnum.getDescByCode(resp.getEquipmentType()));
|
||||
resp.setEquipmentStatusLabel(EquipmentStatusEnum.getDescByCode(resp.getEquipmentStatus()));
|
||||
return resp;
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if (equipment == null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_ID_NOT_EXIST);
|
||||
}
|
||||
return convertToResp(equipment);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(EquipmentReq req) {
|
||||
EquipmentEntity entity = Converts.INSTANCE.toEquipmentUseRecordEntity(req);
|
||||
if(null != getByEquipmentSn(entity.getEquipmentSn())){
|
||||
if (getByEquipmentSn(entity.getEquipmentSn()) != null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_SN_EXIST);
|
||||
}
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
private EquipmentEntity getByEquipmentSn(String equipmentSn){
|
||||
return this.getOne(Wrappers.lambdaQuery(EquipmentEntity.class).eq(EquipmentEntity::getEquipmentSn, equipmentSn));
|
||||
private EquipmentEntity getByEquipmentSn(String equipmentSn) {
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentSn, equipmentSn);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(String equipmentId, EquipmentReq req) {
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if(null == equipment){
|
||||
if (equipment == null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_ID_NOT_EXIST);
|
||||
}
|
||||
if(!equipment.getEquipmentSn().equals(req.getEquipmentSn()) && null != getByEquipmentSn(req.getEquipmentSn())){
|
||||
if (!equipment.getEquipmentSn().equals(req.getEquipmentSn()) && getByEquipmentSn(req.getEquipmentSn()) != null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_SN_EXIST);
|
||||
}
|
||||
EquipmentEntity entity = Converts.INSTANCE.toEquipmentUseRecordEntity(req);
|
||||
|
@ -100,9 +365,57 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
@Override
|
||||
public void deleteById(String equipmentId) {
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if(null == equipment){
|
||||
if (equipment == null) {
|
||||
throw new ServiceException(Message.EQUIPMENT_ID_NOT_EXIST);
|
||||
}
|
||||
this.removeById(equipmentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为响应对象
|
||||
*/
|
||||
private EquipmentResp convertToResp(EquipmentEntity entity) {
|
||||
EquipmentResp resp = new EquipmentResp();
|
||||
resp.setEquipmentId(entity.getEquipmentId());
|
||||
resp.setAssetCode(entity.getAssetCode());
|
||||
resp.setEquipmentName(entity.getEquipmentName());
|
||||
resp.setEquipmentType(entity.getEquipmentType());
|
||||
resp.setEquipmentTypeLabel(EquipmentTypeEnum.getDescByCode(entity.getEquipmentType()));
|
||||
resp.setEquipmentModel(entity.getEquipmentModel());
|
||||
resp.setEquipmentSn(entity.getEquipmentSn());
|
||||
resp.setBrand(entity.getBrand());
|
||||
resp.setSpecification(entity.getSpecification());
|
||||
resp.setEquipmentStatus(entity.getEquipmentStatus());
|
||||
resp.setEquipmentStatusLabel(EquipmentStatusEnum.getDescByCode(entity.getEquipmentStatus()));
|
||||
resp.setUseStatus(entity.getUseStatus());
|
||||
resp.setLocationStatus(entity.getLocationStatus());
|
||||
resp.setLocationStatusLabel(LocationStatusEnum.getDescByCode(entity.getLocationStatus()));
|
||||
resp.setPhysicalLocation(entity.getPhysicalLocation());
|
||||
resp.setResponsiblePerson(entity.getResponsiblePerson());
|
||||
resp.setHealthStatus(entity.getHealthStatus());
|
||||
resp.setHealthStatusLabel(HealthStatusEnum.getDescByCode(entity.getHealthStatus()));
|
||||
resp.setPurchaseTime(entity.getPurchaseTime());
|
||||
resp.setInStockTime(entity.getInStockTime());
|
||||
resp.setActivationTime(entity.getActivationTime());
|
||||
resp.setExpectedScrapTime(entity.getExpectedScrapTime());
|
||||
resp.setActualScrapTime(entity.getActualScrapTime());
|
||||
resp.setStatusChangeTime(entity.getStatusChangeTime());
|
||||
resp.setPurchaseOrder(entity.getPurchaseOrder());
|
||||
resp.setSupplierName(entity.getSupplierName());
|
||||
resp.setPurchasePrice(entity.getPurchasePrice());
|
||||
resp.setCurrentNetValue(entity.getCurrentNetValue());
|
||||
resp.setDepreciationMethod(entity.getDepreciationMethod());
|
||||
resp.setDepreciationYears(entity.getDepreciationYears());
|
||||
resp.setSalvageValue(entity.getSalvageValue());
|
||||
resp.setWarrantyExpireDate(entity.getWarrantyExpireDate());
|
||||
resp.setLastMaintenanceDate(entity.getLastMaintenanceDate());
|
||||
resp.setNextMaintenanceDate(entity.getNextMaintenanceDate());
|
||||
resp.setMaintenancePerson(entity.getMaintenancePerson());
|
||||
resp.setInventoryBarcode(entity.getInventoryBarcode());
|
||||
resp.setAssetRemark(entity.getAssetRemark());
|
||||
resp.setCreateTime(entity.getCreateTime());
|
||||
resp.setUpdateTime(entity.getUpdateTime());
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@ public class PageUtil extends PageHelper {
|
|||
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
||||
}
|
||||
|
||||
public static void startPage(Integer pageNum, Integer pageSize) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
}
|
||||
|
||||
public static void clearPage() {
|
||||
PageHelper.clearPage();
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.EquipmentMapper">
|
||||
<select id="selectEquipmentResp" resultType="com.dite.znpt.domain.vo.EquipmentResp">
|
||||
SELECT eq.equipment_id, eq.equipment_name, eq.equipment_type, eq.equipment_model, eq.equipment_sn, eq.equipment_status, eq.use_status,
|
||||
equr.user_id, u.`name`, equr.project_id, p.project_name
|
||||
FROM equipment eq
|
||||
LEFT JOIN equipment_use_record equr ON eq.use_record_id = equr.use_record_id
|
||||
LEFT JOIN project p ON p.project_id = equr.project_id
|
||||
LEFT JOIN user u ON u.user_id = equr.user_id
|
||||
WHERE eq.del_flag = '0'
|
||||
<if test="req.equipmentName != null and req.equipmentName != ''">
|
||||
AND eq.equipment_name LIKE CONCAT('%', #{req.equipmentName}, '%')
|
||||
</if>
|
||||
<if test="req.equipmentType != null and req.equipmentType != ''">
|
||||
AND eq.equipment_type = #{req.equipmentType}
|
||||
</if>
|
||||
<if test="req.equipmentStatus != null and req.equipmentStatus != ''">
|
||||
AND eq.req.equipment_status = #{req.equipmentStatus}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getEquipmentRespByEquipmentId" resultType="com.dite.znpt.domain.vo.EquipmentResp">
|
||||
SELECT eq.equipment_id, eq.equipment_name, eq.equipment_type, eq.equipment_model, eq.equipment_sn, eq.equipment_status, eq.use_status,
|
||||
equr.user_id, u.`name`, equr.project_id, p.project_name
|
||||
FROM equipment eq
|
||||
LEFT JOIN equipment_use_record equr ON eq.use_record_id = equr.use_record_id
|
||||
LEFT JOIN project p ON p.project_id = equr.project_id
|
||||
LEFT JOIN user u ON u.user_id = equr.user_id
|
||||
WHERE eq.equipment_id = #{equipmentId} AND eq.del_flag = '0'
|
||||
</select>
|
||||
</mapper>
|
107
pom.xml
107
pom.xml
|
@ -1,54 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.dite.znpt</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>core</module>
|
||||
<module>sip</module>
|
||||
<module>web</module>
|
||||
<module>flowable</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.18</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.24</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.dite.znpt</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>core</module>
|
||||
<module>web</module>
|
||||
<module>flowable</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.18</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.24</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.dite.znpt</groupId>
|
||||
<artifactId>sip</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dite.znpt</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
|
@ -55,6 +50,7 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.ImageWorkReq;
|
||||
import com.dite.znpt.enums.*;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.service.ImageService;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -15,9 +15,9 @@ import javax.annotation.Resource;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/4/29 23:06
|
||||
* @Description:
|
||||
* @author Bear.G
|
||||
* @date 2025/7/24/周四 14:35
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = "公共信息")
|
||||
@RestController
|
||||
|
@ -175,5 +175,22 @@ public class CommonController {
|
|||
return Result.ok(EquipmentTypeEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备状态", httpMethod = "GET")
|
||||
@GetMapping("/list/equipment-status")
|
||||
public Result<?> listEquipmentStatus(){
|
||||
return Result.ok(EquipmentStatusEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备位置状态", httpMethod = "GET")
|
||||
@GetMapping("/list/location-status")
|
||||
public Result<?> listLocationStatus(){
|
||||
return Result.ok(LocationStatusEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备健康状态", httpMethod = "GET")
|
||||
@GetMapping("/list/health-status")
|
||||
public Result<?> listHealthStatus(){
|
||||
return Result.ok(HealthStatusEnum.listAll());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
|
@ -12,14 +13,13 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/7/23/周三 17:41
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = "设备信息")
|
||||
@Api(tags = "设备信息----------------------------")
|
||||
@RestController
|
||||
@RequestMapping("/equipment")
|
||||
public class EquipmentController {
|
||||
|
@ -30,13 +30,8 @@ public class EquipmentController {
|
|||
@ApiOperation(value = "分页查询设备信息列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<EquipmentResp> page(EquipmentListReq req) {
|
||||
return PageResult.ok(equipmentService.page(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result<List<EquipmentResp>> list(EquipmentListReq req) {
|
||||
return Result.ok(equipmentService.list(req));
|
||||
IPage<EquipmentResp> page = equipmentService.page(req);
|
||||
return PageResult.ok(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询设备信息详情", httpMethod = "GET")
|
||||
|
|
Loading…
Reference in New Issue