package vip.xiaonuo.disk.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.disk.service.IOperationLogService;
import vip.xiaonuo.disk.util.PageQuery;
import vip.xiaonuo.disk.util.TableDataInfo;
import vip.xiaonuo.disk.vo.operationLog.OperationLogBeanVo;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Tag(name = "operationLog", description = "日志操作接口")
@RestController
@Slf4j
@RequestMapping("/operationLog")
public class OperationLogBeanController {

    @Resource
    private IOperationLogService iOperationLogService;
    @Operation(summary = "获取操作日志列表", description = "获取操作日志列表", tags = {"file"})
    @RequestMapping(value = "/getList", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<List<OperationLogBeanVo>> getList(String type){
        List<OperationLogBeanVo> list =iOperationLogService.selectOperationLog(type);
        return CommonResult.data(list);
    }



    @Operation(summary = "获取全部资源日志", description = "获取全部资源日志", tags = {"file"})
    @RequestMapping(value = "/getAllList", method = RequestMethod.GET)
    @ResponseBody
    public TableDataInfo<Map<String,Object>> getAllList(@RequestParam(value = "type", required = false) String type,
                                                              @RequestParam(value = "startDate", required = false) String startDate,
                                                              @RequestParam(value = "endDate", required = false) String endDate,
                                                              @RequestParam(value = "userName", required = false) String userName, PageQuery pageQuery
    ){
        return iOperationLogService.getAllList(type,startDate,endDate,userName,pageQuery);
    }





}
