用户登陆功能实现,基本接口鉴权功能实现

This commit is contained in:
2025-06-12 13:31:52 +08:00
parent e8296042e3
commit 02eb5a7484
15 changed files with 510 additions and 14 deletions

View File

@@ -89,4 +89,38 @@ knife4j:
default:
api-rule: package
api-rule-resources:
- com.yupi.springbootinit.controller
- com.yupi.springbootinit.controller
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: vvtoken
# token 有效期(单位:秒) 默认30天-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: false
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token
is-share: false
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik
token-style: uuid
# 是否输出操作日志
is-log: true
# security配置如果使用了Spring security或者satoken需要添加排除路径
security:
# 排除路径
excludes:
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /favicon.ico
- /error/**
#swagger文档和knife4j的路径
- /v3/api-docs/**
- /doc.html/**
md5:
salt: (-FhqvXO,wMz

View File

@@ -0,0 +1,41 @@
<?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.yupi.springbootinit.mapper.SystemUsersMapper">
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.SystemUsers">
<!--@mbg.generated-->
<!--@Table system_users-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="dept_id" jdbcType="BIGINT" property="deptId" />
<result column="post_ids" jdbcType="VARCHAR" property="postIds" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="sex" jdbcType="TINYINT" property="sex" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="login_ip" jdbcType="VARCHAR" property="loginIp" />
<result column="login_date" jdbcType="TIMESTAMP" property="loginDate" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="updater" jdbcType="VARCHAR" property="updater" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, username, `password`, nickname, remark, dept_id, post_ids, email, mobile, sex,
avatar, `status`, login_ip, login_date, creator, create_time, updater, update_time,
deleted, tenant_id
</sql>
<select id="selectUsername" resultType="int">
select
<include refid="Base_Column_List">
</include>
from system_users where username = #{userName,jdbcType=VARCHAR}
</select>
</mapper>