All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.service.LoginController.ftl Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package ${afterEndBo.packageName}.service.${folderName}.controller;

import ${afterEndBo.packageName}.common.annotation.Inner;
import ${afterEndBo.packageName}.common.vo.${folderName}.SystemAccountVo;
import ${afterEndBo.packageName}.common.vo.${folderName}.SystemMenuVo;
import ${afterEndBo.packageName}.service.${folderName}.service.LoginService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.yes.tools.core.result.CommonResult;

import java.util.List;

/**
 * @author Co.
 * @name ${folderName}LoginController
 * @date 2023/4/10 15:07
 */
@Slf4j
@Tag(name = "后台登录控制器")
@RestController(value = "${folderName}LoginController")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @Inner
    @Operation(summary = "PC登录")
    @GetMapping(value = "<#if afterEndBo.isSpringCloud == 2>/api/${folderName}/admin/login")
    public CommonResult login(@RequestParam("account") String account, @RequestParam("pwd") String pwd) {
        String token = loginService.login(account, pwd);
        return CommonResult.success(token, "登录成功");
    }

    @Operation(summary = "获取用户信息")
    @GetMapping(value = "<#if afterEndBo.isSpringCloud == 2>/api/${folderName}/admin/getAccountInfo")
    public CommonResult getAccountInfo() {
        SystemAccountVo accountInfo = loginService.getAccountInfo();
        return CommonResult.success(accountInfo);
    }

    @Operation(summary = "获取用户菜单")
    @GetMapping(value = "<#if afterEndBo.isSpringCloud == 2>/api/${folderName}/admin/getMenuTree")
    public CommonResult> getMenuTree() {
        List menuTree = loginService.getMenuTree();
        return CommonResult.success(menuTree);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy