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

mappers.InlongTenantEntityMapper.xml Maven / Gradle / Ivy

<?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.InlongTenantEntityMapper">
  <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongTenantEntity">
    <id column="id" jdbcType="INTEGER" property="id"/>
    <result column="name" jdbcType="VARCHAR" property="name"/>
    <result column="description" jdbcType="VARCHAR" property="description"/>
    <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, description, is_deleted, creator, modifier, create_time, modify_time, version
  </sql>

  <insert id="insert" useGeneratedKeys="true" keyProperty="id"
          parameterType="org.apache.inlong.manager.dao.entity.InlongTenantEntity">
    insert into inlong_tenant (id, name, description, creator, modifier)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
            #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"
          parameterType="org.apache.inlong.manager.dao.entity.InlongTenantEntity">
    insert into inlong_tenant
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null and name != ''">
        name,
      </if>
      <if test="description != null and description != ''">
        description,
      </if>
      <if test="isDeleted != null">
        is_deleted,
      </if>
      <if test="creator != null and creator != ''">
        creator,
      </if>
      <if test="modifier != null and modifier != ''">
        modifier,
      </if>
      <if test="version != null">
        version,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null and name != ''">
        #{name, jdbcType=VARCHAR},
      </if>
      <if test="description != null and description != ''">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="isDeleted != null">
        #{isDeleted,jdbcType=INTEGER},
      </if>
      <if test="creator != null and creator != ''">
        #{creator, jdbcType=VARCHAR},
      </if>
      <if test="modifier != null and modifier != ''">
        #{modifier, jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateById" parameterType="org.apache.inlong.manager.dao.entity.InlongTenantEntity">
    update inlong_tenant
    set description  = #{description,jdbcType=VARCHAR},
        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.InlongTenantEntity">
    update inlong_tenant
    <set>
      <if test="description != null and description != ''">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="isDeleted != null">
        is_deleted = #{isDeleted, jdbcType=INTEGER},
      </if>
      <if test="modifier != null and modifier != ''">
        modifier = #{modifier, jdbcType=VARCHAR},
      </if>
      version = #{version, jdbcType=INTEGER} + 1
    </set>
    where id = #{id, jdbcType=INTEGER}
    and version = #{version, jdbcType=INTEGER}
  </update>
  <select id="selectByCondition"
          parameterType="org.apache.inlong.manager.pojo.tenant.InlongTenantPageRequest"
          resultType="org.apache.inlong.manager.dao.entity.InlongTenantEntity">
    select
    <include refid="Base_Column_List"/>
    from inlong_tenant
    <where>
      is_deleted = 0
      <if test="keyword != null and keyword != ''">
        and name like CONCAT('%', #{keyword}, '%')
      </if>
      <if test="tenantList != null and tenantList.size() > 0">
        and name in
        <foreach collection="tenantList" item="targetTenant" index="index" open="(" close=")" separator=",">
          #{targetTenant}
        </foreach>
      </if>
    </where>
    order by modify_time desc
  </select>
  <select id="selectByName" parameterType="java.lang.String"
          resultType="org.apache.inlong.manager.dao.entity.InlongTenantEntity">
    select
    <include refid="Base_Column_List"/>
    from inlong_tenant
    where name = #{name, jdbcType=VARCHAR}
    and is_deleted = 0
  </select>

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

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy