97 lines
5.0 KiB
XML
97 lines
5.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.rymcu.vertical.mapper.UserMapper">
|
|
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.User">
|
|
<!--
|
|
WARNING - @mbg.generated
|
|
-->
|
|
<id column="id" property="idUser"/>
|
|
<result column="account" property="account"/>
|
|
<result column="password" property="password"/>
|
|
<result column="nickname" property="nickname"/>
|
|
<result column="real_name" property="realName"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="avatar_type" property="avatarType"/>
|
|
<result column="avatar_url" property="avatarUrl"/>
|
|
<result column="email" property="email"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="status" property="status"/>
|
|
<result column="last_login_time" property="lastLoginTime"/>
|
|
<result column="created_time" property="createdTime"/>
|
|
<result column="updated_time" property="updatedTime"/>
|
|
</resultMap>
|
|
<resultMap id="UserInfoResultMapper" type="com.rymcu.vertical.dto.UserInfoDTO">
|
|
<result column="id" property="idUser"/>
|
|
<result column="account" property="account"/>
|
|
<result column="nickname" property="nickname"/>
|
|
<result column="sex" property="sex"/>
|
|
<result column="avatar_type" property="avatarType"/>
|
|
<result column="avatar_url" property="avatarUrl"/>
|
|
<result column="email" property="email"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="status" property="status"/>
|
|
<result column="last_login_time" property="lastLoginTime"/>
|
|
<result column="signature" property="signature"/>
|
|
</resultMap>
|
|
<resultMap id="DTOResultMapper" type="com.rymcu.vertical.dto.UserDTO">
|
|
<result column="id" property="idUser"/>
|
|
<result column="account" property="account"/>
|
|
<result column="nickname" property="nickname"/>
|
|
<result column="avatar_type" property="avatarType"/>
|
|
<result column="avatar_url" property="avatarUrl"/>
|
|
<result column="signature" property="signature"/>
|
|
</resultMap>
|
|
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
|
<result column="id" property="idUser"/>
|
|
<result column="nickname" property="userNickname"/>
|
|
<result column="avatar_url" property="userAvatarURL"/>
|
|
</resultMap>
|
|
<insert id="insertUserRole">
|
|
insert into vertical_user_role (id_user,id_role,created_time) values (#{idUser},#{idRole},sysdate())
|
|
</insert>
|
|
<update id="updatePasswordByAccount">
|
|
update vertical_user set password = #{password} where account = #{account}
|
|
</update>
|
|
<update id="updateUserRole">
|
|
update vertical_user_role set id_role = #{idRole},created_time = sysdate() where id_user = #{idUser}
|
|
</update>
|
|
<update id="updateStatus">
|
|
update vertical_user set status = #{status} where id = #{idUser}
|
|
</update>
|
|
<update id="updateUserInfo">
|
|
update vertical_user set nickname = #{nickname},email = #{email},signature = #{signature},avatar_type = #{avatarType},avatar_url = #{avatarUrl},sex = #{sex}
|
|
<if test="phone != null and phone != ''">
|
|
,phone = #{phone}
|
|
</if>
|
|
where id = #{idUser}
|
|
</update>
|
|
<update id="updateLastLoginTime">
|
|
update vertical_user set last_login_time = sysdate() where id = #{idUser}
|
|
</update>
|
|
|
|
<select id="findByAccount" resultMap="BaseResultMap">
|
|
select id, nickname, account, password, status from vertical_user where account = #{account} and status = 0
|
|
</select>
|
|
<select id="findUserInfoByAccount" resultMap="UserInfoResultMapper">
|
|
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, status, signature, last_login_time from vertical_user where account = #{account}
|
|
</select>
|
|
<select id="selectUserDTOByNickname" resultMap="DTOResultMapper">
|
|
select id, nickname, avatar_type, avatar_url, account, signature from vertical_user where nickname = #{nickname} and status = 0
|
|
</select>
|
|
<select id="selectRoleWeightsByUser" resultType="java.lang.Integer">
|
|
select vr.weights from vertical_role vr left join vertical_user_role vur on vr.id = vur.id_role where vur.id_user = #{idUser}
|
|
</select>
|
|
<select id="selectCountByNickName" resultType="java.lang.Integer">
|
|
select count(*) from vertical_user where nickname = #{nickname}
|
|
</select>
|
|
<select id="selectUserInfo" resultMap="UserInfoResultMapper">
|
|
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, status, signature, last_login_time from vertical_user where id = #{idUser}
|
|
</select>
|
|
<select id="checkNicknameByIdUser" resultType="java.lang.Integer">
|
|
select count(*) from vertical_user where nickname = #{nickname} and id != #{idUser}
|
|
</select>
|
|
<select id="selectAuthor" resultMap="AuthorResultMap">
|
|
select * from vertical_user where id = #{id}
|
|
</select>
|
|
|
|
</mapper> |