| <?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.ShenyuDictMapper"> |
| <resultMap id="BaseResultMap" type="org.apache.shenyu.admin.model.entity.ShenyuDictDO"> |
| <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="type" jdbcType="VARCHAR" property="type"/> |
| <result column="dict_code" jdbcType="VARCHAR" property="dictCode"/> |
| <result column="dict_name" jdbcType="VARCHAR" property="dictName"/> |
| <result column="dict_value" jdbcType="VARCHAR" property="dictValue"/> |
| <result column="desc" jdbcType="VARCHAR" property="desc"/> |
| <result column="sort" jdbcType="INTEGER" property="sort"/> |
| <result column="enabled" jdbcType="TINYINT" property="enabled"/> |
| </resultMap> |
| |
| <sql id="Base_Column_List"> |
| id, |
| `type`, |
| dict_code, |
| dict_name, |
| dict_value, |
| `desc`, |
| sort, |
| enabled, |
| date_created, |
| date_updated |
| </sql> |
| |
| <select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM shenyu_dict |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </select> |
| |
| <select id="selectByDictCodeAndDictName" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM shenyu_dict |
| WHERE dict_code = #{dictCode, jdbcType=VARCHAR} |
| AND dict_name = #{dictName, jdbcType=VARCHAR} |
| </select> |
| |
| <select id="findByType" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM shenyu_dict |
| WHERE `type` = #{type, jdbcType=VARCHAR} |
| </select> |
| |
| <select id="findByTypeBatch" resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM shenyu_dict |
| WHERE `type` IN |
| <foreach collection="typeList" item="type" open="(" separator="," close=")"> |
| #{type, jdbcType=VARCHAR} |
| </foreach> |
| </select> |
| |
| <delete id="delete" parameterType="java.lang.String"> |
| DELETE FROM shenyu_dict |
| WHERE id = #{id, jdbcType=VARCHAR} |
| </delete> |
| |
| <delete id="deleteByIdList"> |
| DELETE FROM shenyu_dict |
| WHERE id IN |
| <foreach collection="idList" item="id" index="index" open="(" separator="," close=")"> |
| #{id, jdbcType=VARCHAR} |
| </foreach> |
| </delete> |
| |
| <insert id="insert" parameterType="org.apache.shenyu.admin.model.entity.ShenyuDictDO"> |
| INSERT INTO shenyu_dict |
| (id, |
| `type`, |
| dict_code, |
| dict_name, |
| dict_value, |
| `desc`, |
| sort, |
| enabled, |
| date_created, |
| date_updated) |
| VALUES (#{id, jdbcType=VARCHAR}, |
| #{type, jdbcType=VARCHAR}, |
| #{dictCode, jdbcType=VARCHAR}, |
| #{dictName, jdbcType=VARCHAR}, |
| #{dictValue, jdbcType=VARCHAR}, |
| #{desc, jdbcType=VARCHAR}, |
| #{sort, jdbcType=INTEGER}, |
| #{enabled, jdbcType=TINYINT}, |
| #{dateCreated, jdbcType=TIMESTAMP}, |
| #{dateUpdated, jdbcType=TIMESTAMP}) |
| </insert> |
| |
| <insert id="insertSelective" parameterType="org.apache.shenyu.admin.model.entity.ShenyuDictDO"> |
| INSERT INTO shenyu_dict |
| <trim prefix="(" suffix=")" suffixOverrides=","> |
| <if test="id != null"> |
| id, |
| </if> |
| <if test="type != null"> |
| `type`, |
| </if> |
| <if test="dictCode != null"> |
| dict_code, |
| </if> |
| <if test="dictName != null"> |
| dict_name, |
| </if> |
| <if test="dictValue != null"> |
| dict_value, |
| </if> |
| <if test="desc != null"> |
| `desc`, |
| </if> |
| <if test="sort != null"> |
| sort, |
| </if> |
| <if test="enabled != null"> |
| enabled, |
| </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="type != null"> |
| #{type, jdbcType=VARCHAR}, |
| </if> |
| <if test="dictCode != null"> |
| #{dictCode, jdbcType=VARCHAR}, |
| </if> |
| <if test="dictName != null"> |
| #{dictName, jdbcType=VARCHAR}, |
| </if> |
| <if test="dictValue != null"> |
| #{dictValue, jdbcType=VARCHAR}, |
| </if> |
| <if test="desc != null"> |
| #{desc, jdbcType=VARCHAR}, |
| </if> |
| <if test="sort != null"> |
| #{sort, jdbcType=INTEGER}, |
| </if> |
| <if test="enabled != null"> |
| #{enabled, jdbcType=TINYINT}, |
| </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.ShenyuDictDO"> |
| UPDATE shenyu_dict |
| <set> |
| <if test="type != null"> |
| `type` = #{type, jdbcType=VARCHAR}, |
| </if> |
| <if test="dictCode != null"> |
| dict_code = #{dictCode, jdbcType=VARCHAR}, |
| </if> |
| <if test="dictName != null"> |
| dict_name = #{dictName, jdbcType=VARCHAR}, |
| </if> |
| <if test="dictValue != null"> |
| dict_value = #{dictValue, jdbcType=VARCHAR}, |
| </if> |
| <if test="desc != null"> |
| `desc` = #{desc, jdbcType=VARCHAR}, |
| </if> |
| <if test="sort != null"> |
| sort= #{sort, jdbcType=INTEGER}, |
| </if> |
| <if test="enabled != null"> |
| enabled= #{enabled, jdbcType=TINYINT}, |
| </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.ShenyuDictDO"> |
| UPDATE shenyu_dict |
| SET `type` = #{type, jdbcType=VARCHAR}, |
| dict_code = #{dictCode, jdbcType=VARCHAR}, |
| dict_name = #{dictName, jdbcType=VARCHAR}, |
| dict_value = #{dictValue, jdbcType=VARCHAR}, |
| `desc` = #{desc, jdbcType=VARCHAR}, |
| sort = #{sort, jdbcType=INTEGER}, |
| enabled = #{enabled, jdbcType=TINYINT}, |
| 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.ShenyuDictQuery" |
| resultType="java.lang.Integer"> |
| SELECT count(1) |
| FROM shenyu_dict |
| <where> |
| <if test="type != null and type != ''"> |
| AND `type` = #{type, jdbcType=VARCHAR} |
| </if> |
| <if test="dictCode != null and dictCode != ''"> |
| AND dict_code = #{dictCode, jdbcType=VARCHAR} |
| </if> |
| <if test="dictName != null and dictName != ''"> |
| AND dict_name = #{dictName, jdbcType=VARCHAR} |
| </if> |
| </where> |
| </select> |
| |
| <select id="selectByQuery" parameterType="org.apache.shenyu.admin.model.query.ShenyuDictQuery" |
| resultMap="BaseResultMap"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM shenyu_dict |
| <where> |
| <if test="type != null and type != ''"> |
| AND `type` = #{type, jdbcType=VARCHAR} |
| </if> |
| <if test="dictCode != null and dictCode != ''"> |
| AND dict_code = #{dictCode, jdbcType=VARCHAR} |
| </if> |
| <if test="dictName != null and dictName != ''"> |
| <bind name="dictNameLike" value="('%' + dictName + '%')"/> |
| AND dict_name LIKE #{dictNameLike, jdbcType=VARCHAR} |
| </if> |
| </where> |
| ORDER BY `type`, |
| sort ASC |
| </select> |
| |
| <select id="existed" resultType="java.lang.Boolean"> |
| SELECT true |
| FROM shenyu_dict |
| WHERE id = #{id} |
| LIMIT 1 |
| </select> |
| |
| <select id="selectByIds" resultType="org.apache.shenyu.admin.model.entity.ShenyuDictDO"> |
| SELECT |
| <include refid="Base_Column_List"/> |
| FROM shenyu_dict |
| WHERE id IN |
| <foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> |
| #{item} |
| </foreach> |
| </select> |
| |
| <update id="enabled"> |
| UPDATE shenyu_dict |
| SET enabled = #{enabled, jdbcType=TINYINT} |
| WHERE id IN |
| <foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> |
| #{item} |
| </foreach> |
| </update> |
| </mapper> |