2026-05-30 8e52d3e600ff49869cc612fd9bf1cc64ac304f50
src/main/resources/mapper/device/DeviceMaintenanceMapper.xml
@@ -8,6 +8,7 @@
    <select id="queryPage" resultType="com.ruoyi.device.dto.DeviceMaintenanceDto">
        select dm.id,
        dm.device_ledger_id,
        dm.area_id,
        dm.maintenance_plan_time,
        dm.maintenance_actually_time,
        dm.maintenance_result,
@@ -19,13 +20,15 @@
        dm.tenant_id,
        dm.maintenance_actually_name,
        dl.device_name,
        dm.machinery_category,
        dl.device_model,
        da.area_name,
        su.nick_name as create_user_name
        from device_maintenance dm
        left join device_ledger dl on dm.device_ledger_id = dl.id
        left join device_area da on dl.area_id = da.id
        left join sys_user su on dm.create_user = su.user_id
        <where>
            1 = 1
            <if test="deviceMaintenanceDto.deviceName != null">
                and dl.device_name like concat('%',#{deviceMaintenanceDto.deviceName},'%')
            </if>
@@ -38,17 +41,26 @@
            <if test="deviceMaintenanceDto.maintenanceActuallyName != null">
                and dm.maintenance_actually_name like concat('%',#{deviceMaintenanceDto.maintenanceActuallyName},'%')
            </if>
            <if test="deviceMaintenanceDto.maintenancePlanTimeReq != null">
                and dm.maintenance_plan_time like concat('%',#{deviceMaintenanceDto.maintenancePlanTimeReq},'%')
            <if test="deviceMaintenanceDto.maintenancePlanTime != null">
                and dm.maintenance_plan_time like concat('%',#{deviceMaintenanceDto.maintenancePlanTime},'%')
            </if>
            <if test="deviceMaintenanceDto.maintenanceActuallyTimeReq != null">
                and dm.maintenance_actually_time like concat('%',#{deviceMaintenanceDto.maintenanceActuallyTimeReq},'%')
            <if test="deviceMaintenanceDto.maintenanceActuallyTime != null">
                and dm.maintenance_actually_time like concat('%',#{deviceMaintenanceDto.maintenanceActuallyTime},'%')
            </if>
            <if test="deviceMaintenanceDto.maintenanceActuallyTime != null">
                and dm.maintenance_actually_time >= str_to_date(#{deviceMaintenanceDto.maintenanceActuallyTime}, '%Y-%m-%d')
                and dm.maintenance_actually_time &lt; date_add(str_to_date(#{deviceMaintenanceDto.maintenanceActuallyTime}, '%Y-%m-%d'), interval 1 day)
            </if>
            <if test="deviceMaintenanceDto.areaId != null">
                and dm.area_id = #{deviceMaintenanceDto.areaId}
            </if>
        </where>
        order by dm.create_time desc
    </select>
    <select id="detailById" resultType="com.ruoyi.device.dto.DeviceMaintenanceDto">
    <select id="detailById" resultType="com.ruoyi.device.vo.DeviceMaintenanceVo">
        select dm.id,
               dm.device_ledger_id,
               dm.area_id,
               dm.maintenance_plan_time,
               dm.maintenance_actually_time,
               dm.maintenance_result,
@@ -58,12 +70,15 @@
               dm.create_user,
               dm.update_user,
               dm.tenant_id,
               dm.machinery_category,
               dm.maintenance_actually_name,
               dl.device_name,
               dl.device_model,
               da.area_name,
               su.user_name as create_user_name
        from device_maintenance dm
                 left join device_ledger dl on dm.device_ledger_id = dl.id
                 left join device_area da on dl.area_id = da.id
                 left join sys_user su on dm.create_user = su.user_id
        where dm.id = #{id}
    </select>