Search in sources :

Example 1 with LogAnnotation

use of com.moon.admin.common.utils.LogAnnotation in project moon by gentoo111.

the class FileController method uploadLayuiFile.

/**
 * layui富文本文件自定义上传
 *
 * @param file
 * @param domain
 * @return
 * @throws IOException
 */
@LogAnnotation
@PostMapping("/layui")
@ApiOperation(value = "layui富文本文件自定义上传")
public LayuiFile uploadLayuiFile(MultipartFile file, String domain) throws IOException {
    FileInfo fileInfo = fileService.save(file);
    LayuiFile layuiFile = new LayuiFile();
    layuiFile.setCode(0);
    LayuiFile.LayuiFileData data = new LayuiFile.LayuiFileData();
    layuiFile.setData(data);
    data.setSrc(domain + "/files" + fileInfo.getUrl());
    data.setTitle(file.getOriginalFilename());
    return layuiFile;
}
Also used : LayuiFile(com.moon.admin.vo.LayuiFile) FileInfo(com.moon.admin.domain.FileInfo) LogAnnotation(com.moon.admin.common.utils.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with LogAnnotation

use of com.moon.admin.common.utils.LogAnnotation in project moon by gentoo111.

the class LoginController method restfulLogin.

@LogAnnotation
@ApiOperation(value = "restful登录方式,前后端分离时的接口")
@PostMapping("/sys/login/restful")
public Token restfulLogin(String username, String password) {
    UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password);
    SecurityUtils.getSubject().login(usernamePasswordToken);
    return tokenManeger.saveToken(usernamePasswordToken);
}
Also used : UsernamePasswordToken(org.apache.shiro.authc.UsernamePasswordToken) LogAnnotation(com.moon.admin.common.utils.LogAnnotation) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with LogAnnotation

use of com.moon.admin.common.utils.LogAnnotation in project moon by gentoo111.

the class LoginController method login.

@LogAnnotation
@ApiOperation(value = "web端登陆")
@PostMapping("/sys/login")
public void login(String username, String password) {
    UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password);
    SecurityUtils.getSubject().login(usernamePasswordToken);
}
Also used : UsernamePasswordToken(org.apache.shiro.authc.UsernamePasswordToken) LogAnnotation(com.moon.admin.common.utils.LogAnnotation) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

LogAnnotation (com.moon.admin.common.utils.LogAnnotation)3 ApiOperation (io.swagger.annotations.ApiOperation)3 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 FileInfo (com.moon.admin.domain.FileInfo)1 LayuiFile (com.moon.admin.vo.LayuiFile)1