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 params){ //查询列表数据 Query query = new Query(params); String UserName=(String) query.get("UserName"); if(UserName!=""&&UserName!=null){ query.put("UserName", UserName); } List 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 actionTypes = actionService.queryActionType(); return Result.ok().put("actionTypes", actionTypes); } /** * 获取操作类型 */ @GetMapping("/analyseResource") public Result analyseResourceAction( int count){ Map parm= new HashMap<>(); parm.put("count",count); List> actionTypes = actionService.queryAnalyseResourceAction(parm); return Result.ok().put("actionTypes", actionTypes); } }