package com.kuyuntech.vrv.platform.controller.core;

import com.kuyuntech.vrv.coreapi.bean.core.RoleBean;
import com.kuyuntech.vrv.coreapi.bean.core.UserBean;
import com.kuyuntech.vrv.coreapi.service.core.UserService;
import com.wbspool.fastboot.core.common.bean.ResponseBean;
import com.wbspool.fastboot.core.common.constant.ValidGroup;
import com.wbspool.fastboot.core.web.annotation.ParamErrorAutoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AuthController {

    @Autowired
    UserService userService;

    /**
     * 登录
     * @param userBean
     * @return
     */
    @RequestMapping
    @ParamErrorAutoResponse
    public Object login(UserBean userBean) {

        userBean = this.userService.login(userBean);

        if (userBean == null) {
            return ResponseBean.serverError("用户名或密码错误，操作失败！");
        }

        return ResponseBean.success("登录成功！");
    }


}
