<?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="org.springblade.modules.business.check.process.mapper.RtuOrderProcessMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="orderProcessInfoResultMap"
               type="org.springblade.modules.business.check.process.entity.OrderProcessInfoEntity">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>

        <result column="order_id" property="orderId"/>
        <result column="process_desc" property="processDesc"/>
        <result column="order_status_key" property="orderStatusKey"/>

        <result column="rtu_replace" property="rtuReplace"/>
        <result column="rtu_desc" property="rtuDesc"/>
        <result column="rtu_status" property="rtuStatus"/>

        <result column="rain_sensor_replace" property="rainSensorReplace"/>
        <result column="rain_sensor_desc" property="rainSensorDesc"/>
        <result column="rain_sensor_status" property="rainSensorStatus"/>
        <result column="rain_sensor_active" property="rainSensorActive"/>

        <result column="water_sensor_replace" property="waterSensorReplace"/>
        <result column="water_sensor_desc" property="waterSensorDesc"/>
        <result column="water_level_sensor_status" property="waterLevelSensorStatus"/>
        <result column="water_level_sensor_active" property="waterLevelSensorActive"/>

        <result column="ground_sensor_replace_date" property="groundSensorReplace"/>
        <result column="ground_sensor_desc" property="groundSensorDesc"/>
        <result column="ground_water_sensor_status" property="groundWaterSensorStatus"/>
        <result column="ground_water_sensor_active" property="groundWaterSensorActive"/>

        <result column="battery_replace" property="batteryReplace"/>
        <result column="sun_power_replace" property="sunPowerReplace"/>
        <result column="power_desc" property="powerDesc"/>
        <result column="power_status" property="powerStatus"/>

        <result column="network_overdue" property="networkOverdue"/>
        <result column="network_desc" property="networkDesc"/>
        <result column="network_status" property="networkStatus"/>
        <result column="network_active" property="networkActive"/>

        <result column="satellite_desc" property="satelliteDesc"/>
        <result column="satellite_status" property="satelliteStatus"/>
        <result column="satellite_active" property="satelliteActive"/>


        <result column="base_photo1_take" property="basePhoto1Take"/>
        <result column="base_photo1_url" property="basePhoto1Url"/>
        <result column="base_photo2_take" property="basePhoto2Take"/>
        <result column="base_photo2_url" property="basePhoto2Url"/>
        <result column="rtu_photo_take" property="rtuPhotoTake"/>
        <result column="rtu_photo_url" property="rtuPhotoUrl"/>
        <result column="rain_sensor_photo_take" property="rainSensorPhotoTake"/>
        <result column="rain_sensor_photo_url" property="rainSensorPhotoUrl"/>
        <result column="water_sensor_photo_take" property="waterSensorPhotoTake"/>
        <result column="water_sensor_photo_url" property="waterSensorPhotoUrl"/>
        <result column="ground_sensor_photo_take" property="groundSensorPhotoTake"/>
        <result column="ground_sensor_photo_url" property="groundSensorPhotoUrl"/>
        <result column="battery_photo_take" property="batteryPhotoTake"/>
        <result column="battery_photo_url" property="batteryPhotoUrl"/>
        <result column="sun_photo_take" property="sunPhotoTake"/>
        <result column="sun_photo_url" property="sunPhotoUrl"/>

    </resultMap>


    <select id="selectPage" resultMap="orderProcessInfoResultMap">
        SELECT
        p.*
        FROM
        rtu_failure_check_order_process p
        WHERE
        p.is_deleted = 0
        <if test="checkOrderInfoDTO.id!=null">
            and p.order_id =#{checkOrderInfoDTO.id}
        </if>

        order by p.create_time desc

    </select>

</mapper>
