mappers.InlongClusterNodeEntityMapper.xml Maven / Gradle / Ivy
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.apache.inlong.manager.dao.mapper.InlongClusterNodeEntityMapper"> <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> <id column="id" jdbcType="INTEGER" property="id"/> <result column="parent_id" jdbcType="INTEGER" property="parentId"/> <result column="type" jdbcType="VARCHAR" property="type"/> <result column="ip" jdbcType="VARCHAR" property="ip"/> <result column="port" jdbcType="INTEGER" property="port"/> <result column="username" jdbcType="VARCHAR" property="username"/> <result column="password" jdbcType="VARCHAR" property="password"/> <result column="ssh_port" jdbcType="INTEGER" property="sshPort"/> <result column="protocol_type" jdbcType="VARCHAR" property="protocolType"/> <result column="node_load" jdbcType="INTEGER" property="nodeLoad"/> <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/> <result column="description" jdbcType="VARCHAR" property="description"/> <result column="status" jdbcType="INTEGER" property="status"/> <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/> <result column="creator" jdbcType="VARCHAR" property="creator"/> <result column="modifier" jdbcType="VARCHAR" property="modifier"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/> <result column="version" jdbcType="INTEGER" property="version"/> </resultMap> <sql id="Base_Column_List"> id, parent_id, type, ip, port, username, password, ssh_port, protocol_type, node_load, ext_params, description, status, is_deleted, creator, modifier, create_time, modify_time, version </sql> <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> insert into inlong_cluster_node (id, parent_id, type, ip, port, username, password, ssh_port, protocol_type, node_load, ext_params, description, status, creator, modifier) values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{sshPort,jdbcType=INTEGER}, #{protocolType,jdbcType=VARCHAR}, #{nodeLoad,jdbcType=INTEGER}, #{extParams,jdbcType=LONGVARCHAR}, #{description, jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}) </insert> <insert id="insertOnDuplicateKeyUpdate" useGeneratedKeys="true" keyProperty="id" parameterType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> insert into inlong_cluster_node (id, parent_id, type, ip, port, username, password, ssh_port, protocol_type, node_load, ext_params, status, creator, modifier) values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{sshPort,jdbcType=INTEGER}, #{protocolType,jdbcType=VARCHAR}, #{nodeLoad,jdbcType=INTEGER}, #{extParams,jdbcType=LONGVARCHAR}, #{status,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}) ON DUPLICATE KEY UPDATE node_load = VALUES(node_load), ext_params = VALUES(ext_params), status = VALUES(status), modifier = VALUES(modifier) </insert> <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from inlong_cluster_node where is_deleted = 0 and id = #{id,jdbcType=INTEGER} </select> <select id="selectByUniqueKey" parameterType="org.apache.inlong.manager.pojo.cluster.ClusterRequest" resultType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> select <include refid="Base_Column_List"/> from inlong_cluster_node where is_deleted = 0 and parent_id = #{parentId,jdbcType=INTEGER} and type = #{type, jdbcType=VARCHAR} and ip = #{ip, jdbcType=VARCHAR} <if test="port != null and port != ''"> and port = #{port, jdbcType=INTEGER} </if> <if test="port == null or port == ''"> and port is null </if> <if test="protocolType != null and protocolType != ''"> and protocol_type = #{protocolType, jdbcType=VARCHAR} </if> </select> <select id="selectByCondition" parameterType="org.apache.inlong.manager.pojo.cluster.ClusterPageRequest" resultType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> select <include refid="Base_Column_List"/> from inlong_cluster_node <where> is_deleted = 0 <if test="type != null and type != ''"> and type = #{type, jdbcType=VARCHAR} </if> <if test="parentId != null and parentId != ''"> and parent_id = #{parentId, jdbcType=INTEGER} </if> <if test="protocolType != null and protocolType != ''"> and protocol_type = #{protocolType, jdbcType=VARCHAR} </if> <if test="keyword != null and keyword != ''"> and ( ip like CONCAT('%', #{keyword}, '%') or port like CONCAT('%', #{keyword}, '%') ) </if> </where> order by modify_time desc </select> <select id="selectByParentId" resultType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> select <include refid="Base_Column_List"/> from inlong_cluster_node <where> is_deleted = 0 and parent_id = #{parentId, jdbcType=INTEGER} <if test="protocolType != null and protocolType != ''"> and protocol_type = #{protocolType, jdbcType=VARCHAR} </if> </where> </select> <select id="selectByIpAndType" resultType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> select <include refid="Base_Column_List"/> from inlong_cluster_node where is_deleted = 0 <if test="type != null and type != ''"> and type = #{type, jdbcType=VARCHAR} </if> and ip = #{ip, jdbcType=VARCHAR} </select> <select id="selectByParentIdAndIp" resultType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> select <include refid="Base_Column_List"/> from inlong_cluster_node where is_deleted = 0 and parent_id = #{parentId, jdbcType=INTEGER} and ip = #{ip, jdbcType=VARCHAR} </select> <update id="updateById" parameterType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> update inlong_cluster_node set parent_id = #{parentId,jdbcType=INTEGER}, type = #{type,jdbcType=VARCHAR}, ip = #{ip,jdbcType=VARCHAR}, port = #{port,jdbcType=INTEGER}, username = #{username,jdbcType=VARCHAR}, password = #{password,jdbcType=VARCHAR}, ssh_port = #{sshPort,jdbcType=INTEGER}, protocol_type = #{protocolType,jdbcType=VARCHAR}, node_load = #{nodeLoad,jdbcType=INTEGER}, ext_params = #{extParams,jdbcType=LONGVARCHAR}, description = #{description,jdbcType=VARCHAR}, status = #{status,jdbcType=INTEGER}, is_deleted = #{isDeleted,jdbcType=INTEGER}, modifier = #{modifier,jdbcType=VARCHAR}, version = #{version,jdbcType=INTEGER} + 1 where id = #{id,jdbcType=INTEGER} and version = #{version,jdbcType=INTEGER} </update> <update id="updateByIdSelective" parameterType="org.apache.inlong.manager.dao.entity.InlongClusterNodeEntity"> update inlong_cluster_node <set> <if test="parentId != null"> parent_id = #{parentId,jdbcType=INTEGER}, </if> <if test="type != null"> type = #{type,jdbcType=VARCHAR}, </if> <if test="ip != null"> ip = #{ip,jdbcType=VARCHAR}, </if> <if test="port != null"> port = #{port,jdbcType=INTEGER}, </if> <if test="username != null"> username = #{username,jdbcType=VARCHAR}, </if> <if test="password != null"> password = #{password,jdbcType=VARCHAR}, </if> <if test="sshPort != null"> ssh_port = #{sshPort,jdbcType=INTEGER}, </if> <if test="protocolType != null"> protocol_type = #{protocolType,jdbcType=VARCHAR}, </if> <if test="nodeLoad != null"> node_load = #{nodeLoad,jdbcType=INTEGER}, </if> <if test="extParams != null"> ext_params = #{extParams,jdbcType=LONGVARCHAR}, </if> <if test="description != null"> description = #{description,jdbcType=VARCHAR}, </if> <if test="status != null"> status = #{status,jdbcType=INTEGER}, </if> <if test="isDeleted != null"> is_deleted = #{isDeleted,jdbcType=INTEGER}, </if> <if test="modifier != null"> modifier = #{modifier,jdbcType=VARCHAR}, </if> version = #{version,jdbcType=INTEGER} + 1 </set> where id = #{id,jdbcType=INTEGER} and version = #{version,jdbcType=INTEGER} </update> <update id="updateStatus"> update inlong_cluster_node <set> <if test="nextStatus != null"> status = #{nextStatus,jdbcType=INTEGER} </if> </set> <where> is_deleted = 0 <if test="status != null"> and status = #{status,jdbcType=INTEGER} </if> <if test="id != null"> and id = #{id,jdbcType=INTEGER} </if> </where> </update> <delete id="deleteById" parameterType="java.lang.Integer"> delete from inlong_cluster_node where id = #{id,jdbcType=INTEGER} </delete> </mapper>