DockerMonitorServiceMapper.xml 3.1 KB
<?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.monitor.mysql.mapper.DockerMonitorServiceMapper" >
    <resultMap id="BaseResultMap" type="com.model.DockerMonitorServiceModel" >
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="servicename" property="serviceName" jdbcType="VARCHAR" />
        <result column="namespace" property="namespace" jdbcType="VARCHAR" />
        <result column="clusterid" property="clusterId" jdbcType="VARCHAR" />
        <result column="monitor_flag" property="monitorFlag" jdbcType="VARCHAR" />
        <result column="descr" property="descr" jdbcType="VARCHAR" />
    </resultMap>

    <sql id="Base_Column_List" >
        id,servicename,namespace,clusterid,monitor_flag,descr
    </sql>


    <update id="updateMonitorFlagByCluster" >
        update docker_monitor_service
        set  monitor_flag = #{monitorFlag}
        where clusterid = #{clusterId}
    </update>

    <update id="updateMonitorFlagById" >
        update docker_monitor_service
        set  monitor_flag = #{monitorFlag}
        where id = #{id}
    </update>

    <select id="selectAllMonitor"  resultMap="BaseResultMap">
        select * from docker_monitor_service
        where  monitor_flag = '1'
    </select>

    <select id="selectCountByCodition"  resultType="java.lang.Integer">
        select
        count(1)
        from docker_monitor_service
        where  1=1
        <if test="params.clusterId != null &amp;&amp; params.clusterId != ''" >
            and  clusterid = #{params.clusterId}
        </if>
    </select>

    <select id="selectDockerServiceByCodition"   resultMap="BaseResultMap">
        select *  from docker_monitor_service
        where   1=1
        <if test="params.clusterId != null &amp;&amp; params.clusterId != ''" >
            and  clusterid = #{params.clusterId}
        </if>
        order by clusterid
        limit #{startIndex},#{pageSize}
    </select>

    <select id="selectDockerServiceByClusterId"   resultMap="BaseResultMap">
        select *  from docker_monitor_service
        where   clusterid = #{clusterId}
    </select>


    <delete id="deleteAll">
        delete from docker_monitor_service
    </delete>

    <delete id="deleteById" parameterType="java.lang.Integer" >
        delete from docker_monitor_service
        where id = #{id,jdbcType=INTEGER}
    </delete>

    <delete id="deleteExcludeCluster">
        delete from docker_monitor_service
        where  clusterid not in
        <foreach item="clsid" index="index" collection="includeClusterList" open="("
                        separator=" , " close=")">
          #{clsid}
       </foreach>
    </delete>

    <insert id="insert" parameterType="com.model.DockerMonitorServiceModel" >
        insert into docker_monitor_service (servicename,namespace,clusterid,monitor_flag,descr)
        values ( #{serviceName,jdbcType=VARCHAR}, #{namespace,jdbcType=VARCHAR},
        #{clusterId,jdbcType=VARCHAR}, #{monitorFlag,jdbcType=VARCHAR}, #{descr,jdbcType=VARCHAR})
    </insert>


</mapper>