<?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.inspect.exec.mapper.EqpBookChannelMapper">
    
    <resultMap type="EqpBookChannel" id="EqpBookChannelResult">
        <result property="channelId"    column="channel_id"    />
        <result property="channelCode"    column="channel_code"    />
        <result property="channelName"    column="channel_name"    />
        <result property="parentChannelId"    column="parent_channel_id"    />
        <result property="eqpBookId"    column="eqp_book_id"    />
        <result property="channelType"    column="channel_type"    />
        <result property="onlineState"    column="online_state"    />
        <result property="channelContent"    column="channel_content"    />
        <result property="provider"    column="provider"    />
        <result property="address"    column="address"    />
        <result property="host"    column="host"    />
        <result property="port"    column="port"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="deleteFlag"    column="delete_flag"    />
        <result property="patrolDeviceCode"    column="patrol_device_code"    />
        <result property="username"    column="username"    />
        <result property="password"    column="password"    />
    </resultMap>

    <sql id="selectBasedataEqpBookChannelVo">
        select channel_id, channel_code, channel_name, parent_channel_id, eqp_book_id, channel_type, online_state, channel_content, provider, address, host, port, create_by, create_time, update_by, update_time, delete_flag, patrol_device_code, username, password from basedata_eqpbook_channel
    </sql>

    <select id="selectBasedataEqpBookChannelList" parameterType="EqpBookChannel" resultMap="EqpBookChannelResult">
        <include refid="selectBasedataEqpBookChannelVo"/>
        <where>  
            <if test="channelCode != null  and channelCode != ''"> and channel_code = #{channelCode}</if>
            <if test="channelName != null  and channelName != ''"> and channel_name like concat('%', #{channelName}, '%')</if>
            <if test="parentChannelId != null  and parentChannelId != ''"> and parent_channel_id = #{parentChannelId}</if>
            <if test="eqpBookId != null"> and eqp_book_id = #{eqpBookId}</if>
            <if test="channelType != null  and channelType != ''"> and channel_type = #{channelType}</if>
            <if test="onlineState != null  and onlineState != ''"> and online_state = #{onlineState}</if>
            <if test="channelContent != null  and channelContent != ''"> and channel_content = #{channelContent}</if>
            <if test="provider != null  and provider != ''"> and provider = #{provider}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="host != null  and host != ''"> and host = #{host}</if>
            <if test="port != null  and port != ''"> and port = #{port}</if>
            <if test="patrolDeviceCode != null  and patrolDeviceCode != ''"> and patrol_device_code = #{patrolDeviceCode}</if>
            <if test="username != null  and username != ''"> and username = #{username}</if>
            <if test="password != null  and password != ''"> and password = #{password}</if>
        </where>
    </select>

</mapper>