ouyj 5 月之前
父节点
当前提交
42b7110e7f

+ 200 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtOrderHourController.java

@@ -0,0 +1,200 @@
+package com.ygtx.gxt.controller;
+
+import com.ygtx.common.annotation.Log;
+import com.ygtx.common.core.controller.BaseController;
+import com.ygtx.common.core.domain.AjaxResult;
+import com.ygtx.common.core.page.TableDataInfo;
+import com.ygtx.common.enums.BusinessType;
+import com.ygtx.gxt.domain.GxtRepairOrder;
+import com.ygtx.gxt.domain.GxtWorkOrder;
+import com.ygtx.gxt.domain.OrderScoreInfo;
+import com.ygtx.gxt.service.IGxtOrderHourService;
+import com.ygtx.gxt.service.IGxtRepairOrderService;
+import com.ygtx.gxt.service.IGxtWorkOrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工单工时Controller
+ * 
+ * @author lingming
+ * @date 2025-11-12
+ */
+@RestController
+@RequestMapping("/gxt/orderHour")
+public class GxtOrderHourController extends BaseController
+{
+    @Autowired
+    private IGxtRepairOrderService gxtRepairOrderService;
+
+    @Autowired
+    private IGxtWorkOrderService gxtWorkOrderService;
+    
+    @Autowired
+    private IGxtOrderHourService gxtOrderHourService;
+
+    /**
+     * 查询工单工时列表(合并维修工单和维保工单)
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(GxtRepairOrder repairOrder, GxtWorkOrder workOrder, @RequestParam(required = false) String orderType)
+    {
+        // 开启分页插件自动分页
+        startPage();
+        // 查询合并的工单列表
+        List<OrderScoreInfo> list = gxtOrderHourService.selectUnionOrderList(repairOrder, workOrder);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询工单工时统计信息
+     */
+    @GetMapping("/statistics")
+    public AjaxResult getStatistics(GxtRepairOrder repairOrder, GxtWorkOrder workOrder, @RequestParam(required = false) String orderType)
+    {
+        Map<String, Object> statistics = gxtOrderHourService.getOrderHourStatistics(repairOrder, workOrder);
+        return AjaxResult.success(statistics);
+    }
+    
+    /**
+     * 获取工单详情(包含工时构成信息)
+     */
+    @GetMapping("/detail/{orderType}/{orderId}")
+    public AjaxResult getOrderDetail(@PathVariable("orderType") Integer orderType, @PathVariable("orderId") Long orderId)
+    {
+        OrderScoreInfo order = null;
+        if (orderType == 1) {
+            // 维修工单
+            GxtRepairOrder repairOrder = gxtRepairOrderService.selectGxtRepairOrderById(orderId);
+            // 转换为OrderScoreInfo对象
+            order = convertRepairOrderToScoreInfo(repairOrder);
+        } else if (orderType == 2) {
+            // 维保工单
+            GxtWorkOrder workOrder = gxtWorkOrderService.selectGxtWorkOrderById(orderId);
+            // 转换为OrderScoreInfo对象
+            order = convertWorkOrderToScoreInfo(workOrder);
+        }
+        
+        if (order != null) {
+            // 计算工时构成信息
+            gxtOrderHourService.calculateOrderTimeDetails(order);
+            return AjaxResult.success(order);
+        }
+        
+        return AjaxResult.error("未找到工单信息");
+    }
+    
+    /**
+     * 将维修工单转换为OrderScoreInfo对象
+     */
+    private OrderScoreInfo convertRepairOrderToScoreInfo(GxtRepairOrder repairOrder) {
+        if (repairOrder == null) {
+            return null;
+        }
+        
+        OrderScoreInfo info = new OrderScoreInfo();
+        info.setOrderType(1);
+        info.setId(repairOrder.getId());
+        info.setWorkOrderProjectNo(repairOrder.getWorkOrderProjectNo());
+        info.setWorkOrderStatus(repairOrder.getWorkOrderStatus());
+        info.setGxtCenterId(repairOrder.getGxtCenterId());
+        info.setGxtCenter(repairOrder.getGxtCenter());
+        info.setPcsStationId(repairOrder.getPcsStationId());
+        info.setPcsStationPid(repairOrder.getPcsStationPid());
+        info.setPcsStationName(repairOrder.getPcsStationName());
+        info.setPcsDeviceId(repairOrder.getPcsDeviceId());
+        info.setPcsDeviceName(repairOrder.getPcsDeviceName());
+        info.setBrand(repairOrder.getBrand());
+        info.setModel(repairOrder.getModel());
+        info.setAssignTime(repairOrder.getAssignTime());
+        info.setAssignUserId(repairOrder.getAssignUserId());
+        info.setAssignUserName(repairOrder.getAssignUserName());
+        info.setAcceptTime(repairOrder.getAcceptTime());
+        info.setAcceptUserId(repairOrder.getAcceptUserId());
+        info.setAcceptUserName(repairOrder.getAcceptUserName());
+        info.setRealStartTime(repairOrder.getRealStartTime());
+        info.setRealEndTime(repairOrder.getRealEndTime());
+        info.setTeamLeaderId(repairOrder.getTeamLeaderId());
+        info.setTeamLeaderName(repairOrder.getTeamLeaderName());
+        info.setWorkGroupMemberId(repairOrder.getWorkGroupMemberId());
+        info.setWorkGroupMemberName(repairOrder.getWorkGroupMemberName());
+        info.setScore(repairOrder.getScore() != null ? repairOrder.getScore().doubleValue() : null);
+        info.setReviewContent(repairOrder.getReviewContent());
+        info.setSuspendReason(repairOrder.getSuspendReason());
+        info.setRestartTime(repairOrder.getRestartTime());
+        info.setPriorityType(repairOrder.getPriorityType());
+        info.setScoringStatus(repairOrder.getScoringStatus());
+        info.setWorkSummary(repairOrder.getContent());
+        info.setMaintenanceType(repairOrder.getMaintenanceType());
+        info.setPlanHour(repairOrder.getPlanHour() != null ? repairOrder.getPlanHour().doubleValue() : null);
+        info.setFaultCode(repairOrder.getFaultCode());
+        info.setFaultDesc(repairOrder.getFaultDesc());
+        info.setOccurTime(repairOrder.getOccurTime());
+        info.setReviewScoreNum(repairOrder.getReviewScoreNum());
+        info.setFinalCoefficient(repairOrder.getFinalCoefficient());
+        info.setCreateTime(repairOrder.getCreateTime());
+        info.setUpdateTime(repairOrder.getUpdateTime());
+        return info;
+    }
+    
+    /**
+     * 将维保工单转换为OrderScoreInfo对象
+     */
+    private OrderScoreInfo convertWorkOrderToScoreInfo(GxtWorkOrder workOrder) {
+        if (workOrder == null) {
+            return null;
+        }
+        
+        OrderScoreInfo info = new OrderScoreInfo();
+        info.setOrderType(2);
+        info.setId(workOrder.getId());
+        info.setWorkOrderProjectNo(workOrder.getWorkOrderProjectNo());
+        info.setWorkOrderStatus(workOrder.getWorkOrderStatus());
+        info.setGxtCenterId(workOrder.getGxtCenterId());
+        info.setGxtCenter(workOrder.getGxtCenter());
+        info.setPcsStationId(workOrder.getPcsStationId());
+        info.setPcsStationPid(workOrder.getPcsStationPid());
+        info.setPcsStationName(workOrder.getPcsStationName());
+        info.setPcsDeviceId(workOrder.getPcsDeviceId());
+        info.setPcsDeviceName(workOrder.getPcsDeviceName());
+        info.setBrand(workOrder.getBrand());
+        info.setModel(workOrder.getModel());
+        info.setAssignTime(workOrder.getAssignTime());
+        info.setAssignUserId(workOrder.getAssignUserId());
+        info.setAssignUserName(workOrder.getAssignUserName());
+        info.setAcceptTime(workOrder.getAcceptTime());
+        info.setAcceptUserId(workOrder.getAcceptUserId());
+        info.setAcceptUserName(workOrder.getAcceptUserName());
+        info.setRealStartTime(workOrder.getRealStartTime());
+        info.setRealEndTime(workOrder.getRealEndTime());
+        info.setTeamLeaderId(workOrder.getTeamLeaderId());
+        info.setTeamLeaderName(workOrder.getTeamLeaderName());
+        info.setWorkGroupMemberId(workOrder.getWorkGroupMemberId());
+        info.setWorkGroupMemberName(workOrder.getWorkGroupMemberName());
+        info.setScore(workOrder.getScore() != null ? workOrder.getScore().doubleValue() : null);
+        info.setReviewContent(workOrder.getReviewContent());
+        info.setSuspendReason(workOrder.getSuspendReason());
+        info.setRestartTime(workOrder.getRestartTime());
+        info.setPriorityType(workOrder.getPriorityType() != null ? workOrder.getPriorityType().toString() : null);
+        info.setScoringStatus(workOrder.getScoringStatus());
+        info.setWorkSummary(workOrder.getRealContent());
+        info.setInspectionType(workOrder.getInspectionType());
+        info.setPlanStartTime(workOrder.getPlanStartTime());
+        info.setPlanEndTime(workOrder.getPlanEndTime());
+        info.setPlanHour(workOrder.getPlanHour() != null ? workOrder.getPlanHour().doubleValue() : null);
+        info.setFaultCode(workOrder.getFaultCode());
+        info.setFaultDesc(workOrder.getFaultDesc());
+        info.setSuspendTime(workOrder.getSuspendTime());
+        info.setPauseReason(workOrder.getPauseReason());
+        info.setPauseTime(workOrder.getPauseTime());
+        info.setCompleteTime(workOrder.getCompleteTime());
+        info.setReviewScoreNum(workOrder.getReviewScoreNum());
+        info.setFinalCoefficient(workOrder.getFinalCoefficient());
+        info.setCreateTime(workOrder.getCreateTime());
+        info.setUpdateTime(workOrder.getUpdateTime());
+        return info;
+    }
+}

