refactor(auth):重构认证服务,分离用户逻辑到独立服务

- 将用户相关业务迁移至用户模块,通过OpenFeign远程调用。
This commit is contained in:
Hanserwei
2025-10-04 22:03:09 +08:00
parent 19457b5638
commit 534a49a358
48 changed files with 697 additions and 521 deletions

View File

@@ -34,13 +34,6 @@ spring:
mail.smtp.starttls.required: true
server:
port: 8080 # 项目启动的端口
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
global-config:
banner: false
mapper-locations: classpath*:/mapperxml/*.xml
logging:
level:
com.hanserwei.hannote.auth.domain.mapper: debug
@@ -62,5 +55,3 @@ sa-token:
token-style: random-128
# 是否输出操作日志
is-log: true
alarm:
type: mail # 告警类型

View File

@@ -1,33 +0,0 @@
<?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.hanserwei.hannote.auth.domain.mapper.PermissionDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.auth.domain.dataobject.PermissionDO">
<!--@mbg.generated-->
<!--@Table t_permission-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="menu_url" jdbcType="VARCHAR" property="menuUrl" />
<result column="menu_icon" jdbcType="VARCHAR" property="menuIcon" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="permission_key" jdbcType="VARCHAR" property="permissionKey" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, parent_id, `name`, `type`, menu_url, menu_icon, sort, permission_key, `status`,
create_time, update_time, is_deleted
</sql>
<select id="selectAppEnabledList" resultMap="BaseResultMap">
select id, name, permission_key
from t_permission
where status = 0
and type = 3
and is_deleted = 0
</select>
</mapper>

View File

@@ -1,37 +0,0 @@
<?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.hanserwei.hannote.auth.domain.mapper.RoleDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.auth.domain.dataobject.RoleDO">
<!--@mbg.generated-->
<!--@Table t_role-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="role_name" jdbcType="VARCHAR" property="roleName" />
<result column="role_key" jdbcType="VARCHAR" property="roleKey" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, role_name, role_key, `status`, sort, remark, create_time, update_time, is_deleted
</sql>
<select id="selectEnabledList" resultMap="BaseResultMap">
select id, role_key, role_name
from t_role
where status = 0
and is_deleted = 0;
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_role
where id = #{id,jdbcType=BIGINT}
and is_deleted = 0
and status = 0;
</select>
</mapper>

View File

@@ -1,27 +0,0 @@
<?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.hanserwei.hannote.auth.domain.mapper.RolePermissionDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.auth.domain.dataobject.RolePermissionDO">
<!--@mbg.generated-->
<!--@Table t_role_permission_rel-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
<result column="permission_id" jdbcType="BIGINT" property="permissionId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, role_id, permission_id, create_time, update_time, is_deleted
</sql>
<select id="selectByRoleIds" resultMap="BaseResultMap">
select role_id, permission_id
from t_role_permission_rel
where role_id in
<foreach collection="roleIds" item="roleId" separator="," open="(" close=")">
#{roleId}
</foreach>
</select>
</mapper>

View File

@@ -1,27 +0,0 @@
<?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.hanserwei.hannote.auth.domain.mapper.UserDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.auth.domain.dataobject.UserDO">
<!--@mbg.generated-->
<!--@Table t_user-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="han_note_id" jdbcType="VARCHAR" property="hanNoteId" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="birthday" jdbcType="DATE" property="birthday" />
<result column="background_img" jdbcType="VARCHAR" property="backgroundImg" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="sex" jdbcType="TINYINT" property="sex" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="introduction" jdbcType="VARCHAR" property="introduction" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, han_note_id, `password`, nickname, avatar, birthday, background_img, email, sex,
`status`, introduction, create_time, update_time, is_deleted
</sql>
</mapper>

View File

@@ -1,18 +0,0 @@
<?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.hanserwei.hannote.auth.domain.mapper.UserRoleDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.auth.domain.dataobject.UserRoleDO">
<!--@mbg.generated-->
<!--@Table t_user_role_rel-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, role_id, create_time, update_time, is_deleted
</sql>
</mapper>