feat:企业登录
parent
1272d0e0b7
commit
798f509dec
|
@ -57,6 +57,10 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.muyu.auth.controller;
|
||||
|
||||
import com.muyu.auth.form.Firm;
|
||||
import com.muyu.auth.form.LoginBody;
|
||||
import com.muyu.auth.form.RegisterBody;
|
||||
import com.muyu.auth.service.SysFirmService;
|
||||
import com.muyu.auth.service.SysLoginService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.JwtUtils;
|
||||
|
@ -31,8 +33,16 @@ public class TokenController {
|
|||
@Autowired
|
||||
private SysLoginService sysLoginService;
|
||||
|
||||
@Autowired
|
||||
private SysFirmService sysFirmService;
|
||||
|
||||
@PostMapping("login")
|
||||
public Result<?> login (@RequestBody LoginBody form) {
|
||||
//查询企业是否存在
|
||||
Firm firm = sysFirmService.findFirmByName(form.getFirmName());
|
||||
if (firm.getDatabaseName() == null){
|
||||
return Result.error(null,"企业不存在");
|
||||
}
|
||||
// 用户登录
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||
// 获取登录token
|
||||
|
|
|
@ -10,8 +10,12 @@ import lombok.Data;
|
|||
* @date 2024/9/30 10:30
|
||||
*/
|
||||
@Data
|
||||
public class Enterprise {
|
||||
public class Firm {
|
||||
|
||||
/**
|
||||
* 企业id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
|
@ -1,10 +1,14 @@
|
|||
package com.muyu.auth.form;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LoginBody {
|
||||
/**
|
||||
* 用户名
|
||||
|
@ -16,20 +20,11 @@ public class LoginBody {
|
|||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String firmName;
|
||||
|
||||
public String getUsername () {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername (String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword () {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword (String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue