<?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.ktg.iscs.mapper.IsMotorMapper">

    <select id="getIsMotorPage" resultType="com.ktg.iscs.domain.IsMotor">
        select
        m.*, i.point_name
        from is_motor m left join is_isolation_point i on i.point_id = m.point_id
        <where>
            <if test="isMotor.motorName != null and isMotor.motorName != ''">
                and m.motor_name like concat('%',#{isMotor.motorName},'%')
            </if>
            <if test="isMotor.pointId != null">
                and m.point_id = #{isMotor.pointId}
            </if>
        </where>
        order by m.motor_id desc
    </select>
</mapper>
