我想问一下这里的Controller层调用Service接口是怎么传参的,一个接口不是有多个实现类吗,怎么知道下面的AdminService.login()
的返回值是哪个
LoginController
public class LoginController {
@Autowired
private IAdminService iAdminService;
@ApiOperation(value = "登录之后返回token对象")
@PostMapping("/login")
public RespBean login(@RequestBody AdminLoginParam adminLoginParam, HttpServletRequest request){
return iAdminService.login(adminLoginParam.getUsername(),adminLoginParam.getPassword(),adminLoginParam.getCode(),request);
}
AdminService接口
public interface IAdminService extends IService<Admin> {
//登录之后返回token
RespBean login(String username, String password, String code, HttpServletRequest request);
}
AdminService实现类
public class AdminServiceImpl implements IAdminService {
//登录后返回token
@Override
public RespBean login(String username, String password, String code, HttpServletRequest request) {
String kaptcha = (String) request.getSession().getAttribute("kaptcha");
if (StringUtils.isNullOrEmpty(code) || !kaptcha.equalsIgnoreCase(code)) {
return RespBean.error("验证码错误,请重新输入!");
}