blob: 6aad41e521e19f378f0d324e425be8cde02b29c7 [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.AuthParamMapper">
<resultMap id="BaseResultMap" type="org.apache.shenyu.admin.model.entity.AuthParamDO">
<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="app_param" jdbcType="VARCHAR" property="appParam"/>
<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,
app_param,
date_created,
date_updated
</sql>
<select id="findByAuthId" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM auth_param
WHERE auth_id = #{authId, jdbcType=VARCHAR}
</select>
<select id="findByAuthIdList" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM auth_param
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_param
WHERE auth_id = #{authId, jdbcType=VARCHAR}
AND app_name = #{appName, jdbcType=VARCHAR}
LIMIT 1
</select>
<insert id="save" parameterType="org.apache.shenyu.admin.model.entity.AuthParamDO">
INSERT INTO auth_param
(id,
auth_id,
app_name,
app_param,
date_created,
date_updated)
VALUES
(#{id, jdbcType=VARCHAR},
#{authId, jdbcType=VARCHAR},
#{appName, jdbcType=VARCHAR},
#{appParam, jdbcType=VARCHAR},
#{dateCreated, jdbcType=TIMESTAMP},
#{dateUpdated, jdbcType=TIMESTAMP})
</insert>
<insert id="batchSave">
INSERT INTO auth_param
(id,
auth_id,
app_name,
app_param,
date_created,
date_updated)
VALUES
<foreach collection="authParamDOList" item="authParamDO" separator=",">
(
#{authParamDO.id, jdbcType=VARCHAR},
#{authParamDO.authId, jdbcType=VARCHAR},
#{authParamDO.appName, jdbcType=VARCHAR},
#{authParamDO.appParam, jdbcType=VARCHAR},
#{authParamDO.dateCreated, jdbcType=TIMESTAMP},
#{authParamDO.dateUpdated, jdbcType=TIMESTAMP})
</foreach>
</insert>
<update id="update" parameterType="org.apache.shenyu.admin.model.entity.AuthParamDO">
UPDATE auth_param
SET app_param = #{appParam, jdbcType=VARCHAR}
WHERE id = #{id, jdbcType=VARCHAR}
</update>
<delete id="deleteByAuthId" parameterType="java.lang.String">
DELETE FROM auth_param
WHERE auth_id = #{authId, jdbcType=VARCHAR}
</delete>
<delete id="deleteByAuthIds" parameterType="java.util.List">
DELETE FROM auth_param
WHERE auth_id IN
<foreach item="authId" collection="list" open="(" separator="," close=")">
#{authId, jdbcType=VARCHAR}
</foreach>
</delete>
</mapper>