All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mappers.DataNodeEntityMapper.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.DataNodeEntityMapper">
    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.DataNodeEntity">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="display_name" jdbcType="VARCHAR" property="displayName"/>
        <result column="type" jdbcType="VARCHAR" property="type"/>
        <result column="url" jdbcType="VARCHAR" property="url"/>
        <result column="username" jdbcType="VARCHAR" property="username"/>
        <result column="token" jdbcType="VARCHAR" property="token"/>
        <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/>
        <result column="description" jdbcType="VARCHAR" property="description"/>
        <result column="tenant" jdbcType="VARCHAR" property="tenant"/>
        <result column="in_charges" jdbcType="VARCHAR" property="inCharges"/>
        <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, name, display_name, type, url, username, token, ext_params, description, tenant, in_charges,
        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.DataNodeEntity">
        insert into data_node (id, name, display_name,
                               type, url, username,
                               token, ext_params, description,
                               tenant, in_charges, status,
                               creator, modifier)
        values (#{id, jdbcType=INTEGER}, #{name, jdbcType=VARCHAR}, #{displayName,jdbcType=VARCHAR},
                #{type, jdbcType=VARCHAR}, #{url, jdbcType=VARCHAR}, #{username, jdbcType=VARCHAR},
                #{token, jdbcType=VARCHAR}, #{extParams,jdbcType=LONGVARCHAR}, #{description, jdbcType=VARCHAR},
                #{tenant, jdbcType=VARCHAR}, #{inCharges, jdbcType=VARCHAR}, #{status, jdbcType=INTEGER},
                #{creator, jdbcType=VARCHAR}, #{modifier, jdbcType=VARCHAR})
    </insert>

    <select id="selectById" resultMap="BaseResultMap">
        <bind name="_isInlongService" value="LoginUser.InlongService"/>
        select
        <include refid="Base_Column_List"/>
        from data_node
        <where>
            id = #{id, jdbcType=INTEGER}
            <if test="_isInlongService == false">
                and tenant = #{tenant,jdbcType=VARCHAR}
            </if>
            and is_deleted = 0
        </where>
    </select>
    <select id="selectByUniqueKey" resultType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
        <bind name="_isInlongService" value="LoginUser.InlongService"/>
        select
        <include refid="Base_Column_List"/>
        from data_node
        <where>
            name = #{name, jdbcType=VARCHAR}
            and type = #{type, jdbcType=VARCHAR}
            and is_deleted = 0
            <if test="_isInlongService == false">
                and tenant = #{tenant,jdbcType=VARCHAR}
            </if>
        </where>
    </select>
    <select id="selectByCondition"
            parameterType="org.apache.inlong.manager.pojo.node.DataNodePageRequest"
            resultType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
        <bind name="_isInlongService" value="LoginUser.InlongService"/>
        select
        <include refid="Base_Column_List"/>
        from data_node
        <where>
            <if test="name != null and name != ''">
                and name = #{name, jdbcType=VARCHAR}
            </if>
            <if test="type != null and type != ''">
                and type = #{type, jdbcType=VARCHAR}
            </if>
            <if test="keyword != null and keyword != ''">
                and (
                name like CONCAT('%', #{keyword}, '%')
                or display_name like CONCAT('%', #{keyword}, '%')
                or type like CONCAT('%', #{keyword}, '%')
                or url like CONCAT('%', #{keyword}, '%')
                )
            </if>
            <if test="status != null and status != ''">
                and status = #{status, jdbcType=INTEGER}
            </if>
            <if test="_isInlongService == false">
                and tenant = #{tenant,jdbcType=VARCHAR}
            </if>
            and is_deleted = 0
        </where>
        order by modify_time desc
    </select>
    <select id="selectAllDataNodes" resultType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
        select
        <include refid="Base_Column_List"/>
        from data_node
        <where>
            and is_deleted = 0
        </where>
    </select>
    <select id="selectByIdSelective"
            parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity"
            resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from data_node
        <where>
            <if test="type != null">
                and type = #{type, jdbcType=VARCHAR}
            </if>
            <if test="url != null">
                and url = #{url, jdbcType=VARCHAR}
            </if>
            <if test="username != null">
                and username = #{username, jdbcType=VARCHAR}
            </if>
            <if test="token != null">
                and token = #{token, jdbcType=VARCHAR}
            </if>
            <if test="extParams != null">
                and ext_params = #{extParams, jdbcType=LONGVARCHAR}
            </if>
            and tenant = #{tenant, jdbcType=LONGVARCHAR}
            and is_deleted = 0
        </where>
    </select>
    <update id="updateById" parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
        <bind name="_isInlongService" value="LoginUser.InlongService"/>
        update data_node
        set name         = #{name, jdbcType=VARCHAR},
            display_name = #{displayName, jdbcType=VARCHAR},
            type         = #{type, jdbcType=VARCHAR},
            url          = #{url, jdbcType=VARCHAR},
            username     = #{username, jdbcType=VARCHAR},
            token        = #{token, jdbcType=VARCHAR},
            ext_params   = #{extParams, jdbcType=LONGVARCHAR},
            description  = #{description,jdbcType=VARCHAR},
            in_charges   = #{inCharges, 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}
            <if test="_isInlongService == false">
                and tenant = #{tenant,jdbcType=VARCHAR}
            </if>
            and version = #{version, jdbcType=INTEGER}
        </where>
    </update>
    <update id="updateByIdSelective" parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity">
        <bind name="_isInlongService" value="LoginUser.InlongService"/>
        update data_node
        <set>
            <if test="name != null">
                name = #{name, jdbcType=VARCHAR},
            </if>
            <if test="displayName !=null">
                display_name = #{displayName, jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                type = #{type, jdbcType=VARCHAR},
            </if>
            <if test="url != null">
                url = #{url, jdbcType=VARCHAR},
            </if>
            <if test="username != null">
                username = #{username, jdbcType=VARCHAR},
            </if>
            <if test="token != null">
                token = #{token, jdbcType=VARCHAR},
            </if>
            <if test="extParams != null">
                ext_params = #{extParams, jdbcType=LONGVARCHAR},
            </if>
            <if test="description != null">
                description = #{description,jdbcType=VARCHAR},
            </if>
            <if test="inCharges != null">
                in_charges = #{inCharges, 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}
            <if test="_isInlongService == false">
                and tenant = #{tenant, jdbcType=VARCHAR}
            </if>
            and version = #{version, jdbcType=INTEGER}
        </where>
    </update>

    <delete id="deleteById">
        <bind name="_isInlongService" value="LoginUser.InlongService"/>
        delete
        from data_node
        <where>
            id = #{id, jdbcType=INTEGER}
            <if test="_isInlongService == false">
                and tenant = #{tenant, jdbcType=VARCHAR}
            </if>
        </where>
    </delete>
    <insert id="copy">
        insert into data_node (name, display_name, type, url, username,
                               token, ext_params, description, tenant,
                               in_charges, status, creator, modifier)
        select #{newName, jdbcType=VARCHAR},
               display_name,
               type,
               url,
               username,
               token,
               ext_params,
               description,
               #{targetTenant, jdbcType=VARCHAR},
               in_charges,
               status,
               creator,
               modifier
        from data_node
        <where>
            name = #{name, jdbcType=VARCHAR}
            and type = #{type, jdbcType=VARCHAR}
            and is_deleted = 0
            and tenant = #{sourceTenant, jdbcType=VARCHAR}
        </where>
    </insert>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy