blob: ce7619e27b21fb6ef53630b462a5956730463f7c [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.AuthPathMapper">
<resultMap id="BaseResultMap" type="org.apache.shenyu.admin.model.entity.AuthPathDO">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="auth_id" jdbcType="VARCHAR" property="authId"/>
<result column="app_name" jdbcType="VARCHAR" property="appName"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="enabled" jdbcType="TINYINT" property="enabled"/>
<result column="date_created" jdbcType="TIMESTAMP" property="dateCreated"/>
<result column="date_updated" jdbcType="TIMESTAMP" property="dateUpdated"/>
</resultMap>
<sql id="Base_Column_List">
id,
auth_id,
app_name,
path,
enabled,
date_created,
date_updated
</sql>
<select id="findByAuthId" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM auth_path
WHERE auth_id = #{authId, jdbcType=VARCHAR}
</select>
<select id="findByAuthIdList" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM auth_path
WHERE auth_id in
<foreach collection="authIdList" index="index" item="authId"
open="(" separator="," close=")" >
#{authId, jdbcType=VARCHAR}
</foreach>
</select>
<select id="findByAuthIdAndAppName" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM auth_path
WHERE auth_id = #{authId, jdbcType=VARCHAR}
AND app_name = #{appName, jdbcType=VARCHAR}
</select>
<select id="existed" resultType="java.lang.Boolean">
SELECT true
FROM auth_path
WHERE id = #{id}
LIMIT 1
</select>
<select id="existedByAuthId" resultType="java.lang.Boolean">
SELECT true
FROM auth_path
WHERE auth_id = #{authId}
LIMIT 1
</select>
<insert id="save" parameterType="org.apache.shenyu.admin.model.entity.AuthParamDO">
INSERT INTO auth_path
(id,
auth_id,
app_name,
path,
enabled,
date_created,
date_updated)
VALUES
(#{id, jdbcType=VARCHAR},
#{authId, jdbcType=VARCHAR},
#{appName, jdbcType=VARCHAR},
#{path, jdbcType=VARCHAR},
#{enabled, jdbcType=TINYINT},
#{dateCreated, jdbcType=TIMESTAMP},
#{dateUpdated, jdbcType=TIMESTAMP})
</insert>
<insert id="batchSave">
INSERT INTO auth_path
(id,
auth_id,
app_name,
path,
enabled,
date_created,
date_updated)
VALUES
<foreach collection="authPathDOList" item="authPathDO" separator=",">
(#{authPathDO.id, jdbcType=VARCHAR},
#{authPathDO.authId, jdbcType=VARCHAR},
#{authPathDO.appName, jdbcType=VARCHAR},
#{authPathDO.path, jdbcType=VARCHAR},
#{authPathDO.enabled, jdbcType=TINYINT},
#{authPathDO.dateCreated, jdbcType=TIMESTAMP},
#{authPathDO.dateUpdated, jdbcType=TIMESTAMP})
</foreach>
</insert>
<update id="update" parameterType="org.apache.shenyu.admin.model.entity.AuthParamDO">
UPDATE auth_path
SET path = #{path, jdbcType=VARCHAR}
WHERE id = #{id, jdbcType=VARCHAR}
</update>
<delete id="deleteByAuthIdAndAppName">
DELETE FROM auth_path
WHERE auth_id = #{authId, jdbcType=VARCHAR}
AND app_name = #{appName, jdbcType=VARCHAR}
</delete>
<delete id="deleteByAuthId" parameterType="java.lang.String">
DELETE FROM auth_path
WHERE auth_id = #{authId, jdbcType=VARCHAR}
</delete>
<delete id="deleteByAuthIds" parameterType="java.lang.String">
DELETE FROM auth_path
WHERE auth_id IN
<foreach item="authId" collection="list" open="(" separator="," close=")">
#{authId, jdbcType=VARCHAR}
</foreach>
</delete>
</mapper>