| <?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.RoleMapper"> |
| <resultMap id="BaseResultMap" type="org.apache.shenyu.admin.model.entity.RoleDO"> |
| <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="role_name" jdbcType="VARCHAR" property="roleName"/> |
| <result column="description" jdbcType="VARCHAR" property="description"/> |
| </resultMap> |
| |
| <sql id="Base_Column_List"> |
| id, |
| date_created, |
| date_updated, |
| role_name, |
| description |
| </sql> |
| |
| <select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM role |
| WHERE id = #{id, jdbcType=VARCHAR} |
| AND role_name != 'super' |
| </select> |
| |
| <select id="selectByQuery" parameterType="org.apache.shenyu.admin.model.query.RoleQuery" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM role |
| WHERE role_name != 'super' |
| <if test="roleName != null"> |
| AND role_name = #{roleName, jdbcType=VARCHAR} |
| </if> |
| </select> |
| |
| <select id="findByRoleName" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM role |
| WHERE role_name = #{roleName, jdbcType=VARCHAR} |
| </select> |
| |
| <select id="countByQuery" parameterType="org.apache.shenyu.admin.model.query.RoleQuery" |
| resultType="java.lang.Integer"> |
| SELECT count(1) |
| FROM role |
| WHERE role_name != 'super' |
| <if test="roleName != null"> |
| AND role_name = #{roleName, jdbcType=VARCHAR} |
| </if> |
| </select> |
| |
| <select id="selectAll" resultType="org.apache.shenyu.admin.model.entity.RoleDO" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM role |
| WHERE role_name != 'super' |
| </select> |
| |
| <select id="existed" resultType="java.lang.Boolean"> |
| SELECT true |
| FROM role |
| WHERE id = #{id} |
| LIMIT 1 |
| </select> |
| <select id="selectByIds" resultType="org.apache.shenyu.admin.model.entity.RoleDO"> |
| select |
| <include refid="Base_Column_List"/> |
| FROM role |
| WHERE id IN |
| <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| #{id, jdbcType=VARCHAR} |
| </foreach> |
| </select> |
| |
| <insert id="insert" parameterType="org.apache.shenyu.admin.model.entity.RoleDO"> |
| INSERT INTO role |
| (id, |
| date_created, |
| date_updated, |
| role_name, |
| description) |
| VALUES |
| (#{id,jdbcType=VARCHAR}, |
| #{dateCreated,jdbcType=TIMESTAMP}, |
| #{dateUpdated,jdbcType=TIMESTAMP}, |
| #{roleName,jdbcType=VARCHAR}, |
| #{description,jdbcType=VARCHAR}) |
| </insert> |
| |
| <insert id="insertSelective" parameterType="org.apache.shenyu.admin.model.entity.RoleDO"> |
| INSERT INTO role |
| <trim prefix="(" suffix=")" suffixOverrides=","> |
| id, |
| <if test="dateCreated != null"> |
| date_created, |
| </if> |
| <if test="dateUpdated != null"> |
| date_updated, |
| </if> |
| <if test="roleName != null"> |
| role_name, |
| </if> |
| <if test="description != null"> |
| description, |
| </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="roleName != null"> |
| #{roleName, jdbcType=VARCHAR}, |
| </if> |
| <if test="description != null"> |
| #{description, jdbcType=VARCHAR}, |
| </if> |
| </trim> |
| </insert> |
| |
| <update id="update" parameterType="org.apache.shenyu.admin.model.entity.RoleDO"> |
| UPDATE role |
| SET |
| date_created = #{dateCreated, jdbcType=TIMESTAMP}, |
| date_updated = #{dateUpdated, jdbcType=TIMESTAMP}, |
| role_name = #{roleName, jdbcType=VARCHAR}, |
| description = #{description, jdbcType=VARCHAR} |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </update> |
| |
| <update id="updateSelective" parameterType="org.apache.shenyu.admin.model.entity.RoleDO"> |
| UPDATE role |
| <set> |
| <if test="dateCreated != null"> |
| date_created = #{dateCreated, jdbcType=TIMESTAMP}, |
| </if> |
| <if test="dateUpdated != null"> |
| date_updated = #{dateUpdated, jdbcType=TIMESTAMP}, |
| </if> |
| <if test="roleName != null"> |
| role_name = #{roleName, jdbcType=VARCHAR}, |
| </if> |
| <if test="description != null"> |
| description = #{description, jdbcType=VARCHAR}, |
| </if> |
| </set> |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </update> |
| |
| <delete id="delete" parameterType="java.util.List"> |
| DELETE FROM role |
| WHERE id IN |
| <foreach item="id" collection="list" open="(" separator="," close=")"> |
| #{id, jdbcType=VARCHAR} |
| </foreach> |
| </delete> |
| </mapper> |