+ 78 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/OrderScoreInfo.java

@@ -182,6 +182,28 @@ public class OrderScoreInfo {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
+    /** 处理时长 */
+    private Double handleHour;
+    
+    // 工时构成相关字段
+    /** 下发时长 */
+    private Double issueHour;
+    
+    /** 接单时长 */
+    private Double acceptHour;
+    
+    /** 准备时长 */
+    private Double prepareHour;
+    
+    /** 工作时长 */
+    private Double workHour;
+    
+    /** 复运时长 */
+    private Double restartHour;
+    
+    /** 挂起时长 */
+    private Double suspendHour;
+
     public Integer getOrderType() {
         return orderType;
     }
@@ -621,4 +643,60 @@ public class OrderScoreInfo {
     public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
     }
+
+    public Double getHandleHour() {
+        return handleHour;
+    }
+
+    public void setHandleHour(Double handleHour) {
+        this.handleHour = handleHour;
+    }
+    
+    public Double getIssueHour() {
+        return issueHour;
+    }
+    
+    public void setIssueHour(Double issueHour) {
+        this.issueHour = issueHour;
+    }
+    
+    public Double getAcceptHour() {
+        return acceptHour;
+    }
+    
+    public void setAcceptHour(Double acceptHour) {
+        this.acceptHour = acceptHour;
+    }
+    
+    public Double getPrepareHour() {
+        return prepareHour;
+    }
+    
+    public void setPrepareHour(Double prepareHour) {
+        this.prepareHour = prepareHour;
+    }
+    
+    public Double getWorkHour() {
+        return workHour;
+    }
+    
+    public void setWorkHour(Double workHour) {
+        this.workHour = workHour;
+    }
+    
+    public Double getRestartHour() {
+        return restartHour;
+    }
+    
+    public void setRestartHour(Double restartHour) {
+        this.restartHour = restartHour;
+    }
+    
+    public Double getSuspendHour() {
+        return suspendHour;
+    }
+    
+    public void setSuspendHour(Double suspendHour) {
+        this.suspendHour = suspendHour;
+    }
 }

