package com.project.zcustom.controller.system;

import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.domain.system.LoginBody;
import com.project.zcustom.service.system.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author bqyang
 * @Date 2025/2/25 18:27
 * @Version 1.0
 */
@RestController
@RequestMapping("/user")
public class LoginController {

    @Autowired
    private ISysUserService sysUserService;

    @PostMapping("/doLogin")
    public AjaxResult login(@Validated @RequestBody LoginBody loginBody) {
        String token = sysUserService.login(loginBody.getUsername(), loginBody.getPassword());
        return AjaxResult.success("操作成功",token);
    }
}
