<?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.rtu.data.mapper.RtuDataRiverMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="rtuRiverDataEntityResultMap" type="org.springblade.modules.business.rtu.data.entity.RtuDataRiverEntity">
        <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="rtu_code" property="rtuCode"/>
        <result column="tm" property="tm"/>
        <result column="z" property="z"/>
    </resultMap>


    <resultMap id="rtuRiverDataVOResultMap" type="org.springblade.modules.business.rtu.data.vo.RtuDataRiverVO">
        <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="rtu_code" property="rtuCode"/>
        <result column="tm" property="tm"/>
        <result column="z" property="z"/>
    </resultMap>

    <select id="selectPage" resultMap="rtuRiverDataVOResultMap">
        SELECT
        n.*,
        p.rtu_name
        FROM
        data_att_st_waco_ware_cache n
        LEFT JOIN  rtu_info p ON n.rtu_code = p.rtu_code
        WHERE
        n.is_deleted = 0
        <if test="riverDTO.rtuName!=null ">
            and p.rtu_name LIKE concat(concat('%', #{riverDTO.rtuName}), '%')
        </if>
        <if test="riverDTO.orgId!=null ">
            and p.org_id = #{riverDTO.orgId}
        </if>
        <if test="riverDTO.projectId!=null ">
            and p.project_id = #{riverDTO.projectId}
        </if>
    </select>
</mapper>
