lyh
2025-04-03 34767d1efb3589591db535110e72310b21f863b5
修改sql
已修改3个文件
69 ■■■■■ 文件已修改
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamMaintenanceStandard.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamMaintenanceStandardMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java
@@ -2,7 +2,6 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@@ -50,19 +49,10 @@
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    /**删除标记*/
    @Excel(name = "删除标记", width = 15)
    @ApiModelProperty(value = "删除标记")
    @TableLogic
    private Integer delFlag;
    /**工单ID*/
    @Excel(name = "工单ID", width = 15)
    @ApiModelProperty(value = "工单ID")
    private String orderId;
    /**点检项ID*/
    @Excel(name = "点检项ID", width = 15)
    @ApiModelProperty(value = "点检项ID")
    private String itemId;
    /**点检结果*/
    @Excel(name = "点检结果", width = 15)
    @ApiModelProperty(value = "点检结果-正常-异常")
@@ -72,8 +62,17 @@
    @ApiModelProperty(value = "异常描述")
    private String exceptionDescription;
    /**异常是否保修*/
    @Excel(name = "异常是否保修", width = 15)
    @ApiModelProperty(value = "异常是否保修")
    private String whetherWarranty;
    @Excel(name = "异常是否报修", width = 15)
    @ApiModelProperty(value = "异常是否报修")
    private String reportFlag;
    /**保养项序号*/
    @ApiModelProperty(value = "保养项序号")
    private Integer itemCode;
    /**保养项*/
    @ApiModelProperty(value = "保养项")
    private String itemName;
    /**保养要求*/
    @ApiModelProperty(value = "保养要求")
    private String itemDemand;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamMaintenanceStandard.java
@@ -26,7 +26,7 @@
@Accessors(chain = true)
@ApiModel(value="eam_maintenance_standard对象", description="保养标准")
public class EamMaintenanceStandard implements Serializable {
    /**主键*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
@@ -87,4 +87,8 @@
     */
    @ApiModelProperty(value = "最新生成工单时间")
    private Date lastGenerateTime;
    /**设备编号*/
    private transient String equipmentText;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamMaintenanceStandardMapper.xml
@@ -4,27 +4,31 @@
    <select id="queryListBykeywordAndCategory" resultType="org.jeecg.modules.eam.entity.EamMaintenanceStandard">
        SELECT
            m.*
            e.equipment_code+ '[' + e.equipment_name+ ']' AS 'equipmentText',
            m.id,
            m.standard_code,
            m.standard_name,
            m.maintenance_period,
            m.equipment_id
        FROM
            eam_maintenance_standard m
            eam_maintenance_standard m -- 先过滤设备表,减少 JOIN 量
                INNER JOIN (
                SELECT
                    id,
                    eam_equipment.equipment_code as equipment_code,
                    eam_equipment.equipment_name as equipment_name,
                    org_id
                FROM
                    eam_equipment
                WHERE
                    del_flag = 0
                  AND ( equipment_code LIKE CONCAT ( #{ keyword }, '%' ) -- 右模糊利用索引
                    OR equipment_name LIKE CONCAT ( #{ keyword }, '%' ) )
            ) e ON m.equipment_id = e.id
        WHERE
            m.del_flag = 0
          AND m.standard_status= 'NORMAL'
          AND m.maintenance_category = #{maintenanceCategory}
          AND EXISTS (
            SELECT 1
            FROM
                eam_equipment e
                    INNER JOIN mdc_user_production t
                               ON t.user_id = #{userId}
                                   AND t.pro_id = e.org_id  -- 关联条件移到JOIN中
            WHERE
                e.id = m.equipment_id
              AND e.del_flag = 0
              AND (
                e.equipment_code LIKE CONCAT('%', #{keyword}, '%')
                    OR e.equipment_name LIKE CONCAT('%', #{keyword}, '%')
                )
        )
          AND EXISTS ( SELECT 1 FROM mdc_user_production t WHERE t.user_id = #{ userId } AND t.pro_id = e.org_id );
    </select>
</mapper>