<?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.dlink.mapper.ClusterConfigurationMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dlink.model.ClusterConfiguration">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="alias" property="alias" />
        <result column="type" property="type" />
        <result column="config_json" property="configJson" />
        <result column="is_available" property="isAvailable" />
        <result column="note" property="note" />
        <result column="enabled" property="enabled" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, alias, type,config_json,is_available,note, enabled, create_time, update_time
    </sql>


    <select id="selectForProTable" resultType="com.dlink.model.ClusterConfiguration">
        select
        a.*
        from
        dlink_cluster_configuration a
        <where>
            1=1
            <if test='param.name!=null and param.name!=""'>
                and a.name like "%${param.name}%"
            </if>
            <if test='param.alias!=null and param.alias!=""'>
                and a.alias like "%${param.alias}%"
            </if>
            <if test='param.createTime!=null and param.createTime!=""'>
                and a.create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
            </if>
            <if test='param.updateTime!=null and param.updateTime!=""'>
                and a.update_time <![CDATA[>=]]> str_to_date( #{param.updateTime},'%Y-%m-%d %H:%i:%s')
            </if>
            <if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
                and
            </if>
            <if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
                ${ew.sqlSegment}
            </if>
        </where>
    </select>
</mapper>
