liurunyu
2024-04-24 e430bfca38cdae9dd230f951e108a75caebccb61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.dy.pmsBase.log;
 
import com.dy.common.aop.SsoPowerAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.aop.LogSv;
import com.dy.pmsGlobal.aop.Log;
import com.dy.pmsGlobal.pojoBa.BaLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
@Slf4j
@RestController
@RequestMapping(path = "log")
@SuppressWarnings("unchecked")
public class LogCtrl {
    private LogSv sv;
    @Autowired
    public void setSv(LogSv sv) {
        this.sv = sv;
    }
 
    /**
     * 根据id查询日志
     * @return
     */
    @GetMapping(path = "one")
    @SsoPowerAop(power = "10100010") //登录与权限同时验证
    @Log("查询单条日志")
    public BaseResponse<BaLog> one(String id){
        try {
            return BaseResponseUtils.buildSuccess(sv.selectById(Long.parseLong(id)));
        } catch (Exception e) {
            log.error("查询单条日志数据异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
 
    /**
     * 分页查询日志
     * @return
     */
    @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoPowerAop(power = "10100010") //登录与权限同时验证
    @Log("分页查询日志")
    public BaseResponse<QueryResultVo<List<BaLog>>> some(@RequestBody QueryVo vo){
        try {
            QueryResultVo<List<BaLog>> res = sv.selectSome(vo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("分页查询日志异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
 
}