42 lines
1.2 KiB
Java
42 lines
1.2 KiB
Java
package co.jp.app.controller;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import co.jp.app.entity.ErrorEntity;
|
|
import co.jp.app.entity.UserEntity;
|
|
import co.jp.app.service.erraService;
|
|
import co.jp.app.service.userService;
|
|
|
|
|
|
@CrossOrigin("http://192.168.1.50:5173")
|
|
@RestController("/api/login")
|
|
public class loginController {
|
|
|
|
@Autowired
|
|
private userService userService;
|
|
|
|
@Autowired
|
|
private erraService erraService;
|
|
|
|
@GetMapping("/status")
|
|
public String getStatusByNameOrEmail() {
|
|
String input="aaa";
|
|
|
|
// input 可能是名字 或 email
|
|
UserEntity userByName = userService.getNameByEntity(input);
|
|
UserEntity userByEmail = userService.getEmailByEntity(input);
|
|
|
|
if (userByName == null && userByEmail == null) {
|
|
return "全項目に入力してください";
|
|
}
|
|
|
|
// 如果有找到,就固定使用 ID 1001 去查 erraEntity
|
|
ErrorEntity erra = erraService.getStatusById(1001);
|
|
|
|
return erra.getStatus();
|
|
}
|
|
}
|