| <?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.AppAuthMapper"> |
| <resultMap id="BaseResultMap" type="org.apache.shenyu.admin.model.entity.AppAuthDO"> |
| <id column="id" jdbcType="VARCHAR" property="id"/> |
| <result column="app_key" jdbcType="VARCHAR" property="appKey"/> |
| <result column="app_secret" jdbcType="VARCHAR" property="appSecret"/> |
| <result column="user_id" jdbcType="VARCHAR" property="userId"/> |
| <result column="phone" jdbcType="VARCHAR" property="phone"/> |
| <result column="ext_info" jdbcType="VARCHAR" property="extInfo"/> |
| <result column="open" jdbcType="TINYINT" property="open"/> |
| <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, |
| app_key, |
| app_secret,user_id, |
| phone, |
| ext_info, |
| open,enabled, |
| date_created, |
| date_updated |
| </sql> |
| |
| <select id="selectByCondition" resultType="org.apache.shenyu.admin.model.vo.AppAuthVO"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM app_auth |
| <where> |
| <if test="condition.appKey != null and condition.appKey != ''"> |
| AND app_key = #{condition.appKey, jdbcType=VARCHAR} |
| </if> |
| <if test="condition.phone != null and condition.phone != ''"> |
| AND phone = #{condition.phone, jdbcType=VARCHAR} |
| </if> |
| </where> |
| </select> |
| |
| <select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM app_auth |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </select> |
| |
| <select id="selectByIds" parameterType="java.util.List" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM app_auth |
| WHERE id IN |
| <foreach item="id" collection="list" open="(" separator="," close=")"> |
| #{id, jdbcType=VARCHAR} |
| </foreach> |
| </select> |
| |
| <select id="findByAppKey" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM app_auth |
| WHERE app_key = #{appKey, jdbcType=VARCHAR} |
| </select> |
| |
| <select id="selectByQuery" parameterType="org.apache.shenyu.admin.model.query.AppAuthQuery" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM app_auth |
| <where> |
| <if test="appKey != null and appKey != ''"> |
| AND app_key = #{appKey, jdbcType=VARCHAR} |
| </if> |
| <if test="phone != null and phone != ''"> |
| AND phone = #{phone, jdbcType=VARCHAR} |
| </if> |
| </where> |
| </select> |
| |
| <select id="countByQuery" parameterType="org.apache.shenyu.admin.model.query.AppAuthQuery" resultType="java.lang.Integer"> |
| SELECT count(1) |
| FROM app_auth |
| <where> |
| <if test="appKey != null and appKey != ''"> |
| AND app_key = #{appKey, jdbcType=VARCHAR} |
| </if> |
| <if test="phone != null and phone != ''"> |
| AND phone = #{phone, jdbcType=VARCHAR} |
| </if> |
| </where> |
| </select> |
| |
| <select id="selectAll" resultType="org.apache.shenyu.admin.model.entity.AppAuthDO" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM app_auth |
| </select> |
| |
| <select id="existed" resultType="java.lang.Boolean"> |
| SELECT true |
| FROM app_auth |
| WHERE id = #{id} |
| LIMIT 1 |
| </select> |
| |
| <select id="appKeyExisted" resultType="java.lang.Boolean"> |
| SELECT true |
| FROM app_auth |
| WHERE app_key = #{appKey} |
| LIMIT 1 |
| </select> |
| |
| <insert id="insert" parameterType="org.apache.shenyu.admin.model.entity.AppAuthDO"> |
| INSERT INTO app_auth |
| (id, |
| app_key, |
| app_secret, |
| user_id, |
| phone, |
| ext_info, |
| open, |
| enabled, |
| date_created, |
| date_updated) |
| VALUES |
| (#{id, jdbcType=VARCHAR}, |
| #{appKey, jdbcType=VARCHAR}, |
| #{appSecret, jdbcType=VARCHAR}, |
| #{userId, jdbcType=VARCHAR}, |
| #{phone, jdbcType=VARCHAR}, |
| #{extInfo, jdbcType=VARCHAR}, |
| #{open, jdbcType=TINYINT}, |
| #{enabled, jdbcType=TINYINT}, |
| #{dateCreated, jdbcType=TIMESTAMP}, |
| #{dateUpdated, jdbcType=TIMESTAMP}) |
| </insert> |
| |
| <insert id="insertSelective" parameterType="org.apache.shenyu.admin.model.entity.AppAuthDO"> |
| INSERT INTO app_auth |
| <trim prefix="(" suffix=")" suffixOverrides=","> |
| id, |
| <if test="dateCreated != null"> |
| date_created, |
| </if> |
| <if test="dateUpdated != null"> |
| date_updated, |
| </if> |
| <if test="appKey != null"> |
| app_key, |
| </if> |
| <if test="appSecret != null"> |
| app_secret, |
| </if> |
| <if test="open != null"> |
| open, |
| </if> |
| <if test="enabled != null"> |
| enabled, |
| </if> |
| <if test="userId != null"> |
| user_id, |
| </if> |
| <if test="phone != null"> |
| phone, |
| </if> |
| <if test="extInfo != null"> |
| ext_info, |
| </if> |
| </trim> |
| <trim prefix="values (" suffix=")" suffixOverrides=","> |
| #{id, jdbcType=VARCHAR}, |
| <if test="dateCreated != null"> |
| #{dateCreated, jdbcType=TIMESTAMP}, |
| </if> |
| <if test="dateUpdated != null"> |
| #{dateUpdated, jdbcType=TIMESTAMP}, |
| </if> |
| <if test="appKey != null"> |
| #{appKey, jdbcType=VARCHAR}, |
| </if> |
| <if test="appSecret != null"> |
| #{appSecret, jdbcType=VARCHAR}, |
| </if> |
| <if test="open != null"> |
| #{open, jdbcType=TINYINT}, |
| </if> |
| <if test="enabled != null"> |
| #{enabled, jdbcType=TINYINT}, |
| </if> |
| <if test="userId != null"> |
| #{userId, jdbcType=VARCHAR}, |
| </if> |
| <if test="phone != null"> |
| #{phone, jdbcType=VARCHAR}, |
| </if> |
| <if test="extInfo != null"> |
| #{extInfo, jdbcType=VARCHAR}, |
| </if> |
| </trim> |
| </insert> |
| |
| <update id="update" parameterType="org.apache.shenyu.admin.model.entity.AppAuthDO"> |
| UPDATE app_auth |
| SET |
| app_secret = #{appSecret, jdbcType=VARCHAR}, |
| phone = #{phone, jdbcType=VARCHAR}, |
| ext_info = #{extInfo, jdbcType=VARCHAR}, |
| open = #{open, jdbcType=TINYINT}, |
| enabled = #{enabled, jdbcType=TINYINT} |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </update> |
| |
| <update id="updateSelective" parameterType="org.apache.shenyu.admin.model.entity.AppAuthDO"> |
| UPDATE app_auth |
| <set> |
| <if test="appSecret != null"> |
| app_secret = #{appSecret, jdbcType=VARCHAR}, |
| </if> |
| <if test="phone != null"> |
| phone = #{phone, jdbcType=VARCHAR}, |
| </if> |
| <if test="extInfo != null"> |
| ext_info = #{extInfo, jdbcType=VARCHAR}, |
| </if> |
| <if test="open != null"> |
| open = #{open, jdbcType=TINYINT}, |
| </if> |
| <if test="enabled != null"> |
| enabled = #{enabled, jdbcType=TINYINT}, |
| </if> |
| </set> |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </update> |
| |
| <delete id="delete" parameterType="java.lang.String"> |
| DELETE FROM app_auth |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </delete> |
| |
| <delete id="deleteByIds" parameterType="java.util.List"> |
| DELETE FROM app_auth |
| WHERE id IN |
| <foreach item="id" collection="list" open="(" separator="," close=")"> |
| #{id, jdbcType=VARCHAR} |
| </foreach> |
| </delete> |
| |
| <update id="updateEnable" parameterType="org.apache.shenyu.admin.model.entity.AppAuthDO"> |
| UPDATE app_auth |
| SET enabled = #{enabled, jdbcType=TINYINT} |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </update> |
| |
| <update id="updateEnableBatch"> |
| UPDATE app_auth |
| SET enabled = #{enabled,jdbcType=TINYINT} |
| WHERE id IN |
| <foreach collection="idList" index="index" item="id" open="(" separator="," close=")"> |
| #{id, jdbcType=VARCHAR} |
| </foreach> |
| </update> |
| |
| <update id="updateAppSecretByAppKey"> |
| UPDATE app_auth |
| SET app_secret = #{appSecret, jdbcType=VARCHAR} |
| WHERE app_key = #{appKey, jdbcType=VARCHAR} |
| </update> |
| |
| </mapper> |