package com.dxhy.admin.sys.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.*;

import com.dxhy.admin.sys.service.LoginService;
import com.dxhy.common.aspect.SysLog;
import com.dxhy.common.vo.UserInfo;

import lombok.extern.slf4j.Slf4j;

/**
 * @author jiaohongyang
 */
@RestController
@RequestMapping("api")
@Slf4j
public class LoginController {
    @Resource
    private LoginService loginService;

    @RequestMapping(value = "/user/validate", method = RequestMethod.POST)
    @ResponseBody
    @SysLog("用户登录")
    public UserInfo validate(@RequestBody Map<String, String> body) {
        return loginService.validate(body.get("username"), body.get("password"));
    }

    @RequestMapping(value = "/user/listInfo", method = RequestMethod.POST)
    @ResponseBody
    public UserInfo listInfo(@RequestBody String loginname) {
        return loginService.infoList(loginname);
    }
}