+ 28 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/mapper/GxtOrderHourMapper.java

@@ -0,0 +1,28 @@
+package com.ygtx.gxt.mapper;
+
+import com.ygtx.gxt.domain.GxtRepairOrder;
+import com.ygtx.gxt.domain.GxtWorkOrder;
+import com.ygtx.gxt.domain.OrderScoreInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 工单工时Mapper接口
+ * 
+ * @author ouyj
+ * @date 2025-11-12
+ */
+public interface GxtOrderHourMapper {
+
+    /**
+     * 查询合并的工单列表(维修工单和维保工单)
+     * 
+     * @param repairOrder 维修工单查询条件
+     * @param workOrder 维保工单查询条件
+     * @return 合并的工单列表
+     */
+    public List<OrderScoreInfo> selectUnionOrderList(@Param("repairOrder") GxtRepairOrder repairOrder,
+                                                     @Param("workOrder") GxtWorkOrder workOrder);
+
+}

+ 42 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/IGxtOrderHourService.java

@@ -0,0 +1,42 @@
+package com.ygtx.gxt.service;
+
+import com.ygtx.gxt.domain.GxtRepairOrder;
+import com.ygtx.gxt.domain.GxtWorkOrder;
+import com.ygtx.gxt.domain.OrderScoreInfo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工单工时Service接口
+ * 
+ * @author ouyj
+ * @date 2025-11-12
+ */
+public interface IGxtOrderHourService 
+{
+    /**
+     * 查询合并的工单列表(维修工单和维保工单)
+     * 
+     * @param repairOrder 维修工单查询条件
+     * @param workOrder 维保工单查询条件
+     * @return 合并的工单列表
+     */
+    public List<OrderScoreInfo> selectUnionOrderList(GxtRepairOrder repairOrder, GxtWorkOrder workOrder);
+
+    /**
+     * 获取工单工时统计信息
+     *
+     * @param repairOrder 维修工单查询条件
+     * @param workOrder 维保工单查询条件
+     * @return 统计信息
+     */
+    public Map<String, Object> getOrderHourStatistics(GxtRepairOrder repairOrder, GxtWorkOrder workOrder);
+    
+    /**
+     * 计算工单详情中的各个时长(用于前端展示)
+     * 
+     * @param order 工单信息
+     */
+    public void calculateOrderTimeDetails(OrderScoreInfo order);
+}

+ 528 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtOrderHourServiceImpl.java

