|
@@ -3,11 +3,11 @@ package com.gyee.frame.controller.ticket;
|
|
import com.gyee.frame.common.dataSources.DataSource;
|
|
import com.gyee.frame.common.dataSources.DataSource;
|
|
import com.gyee.frame.common.dataSources.DataSourceType;
|
|
import com.gyee.frame.common.dataSources.DataSourceType;
|
|
import com.gyee.frame.common.domain.AjaxResult;
|
|
import com.gyee.frame.common.domain.AjaxResult;
|
|
-import com.gyee.frame.model.ticket.Ibsusers;
|
|
|
|
import com.gyee.frame.model.ticket.Labor;
|
|
import com.gyee.frame.model.ticket.Labor;
|
|
import com.gyee.frame.service.ticket.IbsusersService;
|
|
import com.gyee.frame.service.ticket.IbsusersService;
|
|
import com.gyee.frame.service.ticket.LaborService;
|
|
import com.gyee.frame.service.ticket.LaborService;
|
|
import com.gyee.frame.service.ticket.ShiroService;
|
|
import com.gyee.frame.service.ticket.ShiroService;
|
|
|
|
+import com.gyee.frame.util.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -23,19 +23,26 @@ public class LoginController {
|
|
@Autowired
|
|
@Autowired
|
|
ShiroService shiroService;
|
|
ShiroService shiroService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 登录入口
|
|
|
|
+ * @param username
|
|
|
|
+ * @param password
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@DataSource(value = DataSourceType.TICKET)
|
|
@DataSource(value = DataSourceType.TICKET)
|
|
@PostMapping(value = "sys/login")
|
|
@PostMapping(value = "sys/login")
|
|
- public AjaxResult login(@RequestParam("username") String username, @RequestParam("password") String password){
|
|
|
|
|
|
+ public AjaxResult login(@RequestParam("username") String username,
|
|
|
|
+ @RequestParam("password") String password){
|
|
Labor labor = laborService.getLabor(username, password);
|
|
Labor labor = laborService.getLabor(username, password);
|
|
- Ibsusers user = ibsusersService.findUser(username, password);
|
|
|
|
- if (labor == null || user == null)
|
|
|
|
|
|
+ if (labor == null)
|
|
return AjaxResult.error(4004, "用户名或密码错误");
|
|
return AjaxResult.error(4004, "用户名或密码错误");
|
|
|
|
|
|
- Map<String, Object> token = shiroService.createToken(labor);
|
|
|
|
|
|
+ Map<String, Object> token = shiroService.createToken(labor, password);
|
|
|
|
|
|
return AjaxResult.successData(token);
|
|
return AjaxResult.successData(token);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
@PostMapping(value = "sys/logout")
|
|
@PostMapping(value = "sys/logout")
|
|
public AjaxResult logout(@RequestHeader("token")String token){
|
|
public AjaxResult logout(@RequestHeader("token")String token){
|
|
shiroService.logout(token);
|
|
shiroService.logout(token);
|