blob: 0338881fcab55aaaea3d396e610911c945d36df7 [file] [log] [blame]
<?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" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.apache.shenyu.admin.mapper.PluginHandleMapper">
<resultMap id="BaseResultMap" type="org.apache.shenyu.admin.model.entity.PluginHandleDO">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="date_created" jdbcType="TIMESTAMP" property="dateCreated"/>
<result column="date_updated" jdbcType="TIMESTAMP" property="dateUpdated"/>
<result column="plugin_id" jdbcType="VARCHAR" property="pluginId"/>
<result column="field" jdbcType="VARCHAR" property="field"/>
<result column="label" jdbcType="VARCHAR" property="label"/>
<result column="data_type" jdbcType="INTEGER" property="dataType"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="ext_obj" jdbcType="VARCHAR" property="extObj"/>
</resultMap>
<sql id="Base_Column_List">
id,
plugin_id,
field,
label,
data_type,
type,
sort,
ext_obj,
date_created,
date_updated
</sql>
<select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM plugin_handle
WHERE id = #{id, jdbcType=VARCHAR}
</select>
<select id="findByPluginId" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM plugin_handle
WHERE plugin_id = #{pluginId, jdbcType=VARCHAR}
</select>
<delete id="delete" parameterType="java.lang.String">
DELETE FROM plugin_handle
WHERE id = #{id, jdbcType=VARCHAR}
</delete>
<delete id="deleteByIdList">
DELETE FROM plugin_handle
WHERE id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id, jdbcType=VARCHAR}
</foreach>
</delete>
<delete id="deleteByPluginIds" parameterType="java.util.List">
DELETE FROM plugin_handle
WHERE plugin_id IN
<foreach item="pluginId" collection="list" open="(" separator="," close=")">
#{pluginId,jdbcType=VARCHAR}
</foreach>
</delete>
<insert id="insert" parameterType="org.apache.shenyu.admin.model.entity.PluginHandleDO">
INSERT INTO plugin_handle
(id,
plugin_id,
field,
label,
data_type,
type,
sort,
ext_obj,
date_created,
date_updated)
VALUES (#{id, jdbcType=VARCHAR},
#{pluginId, jdbcType=VARCHAR},
#{field, jdbcType=VARCHAR},
#{label, jdbcType=VARCHAR},
#{dataType, jdbcType=INTEGER},
#{type, jdbcType=INTEGER},
#{sort, jdbcType=INTEGER},
#{extObj, jdbcType=VARCHAR},
#{dateCreated, jdbcType=TIMESTAMP},
#{dateUpdated, jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="org.apache.shenyu.admin.model.entity.PluginHandleDO">
INSERT INTO plugin_handle
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="pluginId != null">
plugin_id,
</if>
<if test="field != null">
field,
</if>
<if test="label != null">
label,
</if>
<if test="dataType != null">
data_type,
</if>
<if test="type != null">
type,
</if>
<if test="sort != null">
sort,
</if>
<if test="extObj != null">
ext_obj,
</if>
<if test="dateCreated != null">
date_created,
</if>
<if test="dateUpdated != null">
date_updated,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id, jdbcType=VARCHAR},
</if>
<if test="pluginId != null">
#{pluginId, jdbcType=VARCHAR},
</if>
<if test="field != null">
#{field, jdbcType=VARCHAR},
</if>
<if test="label != null">
#{label, jdbcType=VARCHAR},
</if>
<if test="dataType != null">
#{dataType, jdbcType=INTEGER},
</if>
<if test="type != null">
#{type, jdbcType=INTEGER},
</if>
<if test="sort != null">
#{sort, jdbcType=INTEGER},
</if>
<if test="extObj != null">
#{extObj, jdbcType=VARCHAR},
</if>
<if test="dateCreated != null">
#{dateCreated, jdbcType=TIMESTAMP},
</if>
<if test="dateUpdated != null">
#{dateUpdated, jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="org.apache.shenyu.admin.model.entity.PluginHandleDO">
UPDATE plugin_handle
<set>
<if test="pluginId != null">
plugin_id = #{pluginId, jdbcType=VARCHAR},
</if>
<if test="field != null">
field = #{field, jdbcType=VARCHAR},
</if>
<if test="label != null">
label = #{label, jdbcType=VARCHAR},
</if>
<if test="dataType != null">
data_type= #{dataType, jdbcType=INTEGER},
</if>
<if test="type != null">
type= #{type, jdbcType=INTEGER},
</if>
<if test="sort != null">
sort= #{sort, jdbcType=INTEGER},
</if>
<if test="extObj != null">
ext_obj= #{extObj, jdbcType=VARCHAR},
</if>
<if test="dateCreated != null">
date_created = #{dateCreated, jdbcType=TIMESTAMP},
</if>
<if test="dateUpdated != null">
date_updated = #{dateUpdated, jdbcType=TIMESTAMP},
</if>
</set>
WHERE id = #{id, jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="org.apache.shenyu.admin.model.entity.PluginHandleDO">
UPDATE plugin_handle
SET plugin_id = #{pluginId, jdbcType=VARCHAR},
field = #{field, jdbcType=VARCHAR},
label = #{label, jdbcType=VARCHAR},
data_type = #{dataType, jdbcType=INTEGER},
type = #{type, jdbcType=INTEGER},
sort = #{sort, jdbcType=INTEGER},
ext_obj = #{extObj, jdbcType=VARCHAR},
date_created = #{dateCreated, jdbcType=TIMESTAMP},
date_updated = #{dateUpdated, jdbcType=TIMESTAMP}
WHERE id = #{id, jdbcType=VARCHAR}
</update>
<select id="countByQuery" parameterType="org.apache.shenyu.admin.model.query.PluginHandleQuery"
resultType="java.lang.Integer">
SELECT count(1)
FROM plugin_handle
<where>
<if test="pluginId != null and pluginId != ''">
AND plugin_id = #{pluginId, jdbcType=VARCHAR}
</if>
<if test="field != null and field != ''">
AND field = #{field, jdbcType=VARCHAR}
</if>
<if test="type != null">
AND type = #{type, jdbcType=INTEGER}
</if>
</where>
</select>
<select id="selectByQuery" parameterType="org.apache.shenyu.admin.model.query.PluginHandleQuery"
resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM plugin_handle
<where>
<if test="pluginId != null and pluginId != ''">
AND plugin_id = #{pluginId, jdbcType=VARCHAR}
</if>
<if test="field != null and field != ''">
<bind name="fieldLike" value="('%' + field + '%')"/>
AND field like #{fieldLike, jdbcType=VARCHAR}
</if>
<if test="type != null">
AND type = #{type, jdbcType=INTEGER}
</if>
</where>
ORDER BY plugin_id,sort
</select>
<select id="existed" resultType="java.lang.Boolean">
SELECT true
FROM plugin_handle
WHERE id = #{id}
LIMIT 1
</select>
<select id="selectByPluginIdList" resultType="org.apache.shenyu.admin.model.entity.PluginHandleDO">
SELECT
<include refid="Base_Column_List"/>
FROM plugin_handle
where plugin_id in
<foreach item="pluginId" collection="pluginIds" open="(" separator="," close=")">
#{pluginId,jdbcType=VARCHAR}
</foreach>
</select>
<select id="selectByIdList" resultType="org.apache.shenyu.admin.model.entity.PluginHandleDO">
SELECT
<include refid="Base_Column_List"/>
FROM plugin_handle
where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id,jdbcType=VARCHAR}
</foreach>
</select>
</mapper>