@@ -0,0 +1,528 @@
+package com.ygtx.gxt.service.impl;
+
+import com.ygtx.common.constant.Constants;
+import com.ygtx.common.core.domain.entity.SysRole;
+import com.ygtx.common.core.domain.entity.SysUser;
+import com.ygtx.common.core.domain.model.LoginUser;
+import com.ygtx.common.utils.SecurityUtils;
+import com.ygtx.framework.aspectj.DataScopeAspect;
+import com.ygtx.gxt.domain.*;
+import com.ygtx.gxt.mapper.GxtOrderHourMapper;
+import com.ygtx.gxt.mapper.GxtOrderScoreMapper;
+import com.ygtx.gxt.mapper.GxtRepairOrderFlowMapper;
+import com.ygtx.gxt.mapper.GxtWorkOrderFlowMapper;
+import com.ygtx.gxt.service.IGxtOrderHourService;
+import com.ygtx.gxt.service.IGxtOrderScoreService;
+import com.ygtx.gxt.service.IGxtRepairOrderService;
+import com.ygtx.gxt.service.IGxtWorkOrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+/**
+ * 工单工时Service业务层处理
+ *
+ * @author ouyj
+ * @date 2025-11-12
+ */
+@Service
+public class GxtOrderHourServiceImpl implements IGxtOrderHourService {
+
+    @Autowired
+    private GxtOrderHourMapper gxtOrderHourMapper;
+    
+    @Autowired
+    private IGxtRepairOrderService gxtRepairOrderService;
+    
+    @Autowired
+    private IGxtWorkOrderService gxtWorkOrderService;
+    
+    @Autowired
+    private GxtRepairOrderFlowMapper gxtRepairOrderFlowMapper;
+    
+    @Autowired
+    private GxtWorkOrderFlowMapper gxtWorkOrderFlowMapper;
+
+    /**
+     * 查询合并的工单列表(维修工单和维保工单)
+     *
+     * @param repairOrder 维修工单查询条件
+     * @param workOrder 维保工单查询条件
+     * @return 合并的工单列表
+     */
+    @Override
+    public List<OrderScoreInfo> selectUnionOrderList(GxtRepairOrder repairOrder, GxtWorkOrder workOrder) {
+        // 添加业务特定的数据权限过滤
+        addBusinessDataScopeFilter(repairOrder, workOrder);
+
+        // 设置创建人,用于数据权限过滤
+        if(!Constants.SUPER_ADMIN.equals(SecurityUtils.getUsername())){
+            if (repairOrder.getCreateBy() == null || repairOrder.getCreateBy().isEmpty()) {
+                repairOrder.setCreateBy(SecurityUtils.getUsername());
+            }
+
+            if (workOrder.getCreateBy() == null || workOrder.getCreateBy().isEmpty()) {
+                workOrder.setCreateBy(SecurityUtils.getUsername());
+            }
+        }
+        // 查询工单列表
+        List<OrderScoreInfo> orderList = gxtOrderHourMapper.selectUnionOrderList(repairOrder, workOrder);
+        
+        // 计算每个工单的处理时长
+        for (OrderScoreInfo order : orderList) {
+            double processingHours = calculateOrderProcessingHours(order);
+            order.setHandleHour(processingHours);
+        }
+        
+        return orderList;
+    }
+
+    /**
+     * 添加业务特定的数据权限过滤条件
+     * 基于角色的数据范围进行自定义权限控制
+     *
+     * @param repairOrder 维修工单查询条件
+     * @param workOrder 维保工单查询条件
+     */
+    private void addBusinessDataScopeFilter(GxtRepairOrder repairOrder, GxtWorkOrder workOrder) {
+        // 获取当前登录用户
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (loginUser == null) {
+            return;
+        }
+
+        SysUser currentUser = loginUser.getUser();
+        if (currentUser == null) {
+            return;
+        }
+
+        // 如果是超级管理员,不过滤数据
+        if (currentUser.isAdmin()) {
+            return;
+        }
+
+        // 获取用户角色
+        List<SysRole> roles = currentUser.getRoles();
+        if (roles == null || roles.isEmpty()) {
+            return;
+        }
+
+        // 构建业务特定的数据权限SQL
+        StringBuilder orderBusinessSql = new StringBuilder();
+        StringBuilder repairBusinessSql = new StringBuilder();
+
+        // 遍历用户角色,根据角色的数据范围添加业务特定的权限控制
+        for (SysRole role : roles) {
+            String dataScope = role.getDataScope();
+
+            // 如果是全部数据权限,则不过滤
+            if (DataScopeAspect.DATA_SCOPE_ALL.equals(dataScope)) {
+                orderBusinessSql.setLength(0); // 清空之前的条件
+                repairBusinessSql.setLength(0); // 清空之前的条件
+                break; // 全部数据权限,跳出循环
+            }
+
+            // 自定义数据权限 - 根据角色的数据范围值来控制查询条件
+            if (DataScopeAspect.DATA_SCOPE_CUSTOM.equals(dataScope)) {
+                // 获取具有自定义数据权限的角色ID列表
+                List<String> customRoleIds = new ArrayList<>();
+                for (SysRole r : roles) {
+                    if (DataScopeAspect.DATA_SCOPE_CUSTOM.equals(r.getDataScope())) {
+                        customRoleIds.add(String.valueOf(r.getRoleId()));
+                    }
+                }
+
+                // 构建自定义数据权限查询条件
+                if (orderBusinessSql.length() > 0) {
+                    orderBusinessSql.append(" OR ");
+                }
+                // 构建自定义数据权限查询条件
+                if (repairBusinessSql.length() > 0) {
+                    repairBusinessSql.append(" OR ");
+                }
+
+                if (customRoleIds.size() > 1) {
+                    // 多个自定义数据权限角色使用IN查询
+                    orderBusinessSql.append("(t.pcs_station_pid IN (SELECT dept_id FROM sys_role_dept WHERE role_id IN (")
+                            .append(String.join(",", customRoleIds))
+                            .append("))")
+                            .append(" OR t.pcs_station_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id IN (")
+                            .append(String.join(",", customRoleIds))
+                            .append("))")
+                            .append(" OR t.gxt_center_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id IN (")
+                            .append(String.join(",", customRoleIds))
+                            .append(")))");
+                    repairBusinessSql.append("(t.pcs_station_pid IN (SELECT dept_id FROM sys_role_dept WHERE role_id IN (")
+                            .append(String.join(",", customRoleIds))
+                            .append("))")
+                            .append(" OR t.pcs_station_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id IN (")
+                            .append(String.join(",", customRoleIds))
+                            .append("))")
+                            .append(" OR t.gxt_center_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id IN (")
+                            .append(String.join(",", customRoleIds))
+                            .append(")))");
+                } else {
+                    // 单个自定义数据权限角色查询
+                    orderBusinessSql.append("(t.pcs_station_pid IN (SELECT dept_id FROM sys_role_dept WHERE role_id = ")
+                            .append(role.getRoleId())
+                            .append(")")
+                            .append(" OR t.pcs_station_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id = ")
+                            .append(role.getRoleId())
+                            .append(")")
+                            .append(" OR t.gxt_center_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id = ")
+                            .append(role.getRoleId())
+                            .append("))");
+                    repairBusinessSql.append("(t.pcs_station_pid IN (SELECT dept_id FROM sys_role_dept WHERE role_id = ")
+                            .append(role.getRoleId())
+                            .append(")")
+                            .append(" OR t.pcs_station_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id = ")
+                            .append(role.getRoleId())
+                            .append(")")
+                            .append(" OR t.gxt_center_id IN (SELECT dept_id FROM sys_role_dept WHERE role_id = ")
+                            .append(role.getRoleId())
+                            .append("))");
+                }
+                continue;
+            }
+
+            // 部门数据权限 - 适用于部门负责人角色
+            if (DataScopeAspect.DATA_SCOPE_DEPT.equals(dataScope)) {
+                if (orderBusinessSql.length() > 0) {
+                    orderBusinessSql.append(" OR ");
+                }
+                if (repairBusinessSql.length() > 0) {
+                    repairBusinessSql.append(" OR ");
+                }
+                orderBusinessSql.append("(t.pcs_station_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR t.pcs_station_pid = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR t.gxt_center_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(")");
+                repairBusinessSql.append("(t.pcs_station_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR t.pcs_station_pid = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR t.gxt_center_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(")");
+                continue;
+            }
+
+            // 部门及以下数据权限
+            if (DataScopeAspect.DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
+                if (orderBusinessSql.length() > 0) {
+                    orderBusinessSql.append(" OR ");
+                }
+                if (repairBusinessSql.length() > 0) {
+                    repairBusinessSql.append(" OR ");
+                }
+                orderBusinessSql.append("(t.pcs_station_id IN ")
+                        .append("(SELECT dept_id FROM sys_dept WHERE dept_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR FIND_IN_SET(")
+                        .append(currentUser.getDeptId())
+                        .append(", ancestors))")
+                        .append(" OR t.pcs_station_pid IN ")
+                        .append("(SELECT dept_id FROM sys_dept WHERE dept_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR FIND_IN_SET(")
+                        .append(currentUser.getDeptId())
+                        .append(", ancestors))")
+                        .append(" OR t.gxt_center_id IN ")
+                        .append("(SELECT dept_id FROM sys_dept WHERE dept_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR FIND_IN_SET(")
+                        .append(currentUser.getDeptId())
+                        .append(", ancestors)))");
+                repairBusinessSql.append("(t.pcs_station_id IN ")
+                        .append("(SELECT dept_id FROM sys_dept WHERE dept_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR FIND_IN_SET(")
+                        .append(currentUser.getDeptId())
+                        .append(", ancestors))")
+                        .append(" OR t.pcs_station_pid IN ")
+                        .append("(SELECT dept_id FROM sys_dept WHERE dept_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR FIND_IN_SET(")
+                        .append(currentUser.getDeptId())
+                        .append(", ancestors))")
+                        .append(" OR t.gxt_center_id IN ")
+                        .append("(SELECT dept_id FROM sys_dept WHERE dept_id = ")
+                        .append(currentUser.getDeptId())
+                        .append(" OR FIND_IN_SET(")
+                        .append(currentUser.getDeptId())
+                        .append(", ancestors)))");
+                continue;
+            }
+
+            // 仅本人数据权限 - 适用于主检修员角色
+            if (DataScopeAspect.DATA_SCOPE_SELF.equals(dataScope)) {
+                if (orderBusinessSql.length() > 0) {
+                    orderBusinessSql.append(" OR ");
+                }
+                if (repairBusinessSql.length() > 0) {
+                    repairBusinessSql.append(" OR ");
+                }
+                orderBusinessSql.append("(t.team_leader_id = ")
+                        .append(currentUser.getUserId())
+                        .append(" OR t.assign_user_id = ")
+                        .append(currentUser.getUserId())
+                        .append(" OR t.accept_user_id = ")
+                        .append(currentUser.getUserId())
+                        .append(" OR t.id IN (SELECT order_id FROM gxt_work_order_person WHERE user_id = ")
+                        .append(currentUser.getUserId())
+                        .append(") ")
+                        .append(" OR t.create_by = '")
+                        .append(currentUser.getUserName())
+                        .append("')");
+                repairBusinessSql.append("(t.team_leader_id = ")
+                        .append(currentUser.getUserId())
+                        .append(" OR t.assign_user_id = ")
+                        .append(currentUser.getUserId())
+                        .append(" OR t.accept_user_id = ")
+                        .append(currentUser.getUserId())
+                        .append(" OR t.id IN (SELECT order_id FROM gxt_repair_order_person WHERE user_id = ")
+                        .append(currentUser.getUserId())
+                        .append(") ")
+                        .append(" OR t.create_by = '")
+                        .append(currentUser.getUserName())
+                        .append("')");
+                continue;
+            }
+        }
+
+        // 如果构建了业务特定的过滤条件,则添加到查询参数中
+        if (orderBusinessSql.length() > 0) {
+            String businessDataScopeSql = " AND (" + orderBusinessSql.toString() + ")";
+            workOrder.getParams().put("businessDataScope", businessDataScopeSql);
+        }
+        if (repairBusinessSql.length() > 0) {
+            String businessDataScopeSql = " AND (" + repairBusinessSql.toString() + ")";
+            repairOrder.getParams().put("businessDataScope", businessDataScopeSql);
+        }
+    }
+
+    /**
+     * 获取工单工时统计信息
+     *
+     * @param repairOrder 维修工单查询条件
+     * @param workOrder 维保工单查询条件
+     * @return 统计信息
+     */
+    @Override
+    public Map<String, Object> getOrderHourStatistics(GxtRepairOrder repairOrder, GxtWorkOrder workOrder) {
+        // 添加业务特定的数据权限过滤
+        addBusinessDataScopeFilter(repairOrder, workOrder);
+
+        // 设置创建人,用于数据权限过滤
+        if(!Constants.SUPER_ADMIN.equals(SecurityUtils.getUsername())){
+            if (repairOrder.getCreateBy() == null || repairOrder.getCreateBy().isEmpty()) {
+                repairOrder.setCreateBy(SecurityUtils.getUsername());
+            }
+
+            if (workOrder.getCreateBy() == null || workOrder.getCreateBy().isEmpty()) {
+                workOrder.setCreateBy(SecurityUtils.getUsername());
+            }
+        }
+
+        // 获取统计数据
+        List<OrderScoreInfo> orderList = gxtOrderHourMapper.selectUnionOrderList(repairOrder, workOrder);
+        
+        // 计算统计信息
+        Map<String, Object> statistics = new HashMap<>();
+        
+        double totalHours = 0;
+        double maintenanceHours = 0;
+        double repairHours = 0;
+        int maintenanceCount = 0;
+        int repairCount = 0;
+        
+        for (OrderScoreInfo order : orderList) {
+            double hours = calculateOrderProcessingHours(order);
+            totalHours += hours;
+            
+            if (order.getOrderType() == 2) { // 维保工单
+                maintenanceHours += hours;
+                maintenanceCount++;
+            } else if (order.getOrderType() == 1) { // 维修工单
+                repairHours += hours;
+                repairCount++;
+            }
+        }
+        
+        statistics.put("totalHours", totalHours);
+        statistics.put("maintenanceHours", maintenanceHours);
+        statistics.put("repairHours", repairHours);
+        statistics.put("maintenanceCount", maintenanceCount);
+        statistics.put("repairCount", repairCount);
+        statistics.put("orderCount", orderList.size());
+        
+        return statistics;
+    }
+    
+    /**
+     * 计算单个工单的处理时长(小时)
+     * 处理时长 = 复运时间restartTime – 故障发生时间(维修工单用occurTime,维保工单用createTime) – 挂起时长
+     * 挂起时长 = 恢复时间 - 挂起时间
+     * 
+     * @param order 工单信息
+     * @return 处理时长(小时)
+     */
+    private double calculateOrderProcessingHours(OrderScoreInfo order) {
+        // 只有存在复运时间的工单才进行统计计算
+        if (order.getRestartTime() == null) {
+            return 0;
+        }
+        
+        Date startTime = null;
+        if (order.getOrderType() == 1) { // 维修工单
+            startTime = order.getOccurTime();
+        } else if (order.getOrderType() == 2) { // 维保工单
+            startTime = order.getCreateTime();
+        }
+        
+        if (startTime == null) {
+            return 0;
+        }
+        
+        // 计算总挂起时长(毫秒)
+        long suspensionDuration = 0;
+        if (order.getOrderType() == 1) { // 维修工单
+            suspensionDuration = calculateRepairOrderSuspensionTime(order.getId());
+        } else if (order.getOrderType() == 2) { // 维保工单
+            suspensionDuration = calculateWorkOrderSuspensionTime(order.getId());
+        }
+        
+        // 计算处理时长 = (复运时间 - 开始时间 - 挂起时长) / 小时
+        long totalDuration = order.getRestartTime().getTime() - startTime.getTime();
+        long processingDuration = totalDuration - suspensionDuration;
+        
+        // 转换为小时
+        return processingDuration / (1000.0 * 60 * 60);
+    }
+    
+    /**
+     * 计算维修工单的挂起时长
+     * 维修工单挂起对应的actionType是approved,恢复对应的是resume
+     * 
+     * @param orderId 工单ID
+     * @return 挂起时长(毫秒)
+     */
+    private long calculateRepairOrderSuspensionTime(Long orderId) {
+        List<GxtRepairOrderFlow> flows = gxtRepairOrderFlowMapper.selectGxtRepairOrderFlowListByOrderId(orderId);
+        
+        long totalSuspensionTime = 0;
+        Date suspendTime = null;
+        
+        // 按时间顺序处理流转记录
+        flows.sort((f1, f2) -> f1.getActionTime().compareTo(f2.getActionTime()));
+        
+        for (GxtRepairOrderFlow flow : flows) {
+            if ("approved".equals(flow.getActionType())) {
+                // 挂起时间
+                suspendTime = flow.getActionTime();
+            } else if ("resume".equals(flow.getActionType()) && suspendTime != null) {
+                // 恢复时间
+                long suspensionDuration = flow.getActionTime().getTime() - suspendTime.getTime();
+                totalSuspensionTime += suspensionDuration;
+                suspendTime = null; // 重置挂起时间
+            }
+        }
+        
+        return totalSuspensionTime;
+    }
+    
+    /**
+     * 计算维保工单的挂起时长
+     * 维保工单挂起对应的actionType是approved,恢复对应的是restart
+     * 
+     * @param orderId 工单ID
+     * @return 挂起时长(毫秒)
+     */
+    private long calculateWorkOrderSuspensionTime(Long orderId) {
+        List<GxtWorkOrderFlow> flows = gxtWorkOrderFlowMapper.selectGxtWorkOrderFlowByOrderId(orderId);
+        
+        long totalSuspensionTime = 0;
+        Date suspendTime = null;
+        
+        // 按时间顺序处理流转记录
+        flows.sort((f1, f2) -> f1.getActionTime().compareTo(f2.getActionTime()));
+        
+        for (GxtWorkOrderFlow flow : flows) {
+            if ("approved".equals(flow.getActionType())) {
+                // 挂起时间
+                suspendTime = flow.getActionTime();
+            } else if ("restart".equals(flow.getActionType()) && suspendTime != null) {
+                // 恢复时间
+                long suspensionDuration = flow.getActionTime().getTime() - suspendTime.getTime();
+                totalSuspensionTime += suspensionDuration;
+                suspendTime = null; // 重置挂起时间
+            }
+        }
+        
+        return totalSuspensionTime;
+    }
+    
+    /**
+     * 计算工单详情中的各个时长(用于前端展示)
+     * 
+     * @param order 工单信息
+     */
+    public void calculateOrderTimeDetails(OrderScoreInfo order) {
+        // 下发时长 = 下发时间 - 故障发生时间(维修工单)或创建时间(维保工单)
+        if (order.getAssignTime() != null) {
+            Date startTime = null;
+            if (order.getOrderType() == 1) { // 维修工单
+                startTime = order.getOccurTime();
+            } else if (order.getOrderType() == 2) { // 维保工单
+                startTime = order.getCreateTime();
+            }
+            
+            if (startTime != null) {
+                long diffMillis = order.getAssignTime().getTime() - startTime.getTime();
+                order.setIssueHour(diffMillis / (1000.0 * 60 * 60));
+            }
+        }
+        
+        // 接单时长 = 接单时间 – 下发时间
+        if (order.getAcceptTime() != null && order.getAssignTime() != null) {
+            long diffMillis = order.getAcceptTime().getTime() - order.getAssignTime().getTime();
+            order.setAcceptHour(diffMillis / (1000.0 * 60 * 60));
+        }
+        
+        // 准备时长 = 开始打卡时间 – 接单时间
+        if (order.getRealStartTime() != null && order.getAcceptTime() != null) {
+            long diffMillis = order.getRealStartTime().getTime() - order.getAcceptTime().getTime();
+            order.setPrepareHour(diffMillis / (1000.0 * 60 * 60));
+        }
+        
+        // 工作时长 = 结束打卡时间 - 开始打卡时间
+        if (order.getRealEndTime() != null && order.getRealStartTime() != null) {
+            long diffMillis = order.getRealEndTime().getTime() - order.getRealStartTime().getTime();
+            order.setWorkHour(diffMillis / (1000.0 * 60 * 60));
+        }
+        
+        // 复运时长 = 复运时间 – 结束打卡时间
+        if (order.getRestartTime() != null && order.getRealEndTime() != null) {
+            long diffMillis = order.getRestartTime().getTime() - order.getRealEndTime().getTime();
+            order.setRestartHour(diffMillis / (1000.0 * 60 * 60));
+        }
+        
+        // 处理时长 = 复运时间 – 故障发生时间(维修工单)或创建时间(维保工单) – 挂起时长
+        double processingHours = calculateOrderProcessingHours(order);
+        order.setHandleHour(processingHours);
+        
+        // 挂起时长 = 恢复时间 - 挂起时间
+        long suspensionDuration = 0;
+        if (order.getOrderType() == 1) { // 维修工单
+            suspensionDuration = calculateRepairOrderSuspensionTime(order.getId());
+        } else if (order.getOrderType() == 2) { // 维保工单
+            suspensionDuration = calculateWorkOrderSuspensionTime(order.getId());
+        }
+        order.setSuspendHour(suspensionDuration / (1000.0 * 60 * 60));
+    }
+}

