mappers.UserEntityMapper.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.UserEntityMapper"> <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.UserEntity"> <id column="id" jdbcType="INTEGER" property="id"/> <result column="name" jdbcType="VARCHAR" property="name"/> <result column="password" jdbcType="VARCHAR" property="password"/> <result column="secret_key" jdbcType="VARCHAR" property="secretKey"/> <result column="public_key" jdbcType="VARCHAR" property="publicKey"/> <result column="private_key" jdbcType="VARCHAR" property="privateKey"/> <result column="encrypt_version" jdbcType="INTEGER" property="encryptVersion"/> <result column="account_type" jdbcType="INTEGER" property="accountType"/> <result column="due_date" jdbcType="TIMESTAMP" property="dueDate"/> <result column="status" jdbcType="INTEGER" property="status"/> <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"/> <result column="ext_params" jdbcType="LONGVARCHAR" property="extParams"/> </resultMap> <sql id="Base_Column_List"> id, account_type, name, password, secret_key, public_key, private_key, encrypt_version, due_date, status, is_deleted, creator, modifier, create_time, modify_time, version, ext_params </sql> <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="org.apache.inlong.manager.dao.entity.UserEntity"> insert into user (id, name, password, secret_key, public_key, private_key, encrypt_version, account_type, due_date, status, creator, modifier, ext_params) values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{secretKey,jdbcType=VARCHAR}, #{publicKey,jdbcType=VARCHAR}, #{privateKey,jdbcType=VARCHAR}, #{encryptVersion,jdbcType=INTEGER}, #{accountType,jdbcType=INTEGER}, #{dueDate,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}, #{extParams,jdbcType=LONGVARCHAR}) </insert> <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from user where id = #{id,jdbcType=INTEGER} </select> <select id="selectByName" resultType="org.apache.inlong.manager.dao.entity.UserEntity"> select <include refid="Base_Column_List"/> from user where is_deleted = 0 and name = #{name, jdbcType=VARCHAR} </select> <select id="selectByCondition" parameterType="org.apache.inlong.manager.pojo.user.UserRequest" resultType="org.apache.inlong.manager.dao.entity.UserEntity"> select <include refid="Base_Column_List"/> from user <where> is_deleted = 0 <if test="accountType != null and accountType != ''"> and account_type = #{accountType, jdbcType=INTEGER} </if> <if test="name != null and name != ''"> and name = #{name, jdbcType=VARCHAR} </if> <if test="keyword != null and keyword != ''"> and name like CONCAT('%', #{keyword},'%') </if> </where> </select> <update id="updateById" parameterType="org.apache.inlong.manager.dao.entity.UserEntity"> update user set name = #{name,jdbcType=VARCHAR}, password = #{password,jdbcType=VARCHAR}, secret_key = #{secretKey,jdbcType=VARCHAR}, public_key = #{publicKey,jdbcType=VARCHAR}, private_key = #{privateKey,jdbcType=VARCHAR}, encrypt_version = #{encryptVersion,jdbcType=INTEGER}, account_type = #{accountType,jdbcType=INTEGER}, due_date = #{dueDate,jdbcType=TIMESTAMP}, status = #{status,jdbcType=INTEGER}, is_deleted = #{isDeleted,jdbcType=INTEGER}, modifier = #{modifier,jdbcType=VARCHAR}, version = #{version,jdbcType=INTEGER} + 1, ext_params = #{extParams,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=INTEGER} and version = #{version,jdbcType=INTEGER} </update> <update id="updateByPrimaryKeySelective" parameterType="org.apache.inlong.manager.dao.entity.UserEntity"> update user <set> <if test="name != null"> name = #{name,jdbcType=VARCHAR}, </if> <if test="password != null"> password = #{password,jdbcType=VARCHAR}, </if> <if test="secretKey != null"> secret_key = #{secretKey,jdbcType=VARCHAR}, </if> <if test="publicKey != null"> public_key = #{publicKey,jdbcType=VARCHAR}, </if> <if test="privateKey != null"> private_key = #{privateKey,jdbcType=VARCHAR}, </if> <if test="encryptVersion != null"> encrypt_version = #{encryptVersion,jdbcType=INTEGER}, </if> <if test="accountType != null"> account_type = #{accountType,jdbcType=INTEGER}, </if> <if test="dueDate != null"> due_date = #{dueDate,jdbcType=TIMESTAMP}, </if> <if test="status != null"> status = #{status,jdbcType=INTEGER}, </if> <if test="isDeleted != null"> is_deleted = #{isDeleted,jdbcType=INTEGER}, </if> <if test="modifier != null"> modifier = #{modifier,jdbcType=VARCHAR}, </if> <if test="extParams != null"> ext_params = #{extParams,jdbcType=LONGVARCHAR}, </if> version = #{version,jdbcType=INTEGER} + 1, </set> where id = #{id,jdbcType=INTEGER} and version = #{version,jdbcType=INTEGER} </update> <delete id="deleteById" parameterType="java.lang.Integer"> delete from user where id = #{id,jdbcType=INTEGER} </delete> </mapper>