Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhonghong
custom-server
Commits
28b55cc2
Commit
28b55cc2
authored
Jul 14, 2026
by
Lizh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: P0 Step 1.8 — SysLoginController 登录/用户信息/路由/登出 4 端点
Co-Authored-By: Claude <noreply@anthropic.com>
parent
c9f598be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/system/SysLoginController.java
+75
-0
No files found.
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/system/SysLoginController.java
0 → 100644
View file @
28b55cc2
package
com
.
jomalls
.
custom
.
webapp
.
controller
.
system
;
import
com.jomalls.custom.app.service.system.SysLoginService
;
import
com.jomalls.custom.app.vo.LoginUserInfoVO
;
import
com.jomalls.custom.app.vo.RouterVO
;
import
com.jomalls.custom.utils.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 登录鉴权控制器
*
* @author Lizh
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@Tag
(
name
=
"登录鉴权"
)
public
class
SysLoginController
{
private
final
SysLoginService
sysLoginService
;
/**
* 用户登录
*/
@PostMapping
(
"/api/v2/login"
)
@Operation
(
summary
=
"用户登录"
)
public
R
<
Map
<
String
,
String
>>
login
(
@RequestBody
Map
<
String
,
String
>
body
)
{
String
username
=
body
.
get
(
"username"
);
String
password
=
body
.
get
(
"password"
);
log
.
info
(
"用户[{}]尝试登录"
,
username
);
String
token
=
sysLoginService
.
login
(
username
,
password
);
Map
<
String
,
String
>
result
=
new
HashMap
<>();
result
.
put
(
"token"
,
token
);
log
.
info
(
"用户[{}]登录成功"
,
username
);
return
R
.
ok
(
result
);
}
/**
* 获取用户信息
*/
@GetMapping
(
"/api/v2/getInfo"
)
@Operation
(
summary
=
"获取当前用户信息"
)
public
R
<
LoginUserInfoVO
>
getInfo
()
{
LoginUserInfoVO
info
=
sysLoginService
.
getInfo
();
return
R
.
ok
(
info
);
}
/**
* 获取路由菜单
*/
@GetMapping
(
"/api/v2/getRouters"
)
@Operation
(
summary
=
"获取前端路由菜单"
)
public
R
<
List
<
RouterVO
>>
getRouters
()
{
List
<
RouterVO
>
routers
=
sysLoginService
.
getRouters
();
return
R
.
ok
(
routers
);
}
/**
* 退出登录
*/
@PostMapping
(
"/api/v2/logout"
)
@Operation
(
summary
=
"退出登录"
)
public
R
<
Void
>
logout
()
{
log
.
info
(
"用户退出登录"
);
return
R
.
ok
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment