mappers.InlongUserRoleEntityMapper.xml Maven / Gradle / Ivy
The newest version!
<?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" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.apache.inlong.manager.dao.mapper.InlongUserRoleEntityMapper"> <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongUserRoleEntity"> <id column="id" jdbcType="INTEGER" property="id"/> <result column="username" jdbcType="VARCHAR" property="username"/> <result column="role_code" jdbcType="VARCHAR" property="roleCode"/> <result column="disabled" jdbcType="SMALLINT" property="disabled"/> <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/> <result column="creator" jdbcType="VARCHAR" property="creator"/> <result column="modifier" jdbcType="VARCHAR" property="modifier"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/> <result column="version" jdbcType="INTEGER" property="version"/> </resultMap> <sql id="Base_Column_List"> id, username, role_code, disabled, is_deleted, creator, modifier, create_time, modify_time, version </sql> <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="org.apache.inlong.manager.dao.entity.InlongUserRoleEntity"> insert into inlong_user_role (id, username, role_code, disabled, creator, modifier) values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{roleCode,jdbcType=VARCHAR}, #{disabled,jdbcType=SMALLINT}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}) </insert> <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from inlong_user_role where id = #{id,jdbcType=INTEGER} </select> <select id="selectByUsername" parameterType="java.lang.String" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from inlong_user_role where is_deleted = 0 and username = #{username,jdbcType=VARCHAR} </select> <update id="updateById" parameterType="org.apache.inlong.manager.dao.entity.InlongUserRoleEntity"> update inlong_user_role set username = #{username,jdbcType=VARCHAR}, role_code = #{roleCode,jdbcType=VARCHAR}, disabled = #{disabled,jdbcType=SMALLINT}, modifier = #{modifier,jdbcType=VARCHAR}, version = #{version,jdbcType=INTEGER} + 1 where id = #{id,jdbcType=INTEGER} and version = #{version,jdbcType=INTEGER} </update> <delete id="deleteById" parameterType="java.lang.Integer"> delete from inlong_user_role where id = #{id,jdbcType=INTEGER} </delete> <select id="selectByCondition" parameterType="org.apache.inlong.manager.pojo.user.InlongRolePageRequest" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from inlong_user_role where is_deleted = 0 <if test="username != null and username != ''"> and username = #{username, jdbcType=VARCHAR} </if> <if test="roleCode != null and roleCode != ''"> and role_code = #{roleCode,jdbcType=VARCHAR} </if> <if test="disabled != null"> and disabled = #{disabled, jdbcType=SMALLINT} </if> </select> </mapper>