mappers.InlongStreamEntityMapper.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.InlongStreamEntityMapper"> <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongStreamEntity"> <id column="id" jdbcType="INTEGER" property="id"/> <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/> <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/> <result column="name" jdbcType="VARCHAR" property="name"/> <result column="description" jdbcType="VARCHAR" property="description"/> <result column="mq_resource" jdbcType="VARCHAR" property="mqResource"/> <result column="data_type" jdbcType="VARCHAR" property="dataType"/> <result column="wrap_type" jdbcType="VARCHAR" property="wrapType"/> <result column="data_encoding" jdbcType="VARCHAR" property="dataEncoding"/> <result column="data_separator" jdbcType="VARCHAR" property="dataSeparator"/> <result column="data_escape_char" jdbcType="VARCHAR" property="dataEscapeChar"/> <result column="sync_send" jdbcType="INTEGER" property="syncSend"/> <result column="daily_records" jdbcType="INTEGER" property="dailyRecords"/> <result column="daily_storage" jdbcType="INTEGER" property="dailyStorage"/> <result column="peak_records" jdbcType="INTEGER" property="peakRecords"/> <result column="max_length" jdbcType="INTEGER" property="maxLength"/> <result column="storage_period" jdbcType="INTEGER" property="storagePeriod"/> <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/> <result column="status" jdbcType="INTEGER" property="status"/> <result column="previous_status" jdbcType="INTEGER" property="previousStatus"/> <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, inlong_group_id, inlong_stream_id, name, description, mq_resource, data_type, wrap_type, data_encoding, data_separator, data_escape_char, sync_send, daily_records, daily_storage, peak_records, max_length, storage_period, ext_params, status, previous_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.InlongStreamEntity"> insert into inlong_stream (id, inlong_group_id, inlong_stream_id, name, description, mq_resource, data_type, wrap_type, data_encoding, data_separator, data_escape_char, sync_send, daily_records, daily_storage, peak_records, max_length,storage_period, ext_params, status, previous_status, creator, modifier) values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR}, #{inlongStreamId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{mqResource,jdbcType=VARCHAR}, #{dataType,jdbcType=VARCHAR}, #{wrapType,jdbcType=VARCHAR}, #{dataEncoding,jdbcType=VARCHAR}, #{dataSeparator,jdbcType=VARCHAR}, #{dataEscapeChar,jdbcType=VARCHAR}, #{syncSend,jdbcType=INTEGER}, #{dailyRecords,jdbcType=INTEGER}, #{dailyStorage,jdbcType=INTEGER}, #{peakRecords,jdbcType=INTEGER}, #{maxLength,jdbcType=INTEGER}, #{storagePeriod,jdbcType=INTEGER}, #{extParams,jdbcType=LONGVARCHAR}, #{status,jdbcType=INTEGER}, #{previousStatus,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamEntity"> insert into inlong_stream <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="inlongGroupId != null"> inlong_group_id, </if> <if test="inlongStreamId != null"> inlong_stream_id, </if> <if test="name != null"> name, </if> <if test="description != null"> description, </if> <if test="mqResource != null"> mq_resource, </if> <if test="dataType != null"> data_type, </if> <if test="wrapType != null"> wrap_type, </if> <if test="dataEncoding != null"> data_encoding, </if> <if test="dataSeparator != null"> data_separator, </if> <if test="dataEscapeChar != null"> data_escape_char, </if> <if test="syncSend != null"> sync_send, </if> <if test="dailyRecords != null"> daily_records, </if> <if test="dailyStorage != null"> daily_storage, </if> <if test="peakRecords != null"> peak_records, </if> <if test="maxLength != null"> max_length, </if> <if test="storagePeriod != null"> storage_period, </if> <if test="extParams != null"> ext_params, </if> <if test="status != null"> status, </if> <if test="previousStatus != null"> previous_status, </if> <if test="creator != null"> creator, </if> <if test="modifier != null"> modifier, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=INTEGER}, </if> <if test="inlongGroupId != null"> #{inlongGroupId,jdbcType=VARCHAR}, </if> <if test="inlongStreamId != null"> #{inlongStreamId,jdbcType=VARCHAR}, </if> <if test="name != null"> #{name,jdbcType=VARCHAR}, </if> <if test="description != null"> #{description,jdbcType=VARCHAR}, </if> <if test="mqResource != null"> #{mqResource,jdbcType=VARCHAR}, </if> <if test="dataType != null"> #{dataType,jdbcType=VARCHAR}, </if> <if test="wrapType != null"> #{wrapType,jdbcType=VARCHAR}, </if> <if test="dataEncoding != null"> #{dataEncoding,jdbcType=VARCHAR}, </if> <if test="dataSeparator != null"> #{dataSeparator,jdbcType=VARCHAR}, </if> <if test="dataEscapeChar != null"> #{dataEscapeChar,jdbcType=VARCHAR}, </if> <if test="syncSend != null"> #{syncSend,jdbcType=INTEGER}, </if> <if test="dailyRecords != null"> #{dailyRecords,jdbcType=INTEGER}, </if> <if test="dailyStorage != null"> #{dailyStorage,jdbcType=INTEGER}, </if> <if test="peakRecords != null"> #{peakRecords,jdbcType=INTEGER}, </if> <if test="maxLength != null"> #{maxLength,jdbcType=INTEGER}, </if> <if test="storagePeriod != null"> #{storagePeriod,jdbcType=INTEGER}, </if> <if test="extParams != null"> #{extParams,jdbcType=LONGVARCHAR}, </if> <if test="status != null"> #{status,jdbcType=INTEGER}, </if> <if test="previousStatus != null"> #{previousStatus,jdbcType=INTEGER}, </if> <if test="creator != null"> #{creator,jdbcType=VARCHAR}, </if> <if test="modifier != null"> #{modifier,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="selectByIdentifier" resultType="org.apache.inlong.manager.dao.entity.InlongStreamEntity"> select <include refid="Base_Column_List"/> from inlong_stream <where> is_deleted = 0 <if test="groupId != null and groupId != ''"> and inlong_group_id = #{groupId, jdbcType=VARCHAR} </if> <if test="streamId != null and streamId != ''"> and inlong_stream_id = #{streamId, jdbcType=VARCHAR} </if> </where> </select> <select id="selectExistByIdentifier" resultType="java.lang.Integer"> select count(1) from inlong_stream where inlong_group_id = #{groupId, jdbcType=VARCHAR} and inlong_stream_id = #{streamId, jdbcType=VARCHAR} and is_deleted = 0 </select> <select id="selectByCondition" resultMap="BaseResultMap" parameterType="org.apache.inlong.manager.pojo.stream.InlongStreamPageRequest"> select distinct stream.id, stream.inlong_group_id, stream.inlong_stream_id, stream.name, stream.description, stream.mq_resource, stream.data_type, stream.wrap_type, stream.data_encoding, stream.data_separator, stream.data_escape_char, stream.sync_send, stream.daily_records, stream.daily_storage, stream.peak_records, stream.max_length, stream.storage_period, stream.status, stream.creator, stream.modifier, stream.create_time, stream.modify_time, stream.version from inlong_stream stream, inlong_group grp <where> stream.is_deleted = 0 and stream.inlong_group_id = grp.inlong_group_id and grp.is_deleted = 0 <if test="request.inlongGroupId != null and request.inlongGroupId != ''"> and stream.inlong_group_id = #{request.inlongGroupId, jdbcType=VARCHAR} </if> <if test="request.keyword != null and request.keyword != ''"> and ( stream.inlong_stream_id like CONCAT('%', #{request.keyword}, '%') or stream.name like CONCAT('%', #{request.keyword}, '%') ) </if> <if test="request.status != null and request.status != ''"> and stream.status = #{request.status, jdbcType=INTEGER} </if> <if test="request.statusList != null and request.statusList.size() > 0"> and stream.status in <foreach collection="request.statusList" item="status" index="index" open="(" close=")" separator=","> #{status} </foreach> </if> </where> <choose> <when test="request.orderField != null and request.orderField != '' and request.orderType != null and request.orderType != ''"> order by stream.${request.orderField} ${request.orderType} </when> <otherwise> order by stream.create_time desc </otherwise> </choose> </select> <select id="selectBriefList" resultType="org.apache.inlong.manager.pojo.stream.InlongStreamBriefInfo"> select id, inlong_group_id, inlong_stream_id, name, mq_resource, modify_time from inlong_stream where is_deleted = 0 and inlong_group_id = #{groupId, jdbcType=VARCHAR} order by modify_time desc </select> <select id="selectByGroupId" resultType="org.apache.inlong.manager.dao.entity.InlongStreamEntity"> select <include refid="Base_Column_List"/> from inlong_stream where inlong_group_id = #{groupId, jdbcType=VARCHAR} and is_deleted = 0 </select> <select id="selectAllStreams" resultType="org.apache.inlong.manager.pojo.sort.standalone.SortSourceStreamInfo"> select inlong_group_id, inlong_stream_id, mq_resource, ext_params from inlong_stream where is_deleted = 0 </select> <select id="selectCountByGroupId" resultType="java.lang.Integer"> select count(1) from inlong_stream <where> inlong_group_id = #{groupId,jdbcType=VARCHAR} and is_deleted = 0 </where> </select> <update id="updateByPrimaryKey" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamEntity"> update inlong_stream set inlong_group_id = #{inlongGroupId, jdbcType=VARCHAR}, inlong_stream_id = #{inlongStreamId, jdbcType=VARCHAR}, name = #{name, jdbcType=VARCHAR}, description = #{description, jdbcType=VARCHAR}, mq_resource = #{mqResource, jdbcType=VARCHAR}, data_type = #{dataType, jdbcType=VARCHAR}, wrap_type = #{wrapType, jdbcType=VARCHAR}, data_encoding = #{dataEncoding, jdbcType=VARCHAR}, data_separator = #{dataSeparator, jdbcType=VARCHAR}, data_escape_char = #{dataEscapeChar, jdbcType=VARCHAR}, sync_send = #{syncSend, jdbcType=INTEGER}, daily_records = #{dailyRecords, jdbcType=INTEGER}, daily_storage = #{dailyStorage, jdbcType=INTEGER}, peak_records = #{peakRecords, jdbcType=INTEGER}, max_length = #{maxLength, jdbcType=INTEGER}, storage_period = #{storagePeriod, jdbcType=INTEGER}, ext_params = #{extParams, jdbcType=LONGVARCHAR}, status = #{status, jdbcType=INTEGER}, previous_status = #{previousStatus, jdbcType=INTEGER}, is_deleted = #{isDeleted, jdbcType=INTEGER}, creator = #{creator, jdbcType=VARCHAR}, modifier = #{modifier, jdbcType=VARCHAR}, version = #{version, jdbcType=INTEGER} + 1 where id = #{id, jdbcType=INTEGER} and version = #{version, jdbcType=INTEGER} </update> <update id="updateByIdentifierSelective" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamEntity"> update inlong_stream <set> <if test="inlongGroupId != null"> inlong_group_id = #{inlongGroupId, jdbcType=VARCHAR}, </if> <if test="inlongStreamId != null"> inlong_stream_id = #{inlongStreamId, jdbcType=VARCHAR}, </if> <if test="name != null"> name = #{name,jdbcType=VARCHAR}, </if> <if test="description != null"> description = #{description, jdbcType=VARCHAR}, </if> <if test="mqResource != null"> mq_resource = #{mqResource, jdbcType=VARCHAR}, </if> <if test="dataType != null"> data_type = #{dataType, jdbcType=VARCHAR}, </if> <if test="wrapType != null"> wrap_type = #{wrapType, jdbcType=VARCHAR}, </if> <if test="dataEncoding != null"> data_encoding = #{dataEncoding, jdbcType=VARCHAR}, </if> <if test="dataSeparator != null"> data_separator = #{dataSeparator, jdbcType=VARCHAR}, </if> <if test="dataEscapeChar != null"> data_escape_char = #{dataEscapeChar, jdbcType=VARCHAR}, </if> <if test="syncSend != null"> sync_send = #{syncSend, jdbcType=INTEGER}, </if> <if test="dailyRecords!= null"> daily_records= #{dailyRecords, jdbcType=INTEGER}, </if> <if test="dailyStorage!= null"> daily_storage= #{dailyStorage, jdbcType=INTEGER}, </if> <if test="peakRecords != null"> peak_records= #{peakRecords, jdbcType=INTEGER}, </if> <if test="maxLength != null"> max_length= #{maxLength, jdbcType=INTEGER}, </if> <if test="storagePeriod != null"> storage_period = #{storagePeriod, jdbcType=INTEGER}, </if> <if test="extParams != null"> ext_params = #{extParams, jdbcType=LONGVARCHAR}, </if> <if test="status != null"> status = #{status, jdbcType=INTEGER}, </if> <if test="previousStatus != null"> previous_status = #{previousStatus, jdbcType=INTEGER}, </if> <if test="isDeleted != null"> is_deleted = #{isDeleted, jdbcType=INTEGER}, </if> <if test="creator != null"> creator = #{creator, jdbcType=VARCHAR}, </if> <if test="modifier != null"> modifier = #{modifier, jdbcType=VARCHAR}, </if> version = #{version, jdbcType=INTEGER} + 1 </set> where inlong_group_id = #{inlongGroupId, jdbcType=VARCHAR} and inlong_stream_id = #{inlongStreamId, jdbcType=VARCHAR} and is_deleted = 0 and version = #{version,jdbcType=INTEGER} </update> <update id="updateStatusByIdentifier"> update inlong_stream set status = #{status, jdbcType=INTEGER}, modifier = #{modifier, jdbcType=VARCHAR} where inlong_group_id = #{groupId, jdbcType=VARCHAR} <if test="streamId != null and streamId != ''"> and inlong_stream_id = #{streamId, jdbcType=VARCHAR} </if> and is_deleted = 0 </update> <update id="logicDeleteDlqOrRlq"> update inlong_stream set is_deleted = id, modifier = #{operator, jdbcType=VARCHAR} where inlong_group_id = #{groupId, jdbcType=VARCHAR} and inlong_stream_id = #{streamId, jdbcType=VARCHAR} and is_deleted = 0 </update> <delete id="deleteById" parameterType="java.lang.Integer"> delete from inlong_stream where id = #{id,jdbcType=INTEGER} </delete> <delete id="deleteByInlongGroupIds"> delete from inlong_stream where inlong_group_id in <foreach item="item" index="index" collection="groupIdList" open="(" close=")" separator=","> #{item} </foreach> </delete> </mapper>