拆分模块
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.ecep.contract.controller;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 基础控制器,处理根路径请求和错误处理
|
||||
*/
|
||||
@RestController
|
||||
public class IndexController {
|
||||
|
||||
/**
|
||||
* 处理根路径请求,返回系统状态信息
|
||||
*/
|
||||
@GetMapping("/")
|
||||
public ResponseEntity<?> index() {
|
||||
return ResponseEntity.ok("合同管理系统 REST API 服务已启动");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理错误路径请求,避免Whitelabel Error Page显示
|
||||
*/
|
||||
@GetMapping("/error")
|
||||
public ResponseEntity<?> error() {
|
||||
return ResponseEntity.status(404).body("请求的资源不存在");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ecep.contract.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* 登录控制器
|
||||
* 处理登录页面请求和登录相关操作
|
||||
*/
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
/**
|
||||
* 提供登录页面
|
||||
* 当用户访问/login路径时,返回登录页面视图
|
||||
*/
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
return "login.html";
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理登录成功后的跳转
|
||||
* 这个方法在Spring Security配置中通过defaultSuccessUrl指定
|
||||
*/
|
||||
@GetMapping("/login/success")
|
||||
public String loginSuccess() {
|
||||
// 登录成功后重定向到首页
|
||||
return "redirect:/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理登录失败后的跳转
|
||||
* 可以根据需要自定义登录失败的处理逻辑
|
||||
*/
|
||||
@GetMapping("/login/failure")
|
||||
public String loginFailure() {
|
||||
// 登录失败后重定向回登录页面,并添加错误参数
|
||||
return "redirect:/login?error";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user