3
13693261870
2022-09-16 63ba114e70e380442fcbed4a5157ee52c9491216
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.landtool.lanbase.modules.log.controller;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.landtool.lanbase.modules.log.entity.LogAction;
import com.landtool.lanbase.modules.log.service.LogActionService;
import com.landtool.lanbase.modules.sys.controller.AbstractController;
import com.landtool.lanbase.common.utils.PageUtils;
import com.landtool.lanbase.common.utils.Query;
import com.landtool.lanbase.common.utils.Result;
 
/**
 * @author lanbase
 * @Description: TODO(系统模块操作日志表)
 * @date 2018-01-16 09:18:41
 */
@RestController
@RequestMapping("/log/action")
@Api(value = "", tags = {"系统模块操作日志"})
public class LogActionController extends AbstractController{
 
    @Autowired
    private LogActionService actionService;
    
 
    
    /**
     * 列表
     */
//    @com.landtool.lanbase.common.annotation.LogAction("运维监控,事件日志管理,事件日志管理查询,查询")
    @RequestMapping(value="/list",method ={RequestMethod.POST, RequestMethod.GET})
//    @RequiresPermissions("log:action:list")
    @RequiresPermissions(value={"log:action:list","log:action:edit"}, logical= Logical.OR)
    @ApiOperation(
            value = "系统模块操作日志",
            notes = "系统模块操作日志列表"
            )
    public Result list(@ApiParam(name="params",value="",required=true)@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        String UserName=(String) query.get("UserName");
        if(UserName!=""&&UserName!=null){
            query.put("UserName", UserName);
        }
        List<LogAction> actionList = actionService.queryList(query);
        int total = actionService.queryTotal(query);
        
        PageUtils pageUtil = new PageUtils(actionList, total, query.getLimit(), query.getPage());
        
        return Result.ok().put("page", pageUtil);
    }
    
    
    /**
     * 信息
     */
    @GetMapping("/info/{actionid}")
    @ApiOperation(
            value = "系统模块操作日志",
            notes = ""
            )
    public Result info(@ApiParam(name="actionid",value="",required=true)@PathVariable("actionid") Long actionid){
        LogAction action = actionService.queryObject(actionid);
        
        return Result.ok().put("action", action);
    }
    
    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation(
            value = "保存模块操作日志",
            notes = ""
            )
    public Result save(@ApiParam(name="模块操作日志对象",value="传入json格式",required=true)@RequestBody LogAction action){
        actionService.save(action);
        
        return Result.ok();
    }
    
    /**
     * 修改
     */
    @PostMapping(value="/update")
    @ApiOperation(
            value = "修改模块操作日志",
            notes = ""
            )
    public Result update(@ApiParam(name="模块操作日志对象",value="传入json格式",required=true)@RequestBody LogAction action){
        actionService.update(action);
        
        return Result.ok();
    }
    
    /**
     * 删除
     */
    @PostMapping(value="/delete")
    @ApiOperation(
            value = "删除模块操作日志",
            notes = ""
            )
    public Result delete(@ApiParam(name="actionid",value="actionid",required=true)@RequestBody Long[] actionids){
        actionService.deleteBatch(actionids);
        
        return Result.ok();
        
    }
    
    /**
     * 获取操作类型
     */
    @GetMapping("/actionType")
    public Result actionType(){
        List<String> actionTypes = actionService.queryActionType();
        return Result.ok().put("actionTypes", actionTypes);
    }
 
    /**
     * 获取操作类型
     */
    @GetMapping("/analyseResource")
    public Result analyseResourceAction( int count){
        Map<String, Object> parm= new HashMap<>();
        parm.put("count",count);
        List<Map<String,Object>> actionTypes = actionService.queryAnalyseResourceAction(parm);
        return Result.ok().put("actionTypes", actionTypes);
 
    }
 
}