+ 230 - 0
ygtx-gxt/src/main/resources/mapper/gxt/GxtOrderHourMapper.xml

@@ -0,0 +1,230 @@
+<?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.ygtx.gxt.mapper.GxtOrderHourMapper">
+
+    <resultMap type="com.ygtx.gxt.domain.OrderScoreInfo" id="OrderScoreInfoResult">
+        <result property="orderType"    column="order_type"    />
+        <result property="id"    column="id"    />
+        <result property="workOrderProjectNo"    column="work_order_project_no"    />
+        <result property="workOrderStatus"    column="work_order_status"    />
+        <result property="gxtCenterId"    column="gxt_center_id"    />
+        <result property="gxtCenter"    column="gxt_center"    />
+        <result property="pcsStationId"    column="pcs_station_id"    />
+        <result property="pcsStationPid"    column="pcs_station_pid"    />
+        <result property="pcsStationName"    column="pcs_station_name"    />
+        <result property="pcsDeviceId"    column="pcs_device_id"    />
+        <result property="pcsDeviceName"    column="pcs_device_name"    />
+        <result property="brand"    column="brand"    />
+        <result property="model"    column="model"    />
+        <result property="assignTime"    column="assign_time"    />
+        <result property="assignUserId"    column="assign_user_id"    />
+        <result property="assignUserName"    column="assign_user_name"    />
+        <result property="acceptTime"    column="accept_time"    />
+        <result property="acceptUserId"    column="accept_user_id"    />
+        <result property="acceptUserName"    column="accept_user_name"    />
+        <result property="realStartTime"    column="real_start_time"    />
+        <result property="realEndTime"    column="real_end_time"    />
+        <result property="teamLeaderId"    column="team_leader_id"    />
+        <result property="teamLeaderName"    column="team_leader_name"    />
+        <result property="workGroupMemberId"    column="work_group_member_id"    />
+        <result property="workGroupMemberName"    column="work_group_member_name"    />
+        <result property="score"    column="score"    />
+        <result property="reviewContent"    column="review_content"    />
+        <result property="suspendReason"    column="suspend_reason"    />
+        <result property="restartTime"    column="restart_time"    />
+        <result property="priorityType"    column="priority_type"    />
+        <result property="workEndTime"    column="work_end_time"    />
+        <result property="scoringStatus"    column="scoring_status"    />
+        <result property="workSummary"    column="work_summary"    />
+        <result property="maintenanceType"    column="maintenance_type"    />
+        <result property="inspectionType"    column="inspection_type"    />
+        <!-- 新增字段映射 -->
+        <result property="planHour"    column="plan_hour"    />
+        <result property="faultCode"    column="fault_code"    />
+        <result property="faultDesc"    column="fault_desc"    />
+        <result property="occurTime"    column="occur_time"    />
+        <result property="suspendTime"    column="suspend_time"    />
+        <result property="pauseReason"    column="pause_reason"    />
+        <result property="pauseTime"    column="pause_time"    />
+        <result property="completeTime"    column="complete_time"    />
+        <result property="status"    column="status"    />
+        <result property="reviewScoreNum"    column="review_score_num"    />
+        <result property="finalCoefficient"    column="final_coefficient"    />
+        <result property="planStartTime" column="plan_start_time" />
+        <result property="planEndTime" column="plan_end_time" />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <select id="selectUnionOrderList" resultMap="OrderScoreInfoResult">
+        <bind name="orderTypeInt" value="orderType != null and orderType != '' ? orderType : null" />
+        SELECT * FROM (
+            SELECT
+                1 as order_type,
+                id as id,
+                work_order_project_no as work_order_project_no,
+                work_order_status as work_order_status,
+                gxt_center_id as gxt_center_id,
+                gxt_center as gxt_center,
+                pcs_station_id as pcs_station_id,
+                pcs_station_pid as pcs_station_pid,
+                pcs_station_name as pcs_station_name,
+                pcs_device_id as pcs_device_id,
+                pcs_device_name as pcs_device_name,
+                brand as brand,
+                model as model,
+                assign_time as assign_time,
+                assign_user_id as assign_user_id,
+                assign_user_name as assign_user_name,
+                accept_time as accept_time,
+                accept_user_id as accept_user_id,
+                accept_user_name as accept_user_name,
+                real_start_time as real_start_time,
+                real_end_time as real_end_time,
+                team_leader_id as team_leader_id,
+                team_leader_name as team_leader_name,
+                work_group_member_id as work_group_member_id,
+                work_group_member_name as work_group_member_name,
+                score as score,
+                review_content as review_content,
+                suspend_reason as suspend_reason,
+                restart_time as restart_time,
+                priority_type as priority_type,
+                real_end_time as work_end_time,
+                scoring_status as scoring_status,
+                content as work_summary,
+                maintenance_type as maintenance_type,
+                null as inspection_type,
+                null as plan_start_time,
+                null as plan_end_time,
+                plan_hour as plan_hour,
+                fault_code as fault_code,
+                fault_desc as fault_desc,
+                occur_time as occur_time,
+                null as suspend_time,
+                null as pause_reason,
+                null as pause_time,
+                null as complete_time,
+                review_score_num as review_score_num,
+                final_coefficient as final_coefficient,
+                create_time as create_time,
+                update_time as update_time
+            FROM gxt_repair_order t
+            <where>
+                <if test="repairOrder != null">
+                    <if test="keyword != null and keyword != ''">
+                        AND (work_order_project_no LIKE CONCAT('%', #{keyword}, '%') OR pcs_device_name LIKE CONCAT('%', #{keyword}, '%'))
+                    </if>
+                    <if test="repairOrder.workOrderProjectNo != null and repairOrder.workOrderProjectNo != ''"> and work_order_project_no = #{repairOrder.workOrderProjectNo}</if>
+                    <if test="repairOrder.workOrderStatus != null and repairOrder.workOrderStatus != ''"> and work_order_status = #{repairOrder.workOrderStatus}</if>
+                    <if test="repairOrder.gxtCenterId != null"> and gxt_center_id = #{repairOrder.gxtCenterId}</if>
+                    <if test="repairOrder.gxtCenter != null and repairOrder.gxtCenter != ''"> and gxt_center = #{repairOrder.gxtCenter}</if>
+                    <if test="repairOrder.pcsStationId != null"> and pcs_station_id = #{repairOrder.pcsStationId}</if>
+                    <if test="repairOrder.pcsStationName != null and repairOrder.pcsStationName != ''"> and pcs_station_name = #{repairOrder.pcsStationName}</if>
+                    <if test="repairOrder.pcsDeviceId != null"> and pcs_device_id = #{repairOrder.pcsDeviceId}</if>
+                    <if test="repairOrder.pcsDeviceName != null and repairOrder.pcsDeviceName != ''"> and pcs_device_name like concat('%', #{repairOrder.pcsDeviceName}, '%')</if>
+                    <if test="repairOrder.teamLeaderName != null and repairOrder.teamLeaderName != ''"> and team_leader_name like concat('%', #{repairOrder.teamLeaderName}, '%')</if>
+                    <if test="repairOrder.scoringStatus != null"> and scoring_status = #{repairOrder.scoringStatus}</if>
+                </if>
+                and NULLIF(scoring_status, '') IS NOT NULL
+                <!-- 业务特定数据权限过滤条件 -->
+                <if test="repairOrder != null and repairOrder.params.businessDataScope != null and repairOrder.params.businessDataScope != ''">
+                    ${repairOrder.params.businessDataScope}
+                </if>
+            </where>
+
+            UNION ALL
+
+            SELECT
+                2 as order_type,
+                id as id,
+                work_order_project_no as work_order_project_no,
+                work_order_status as work_order_status,
+                gxt_center_id as gxt_center_id,
+                gxt_center as gxt_center,
+                pcs_station_id as pcs_station_id,
+                pcs_station_pid as pcs_station_pid,
+                pcs_station_name as pcs_station_name,
+                pcs_device_id as pcs_device_id,
+                pcs_device_name as pcs_device_name,
+                brand as brand,
+                model as model,
+                assign_time as assign_time,
+                assign_user_id as assign_user_id,
+                assign_user_name as assign_user_name,
+                accept_time as accept_time,
+                accept_user_id as accept_user_id,
+                accept_user_name as accept_user_name,
+                real_start_time as real_start_time,
+                real_end_time as real_end_time,
+                team_leader_id as team_leader_id,
+                team_leader_name as team_leader_name,
+                work_group_member_id as work_group_member_id,
+                work_group_member_name as work_group_member_name,
+                score as score,
+                review_content as review_content,
+                suspend_reason as suspend_reason,
+                restart_time as restart_time,
+                priority_type as priority_type,
+                real_end_time as work_end_time,
+                scoring_status as scoring_status,
+                real_content as work_summary,
+                null as maintenance_type,
+                inspection_type as inspection_type,
+                plan_start_time as plan_start_time,
+                plan_end_time as plan_end_time,
+                plan_hour as plan_hour,
+                fault_code as fault_code,
+                fault_desc as fault_desc,
+                null as occur_time,
+                suspend_time as suspend_time,
+                pause_reason as pause_reason,
+                pause_time as pause_time,
+                complete_time as complete_time,
+                review_score_num as review_score_num,
+                final_coefficient as final_coefficient,
+                create_time as create_time,
+                update_time as update_time
+            FROM gxt_work_order t
+            <where>
+                <if test="workOrder != null">
+                    <if test="keyword != null and keyword != ''">
+                        AND (work_order_project_no LIKE CONCAT('%', #{keyword}, '%') OR pcs_device_name LIKE CONCAT('%', #{keyword}, '%'))
+                    </if>
+                    <if test="workOrder.workOrderProjectNo != null and workOrder.workOrderProjectNo != ''"> and work_order_project_no = #{workOrder.workOrderProjectNo}</if>
+                    <if test="workOrder.workOrderStatus != null and workOrder.workOrderStatus != ''"> and work_order_status = #{workOrder.workOrderStatus}</if>
+                    <if test="workOrder.gxtCenterId != null"> and gxt_center_id = #{workOrder.gxtCenterId}</if>
+                    <if test="workOrder.gxtCenter != null and workOrder.gxtCenter != ''"> and gxt_center = #{workOrder.gxtCenter}</if>
+                    <if test="workOrder.pcsStationId != null"> and pcs_station_id = #{workOrder.pcsStationId}</if>
+                    <if test="workOrder.pcsStationName != null and workOrder.pcsStationName != ''"> and pcs_station_name = #{workOrder.pcsStationName}</if>
+                    <if test="workOrder.pcsDeviceId != null"> and pcs_device_id = #{workOrder.pcsDeviceId}</if>
+                    <if test="workOrder.pcsDeviceName != null and workOrder.pcsDeviceName != ''"> and pcs_device_name like concat('%', #{workOrder.pcsDeviceName}, '%')</if>
+                    <if test="workOrder.teamLeaderName != null and workOrder.teamLeaderName != ''"> and team_leader_name like concat('%', #{workOrder.teamLeaderName}, '%')</if>
+                    <if test="workOrder.scoringStatus != null"> and scoring_status = #{workOrder.scoringStatus}</if>
+                </if>
+                and NULLIF(scoring_status, '') IS NOT NULL
+                <!-- 业务特定数据权限过滤条件 -->
+                <if test="workOrder != null and workOrder.params.businessDataScope != null and workOrder.params.businessDataScope != ''">
+                    ${workOrder.params.businessDataScope}
+                </if>
+            </where>
+        ) t
+        <where>
+            <!-- 根据工单类型筛选 -->
+            <if test="orderTypeInt != null">
+                <choose>
+                    <when test="orderTypeInt == '1'">
+                        and order_type = 1
+                    </when>
+                    <when test="orderTypeInt == '2'">
+                        and order_type = 2
+                    </when>
+                </choose>
+            </if>
+        </where>
+        ORDER BY create_time DESC
+    </select>
+
+</mapper>