diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseCarController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseCarController.java index 06765bc9..8b2c1e25 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseCarController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseCarController.java @@ -13,9 +13,9 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.BaseCar; import com.ruoyi.system.domain.CarCheckLifecycleDTO; +import com.ruoyi.system.domain.CarLatestMaintenanceDTO; import com.ruoyi.system.domain.CarLifecycleDTO; import com.ruoyi.system.domain.CarLifecycleQuery; -import com.ruoyi.system.domain.CarMaintenanceLifecycleDTO; import com.ruoyi.system.domain.CarMileageLifecycleDTO; import com.ruoyi.system.domain.CarTyreInstallLifecycleDTO; import com.ruoyi.system.service.IBaseCarLifecycleService; @@ -205,6 +205,18 @@ public class BaseCarController extends BaseController return AjaxResult.success(lifecycle); } + /** + * 查询车辆最近一次维保前后对比。 + */ + @RequiresPermissions("system:car:view") + @GetMapping("/lifecycle/{carNo}/latest-maintenance") + @ResponseBody + public AjaxResult latestMaintenance(@PathVariable("carNo") String carNo) + { + CarLatestMaintenanceDTO latestMaintenance = baseCarLifecycleService.selectLatestMaintenance(buildLifecycleQuery(carNo)); + return AjaxResult.success(latestMaintenance); + } + /** * 查询车辆装卸历史 */ @@ -218,19 +230,6 @@ public class BaseCarController extends BaseController return getDataTable(list); } - /** - * 查询车辆维保工单历史 - */ - @RequiresPermissions("system:car:view") - @PostMapping("/lifecycle/{carNo}/maintenance/list") - @ResponseBody - public TableDataInfo lifecycleMaintenanceList(@PathVariable("carNo") String carNo) - { - startPage(); - List list = baseCarLifecycleService.selectMaintenanceList(buildLifecycleQuery(carNo)); - return getDataTable(list); - } - /** * 查询车辆关联轮胎质检历史 */ diff --git a/ruoyi-admin/src/main/resources/templates/tyre/car/lifecycle.html b/ruoyi-admin/src/main/resources/templates/tyre/car/lifecycle.html index 5330e4b2..991706b7 100644 --- a/ruoyi-admin/src/main/resources/templates/tyre/car/lifecycle.html +++ b/ruoyi-admin/src/main/resources/templates/tyre/car/lifecycle.html @@ -43,9 +43,9 @@ } .summary-counts { - min-width: 360px; + min-width: 180px; display: grid; - grid-template-columns: repeat(2, minmax(130px, 1fr)); + grid-template-columns: minmax(130px, 1fr); gap: 10px; } @@ -136,6 +136,135 @@ word-break: break-all; } + .maintenance-summary { + margin-bottom: 12px; + color: #666; + font-size: 13px; + line-height: 1.8; + } + + .maintenance-compare { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; + } + + .maintenance-side { + border: 1px solid #edf1f2; + border-radius: 8px; + padding: 12px; + background: #fff; + } + + .maintenance-side-title { + margin-bottom: 10px; + color: #2f4050; + font-weight: 600; + } + + .axle-row { + position: relative; + display: flex; + justify-content: center; + gap: 6px; + margin-bottom: 12px; + min-width: 0; + } + + .axle-label { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding: 2px 7px; + border: 1px solid #e7eaec; + border-radius: 4px; + background: #fff; + color: #666; + font-size: 12px; + z-index: 2; + } + + .compare-tyre-card { + position: relative; + width: 66px; + min-height: 126px; + padding: 24px 6px 8px; + border-radius: 8px 8px 16px 16px; + background: #2f4050; + color: #fff; + overflow: hidden; + box-sizing: border-box; + } + + .compare-tyre-card.empty { + border: 1px dashed #c9cfd6; + background: #eef1f4; + color: #8a929a; + } + + .compare-tyre-card.installed { + border: 2px solid #f8ac59; + } + + .compare-tyre-card.removed { + border: 2px solid #1ab394; + } + + .compare-tyre-card:before { + content: ""; + position: absolute; + inset: 0; + opacity: 0.16; + background-image: repeating-linear-gradient(45deg, transparent, transparent 8px, #fff 8px, #fff 14px); + } + + .compare-tyre-card.empty:before { + display: none; + } + + .compare-pos { + position: absolute; + top: 0; + left: 0; + padding: 2px 6px; + border-radius: 0 0 8px 0; + background: #8a929a; + color: #fff; + font-size: 11px; + z-index: 2; + } + + .compare-tyre-card.installed .compare-pos { + background: #f8ac59; + } + + .compare-tyre-card.removed .compare-pos { + background: #1ab394; + } + + .compare-tyre-info { + position: relative; + z-index: 1; + font-size: 11px; + line-height: 1.45; + word-break: break-all; + } + + .compare-depth { + margin-top: 3px; + color: #1ab394; + font-weight: 600; + } + + .clickable-title { + cursor: pointer; + } + + .clickable-title:hover { + color: #1c84c6; + } + .timeline-card { padding: 18px 18px 12px; min-height: 520px; @@ -277,7 +406,8 @@ @media (max-width: 640px) { .summary-counts, - .life-detail-grid { + .life-detail-grid, + .maintenance-compare { grid-template-columns: 1fr; } @@ -317,14 +447,21 @@
+
+
最近一次维保
+
+
正在加载...
+
+
+
- 生命周期时间轴 - 按时间倒序展示,包含装卸、维保、质检、里程记录 + 保养信息 + 按时间倒序展示维保工单
    @@ -335,9 +472,11 @@ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLatestMaintenanceDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLatestMaintenanceDTO.java new file mode 100644 index 00000000..c1f04d55 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLatestMaintenanceDTO.java @@ -0,0 +1,57 @@ +package com.ruoyi.system.domain; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 车辆最近一次维保对比DTO。 + *

    + * 用于车辆生命周期抽屉展示最近一条维保工单的“维保前/维保后”轮位快照。 + * 明细直接复用工单详情页既有 Map 结构,避免新建一套字段口径。 + *

    + */ +public class CarLatestMaintenanceDTO implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 最近一次维保工单概要;车辆无维保记录时为空。 */ + private CarMaintenanceLifecycleDTO order; + + /** 维保前轮胎布局,字段同 BizOrderTireDetailMapper.selectBaseTrieInstall / selectBizOrderTireDetail。 */ + private List tireDetailsBefore = new ArrayList<>(); + + /** 维保后轮胎布局,字段同 BizOrderTireDetailMapper.selectBizOrderTireDetail。 */ + private List tireDetailsAfter = new ArrayList<>(); + + public CarMaintenanceLifecycleDTO getOrder() + { + return order; + } + + public void setOrder(CarMaintenanceLifecycleDTO order) + { + this.order = order; + } + + public List getTireDetailsBefore() + { + return tireDetailsBefore; + } + + public void setTireDetailsBefore(List tireDetailsBefore) + { + this.tireDetailsBefore = tireDetailsBefore; + } + + public List getTireDetailsAfter() + { + return tireDetailsAfter; + } + + public void setTireDetailsAfter(List tireDetailsAfter) + { + this.tireDetailsAfter = tireDetailsAfter; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLifecycleDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLifecycleDTO.java index d7787117..b6b8ee41 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLifecycleDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CarLifecycleDTO.java @@ -8,8 +8,8 @@ import java.util.List; * 车辆生命周期聚合报表DTO。 *

    * 作为车辆全生命周期弹窗“首屏”的统一返回对象,承载车辆概要、当前装车轮胎快照、 - * 最近事件时间线以及各维度记录总数量。各明细列表(装卸、维保、质检、里程) - * 通过独立分页接口按需加载,避免首屏返回数据量过大导致性能问题。 + * 最近事件时间线、车辆维保历史以及各维度记录总数量。维保历史已并入本聚合对象, + * 避免页面为同一车辆生命周期再额外请求独立维保列表接口。 *

    */ public class CarLifecycleDTO implements Serializable @@ -25,6 +25,9 @@ public class CarLifecycleDTO implements Serializable /** 最近事件时间线,聚合装卸与维保两类关键事件,按时间倒序排列,用于快速定位最新动作。 */ private List recentEvents = new ArrayList<>(); + /** 车辆维保工单历史,随生命周期聚合接口返回,避免页面重复调用单独的维保列表接口。 */ + private List maintenanceList = new ArrayList<>(); + /** 该车辆历史轮胎装卸记录总条数,用于前端分页组件初始化总页数。 */ private Integer installCount; @@ -67,6 +70,16 @@ public class CarLifecycleDTO implements Serializable this.recentEvents = recentEvents; } + public List getMaintenanceList() + { + return maintenanceList; + } + + public void setMaintenanceList(List maintenanceList) + { + this.maintenanceList = maintenanceList; + } + public Integer getInstallCount() { return installCount; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/RecordWarehousing.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/RecordWarehousing.java index c8881aec..9058b4f9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/RecordWarehousing.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/RecordWarehousing.java @@ -34,6 +34,9 @@ public class RecordWarehousing extends BaseEntity private Long deptId; + /** 入库录入人所属的修理厂/车队名称,用于详情抽屉回溯入库场站。 */ + private String deptName; + public String getTyreModel() { return tyreModel; } @@ -50,6 +53,14 @@ public class RecordWarehousing extends BaseEntity this.deptId = deptId; } + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + public String getTyreBrand() { return tyreBrand; } @@ -103,6 +114,8 @@ public class RecordWarehousing extends BaseEntity .append("tyreRfid", getTyreRfid()) .append("type", getType()) + + .append("deptName", getDeptName()) .append("createBy", getCreateBy()) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseCarLifecycleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseCarLifecycleService.java index 9e497ed6..b6533a08 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseCarLifecycleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseCarLifecycleService.java @@ -2,9 +2,9 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.CarCheckLifecycleDTO; +import com.ruoyi.system.domain.CarLatestMaintenanceDTO; import com.ruoyi.system.domain.CarLifecycleDTO; import com.ruoyi.system.domain.CarLifecycleQuery; -import com.ruoyi.system.domain.CarMaintenanceLifecycleDTO; import com.ruoyi.system.domain.CarMileageLifecycleDTO; import com.ruoyi.system.domain.CarTyreInstallLifecycleDTO; @@ -29,14 +29,6 @@ public interface IBaseCarLifecycleService */ public List selectInstallList(CarLifecycleQuery query); - /** - * 查询车辆维保工单历史。 - * - * @param query 生命周期查询参数 - * @return 维保工单集合 - */ - public List selectMaintenanceList(CarLifecycleQuery query); - /** * 查询车辆关联轮胎质检历史。 * @@ -52,4 +44,12 @@ public interface IBaseCarLifecycleService * @return 里程历史集合 */ public List selectMileageList(CarLifecycleQuery query); + + /** + * 查询车辆最近一次维保工单的维保前后轮胎对比。 + * + * @param query 生命周期查询参数 + * @return 最近一次维保对比数据;无维保时返回空壳DTO + */ + public CarLatestMaintenanceDTO selectLatestMaintenance(CarLifecycleQuery query); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseCarLifecycleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseCarLifecycleServiceImpl.java index beafbb06..9c4aa11c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseCarLifecycleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseCarLifecycleServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.system.service.impl; +import java.util.ArrayList; import java.util.List; +import java.util.Map; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.BizMaintenanceOrder; +import com.ruoyi.system.domain.BizOrderTireDetail; import com.ruoyi.system.domain.CarCheckLifecycleDTO; +import com.ruoyi.system.domain.CarLatestMaintenanceDTO; import com.ruoyi.system.domain.CarLifecycleDTO; import com.ruoyi.system.domain.CarLifecycleQuery; import com.ruoyi.system.domain.CarLifecycleSummaryDTO; @@ -12,6 +17,8 @@ import com.ruoyi.system.domain.CarMaintenanceLifecycleDTO; import com.ruoyi.system.domain.CarMileageLifecycleDTO; import com.ruoyi.system.domain.CarTyreInstallLifecycleDTO; import com.ruoyi.system.mapper.BaseCarLifecycleMapper; +import com.ruoyi.system.mapper.BizMaintenanceOrderMapper; +import com.ruoyi.system.mapper.BizOrderTireDetailMapper; import com.ruoyi.system.service.IBaseCarLifecycleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +37,12 @@ public class BaseCarLifecycleServiceImpl implements IBaseCarLifecycleService @Autowired private BaseCarLifecycleMapper baseCarLifecycleMapper; + @Autowired + private BizMaintenanceOrderMapper bizMaintenanceOrderMapper; + + @Autowired + private BizOrderTireDetailMapper bizOrderTireDetailMapper; + /** * 查询车辆生命周期概要。 *

    @@ -37,8 +50,9 @@ public class BaseCarLifecycleServiceImpl implements IBaseCarLifecycleService * - 车辆主档概要(车牌号、车队、线路、车型、最近录入里程) * - 当前装车轮胎快照(mountedTyres) * - 最近事件时间线(recentEvents) + * - 维保工单历史(maintenanceList) * - 各维度记录总数量(installCount / maintenanceCount / checkCount / mileageCount) - * 各子列表具体明细需调用对应的独立分页接口获取,避免首屏数据量过大。 + * 维保历史与概要合并返回,避免页面为同一车辆重复请求独立维保列表接口。 *

    * * @param query 查询参数,必须包含非空且长度合法的 carNo @@ -54,6 +68,7 @@ public class BaseCarLifecycleServiceImpl implements IBaseCarLifecycleService dto.setCar(car); dto.setMountedTyres(baseCarLifecycleMapper.selectMountedTyres(query)); dto.setRecentEvents(baseCarLifecycleMapper.selectRecentEvents(query)); + dto.setMaintenanceList(baseCarLifecycleMapper.selectMaintenanceList(query)); dto.setInstallCount(baseCarLifecycleMapper.countInstallRecords(query)); dto.setMaintenanceCount(baseCarLifecycleMapper.countMaintenanceOrders(query)); dto.setCheckCount(baseCarLifecycleMapper.countCheckRecords(query)); @@ -81,23 +96,50 @@ public class BaseCarLifecycleServiceImpl implements IBaseCarLifecycleService } /** - * 查询车辆维保工单历史(分页/全量)。 + * 查询车辆最近一次维保的前后轮胎对比。 *

    - * 通过 {@code biz_maintenance_order.plate_number = carNo} 直接关联车辆,返回所有维保工单。 - * 展示字段包括:工单编号、维保类型、修理厂、保养日期、工单状态、录入里程、上次里程、故障描述等。 - * 数据按保养日期(maintain_date)倒序排列。 + * 先走 buildAuthorizedCar 统一权限闸口,再复用维保列表排序和工单详情页的轮胎明细SQL,避免重复造查询口径。 *

    - * - * @param query 查询参数,内部通过 buildAuthorizedCar 回填 carId - * @return 维保工单列表;无记录时返回空列表 - * @throws ServiceException 车辆不存在或无权限访问时抛出 */ @Override @DataScope(deptAlias = "d", userAlias = "u") - public List selectMaintenanceList(CarLifecycleQuery query) + public CarLatestMaintenanceDTO selectLatestMaintenance(CarLifecycleQuery query) { buildAuthorizedCar(query); - return baseCarLifecycleMapper.selectMaintenanceList(query); + CarLatestMaintenanceDTO dto = new CarLatestMaintenanceDTO(); + List maintenanceList = baseCarLifecycleMapper.selectMaintenanceList(query); + if (maintenanceList == null || maintenanceList.isEmpty()) + { + return dto; + } + + CarMaintenanceLifecycleDTO latest = maintenanceList.get(0); + dto.setOrder(latest); + if (latest.getOrderId() != null) + { + BizOrderTireDetail afterQuery = new BizOrderTireDetail(); + afterQuery.setOrderId(latest.getOrderId()); + dto.setTireDetailsAfter(emptyIfNull(bizOrderTireDetailMapper.selectBizOrderTireDetail(afterQuery))); + } + + if (latest.getOrderId() != null && !StringUtils.isBlank(latest.getPlateNumber())) + { + BizMaintenanceOrder probe = new BizMaintenanceOrder(); + probe.setOrderId(latest.getOrderId()); + // 上一条工单SQL同时依赖 orderId 与 plateNumber,缺车牌会导致无法命中上一条记录。 + probe.setPlateNumber(latest.getPlateNumber()); + BizMaintenanceOrder previousOrder = bizMaintenanceOrderMapper.selectBizMaintenanceOrderByOrderIdBefore(probe); + if (previousOrder != null && previousOrder.getOrderId() != null) + { + BizOrderTireDetail beforeQuery = new BizOrderTireDetail(); + beforeQuery.setOrderId(previousOrder.getOrderId()); + dto.setTireDetailsBefore(emptyIfNull(bizOrderTireDetailMapper.selectBizOrderTireDetail(beforeQuery))); + return dto; + } + } + + dto.setTireDetailsBefore(emptyIfNull(bizOrderTireDetailMapper.selectBaseTrieInstall(latest.getPlateNumber()))); + return dto; } /** @@ -193,4 +235,9 @@ public class BaseCarLifecycleServiceImpl implements IBaseCarLifecycleService } query.setCarNo(carNo); } + + private List emptyIfNull(List list) + { + return list == null ? new ArrayList<>() : list; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/util/TyreLifecycleCalc.java b/ruoyi-system/src/main/java/com/ruoyi/system/util/TyreLifecycleCalc.java new file mode 100644 index 00000000..ae5f5778 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/util/TyreLifecycleCalc.java @@ -0,0 +1,191 @@ +package com.ruoyi.system.util; + +import com.ruoyi.system.domain.RecordTyreInstall; +import com.ruoyi.system.domain.RecordTyreMileage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 轮胎生命周期计算工具。 + *

    + * 这里保持纯函数口径,避免 Web、PDA、后续报表各自实现“当前花纹/单段磨损”后出现统计漂移。 + *

    + */ +public final class TyreLifecycleCalc +{ + private static final Logger log = LoggerFactory.getLogger(TyreLifecycleCalc.class); + + private TyreLifecycleCalc() + { + } + + /** + * 从装卸记录中取最新一条非空花纹深度。 + *

    + * 业务约定“当前剩余花纹”以装卸记录为准;并发同秒写入时按 id 大者兜底,保证结果稳定可复测。 + *

    + */ + public static String currentPatternDepth(List installRecords) + { + if (installRecords == null || installRecords.isEmpty()) + { + return null; + } + RecordTyreInstall latest = null; + for (RecordTyreInstall item : installRecords) + { + if (item == null || isBlank(item.getPatternDepth())) + { + continue; + } + if (latest == null || after(item, latest)) + { + latest = item; + } + } + return latest == null ? null : latest.getPatternDepth().trim(); + } + + /** + * 计算每一程的单段环比磨损。 + *

    + * 职责边界:本方法只读取 record_tyre_mileage.pattern_depth,不处理 mileage 为空与否。 + * mileage 求和由 {@link #sumMileage(List)} 或调用方按展示需要单独处理。 + *

    + */ + public static Map computeSegmentWears(BigDecimal initialDepth, + List mileageList) + { + Map wearMap = new HashMap<>(); + if (mileageList == null || mileageList.isEmpty()) + { + return wearMap; + } + + List sortedList = new ArrayList<>(); + for (RecordTyreMileage item : mileageList) + { + if (item != null) + { + sortedList.add(item); + } + } + sortedList.sort(Comparator + .comparing(RecordTyreMileage::getStartTime, Comparator.nullsLast(Comparator.naturalOrder())) + .thenComparing(RecordTyreMileage::getId, Comparator.nullsLast(Comparator.naturalOrder()))); + + BigDecimal previousDepth = initialDepth; + for (RecordTyreMileage item : sortedList) + { + BigDecimal currentDepth = parseDepth(item.getPatternDepth()); + String wearDepth = null; + if (previousDepth != null && currentDepth != null) + { + wearDepth = formatDecimal(previousDepth.subtract(currentDepth)); + } + if (item.getId() != null) + { + wearMap.put(item.getId(), wearDepth); + } + if (currentDepth != null) + { + // 当前段脏数据不更新 prev,避免一条坏花纹深度污染后续所有段。 + previousDepth = currentDepth; + } + } + return wearMap; + } + + /** + * 解析 pattern_depth 系列字段。 + *

    + * base_tyre / record_tyre_install / record_tyre_mileage 的 pattern_depth 历史上都是 varchar, + * 因此只在花纹深度计算中做容错解析;里程 mileage 是实体 Long,不走本方法。 + *

    + */ + public static BigDecimal parseDepth(String value) + { + if (isBlank(value)) + { + return null; + } + String trimmed = value.trim(); + try + { + return new BigDecimal(trimmed); + } + catch (NumberFormatException ex) + { + log.warn("轮胎花纹深度无法解析,已按空值处理:{}", trimmed); + return null; + } + } + + /** + * 累加轮胎各程行驶里程。 + *

    + * RecordTyreMileage.mileage 是 Java Long,表示该程 km 差值;空值跳过,不使用字符串解析。 + *

    + */ + public static BigDecimal sumMileage(List mileageList) + { + if (mileageList == null || mileageList.isEmpty()) + { + return null; + } + BigDecimal total = BigDecimal.ZERO; + boolean hasMileage = false; + for (RecordTyreMileage item : mileageList) + { + if (item != null && item.getMileage() != null) + { + total = total.add(BigDecimal.valueOf(item.getMileage())); + hasMileage = true; + } + } + return hasMileage ? total : null; + } + + private static boolean after(RecordTyreInstall left, RecordTyreInstall right) + { + if (left.getCreateTime() != null && right.getCreateTime() != null) + { + int compare = left.getCreateTime().compareTo(right.getCreateTime()); + if (compare != 0) + { + return compare > 0; + } + } + else if (left.getCreateTime() != null) + { + return true; + } + else if (right.getCreateTime() != null) + { + return false; + } + + if (left.getId() != null && right.getId() != null) + { + return left.getId().compareTo(right.getId()) > 0; + } + return left.getId() != null && right.getId() == null; + } + + private static String formatDecimal(BigDecimal value) + { + return value == null ? null : value.stripTrailingZeros().toPlainString(); + } + + private static boolean isBlank(String value) + { + return value == null || value.trim().isEmpty(); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/tyre/RecordTyreMileageMapper.xml b/ruoyi-system/src/main/resources/mapper/tyre/RecordTyreMileageMapper.xml index 35be1cf5..2794a32b 100644 --- a/ruoyi-system/src/main/resources/mapper/tyre/RecordTyreMileageMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/tyre/RecordTyreMileageMapper.xml @@ -17,14 +17,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, tyre_rfid, start_time, end_time, mileage, create_by, create_time, update_by, update_time, remark from record_tyre_mileage + select id, tyre_rfid, start_time, end_time, mileage, pattern_depth, create_by, create_time, update_by, update_time, remark from record_tyre_mileage select rw.id, rw.tyre_rfid, rw.type, su.user_name as create_by, rw.create_time, rw.update_by, rw.update_time, rw.remark, - bt.tyre_brand,bt.tyre_no,bt.tyre_model + bt.tyre_brand,bt.tyre_no,bt.tyre_model, sd.dept_name from record_warehousing rw LEFT JOIN base_tyre bt ON rw.tyre_rfid = bt.tyre_epc left join sys_user su ON su.login_name = rw.create_by + left join sys_dept sd ON sd.dept_id = su.dept_id where rw.id is not null and rw.tyre_rfid = #{tyreRfid} and rw.type = #{type} @@ -132,4 +134,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - \ No newline at end of file +