package com.simuwang.manage.api.log;

import com.simuwang.base.common.support.MybatisPage;
import com.simuwang.base.pojo.dto.query.LogPageQuery;
import com.simuwang.base.pojo.vo.IdListVO;
import com.simuwang.base.pojo.vo.LoggingVO;
import com.simuwang.logging.LoggingService;
import com.simuwang.logging.SystemLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 日志管理
 * Author:   chenjianhua
 * Date:     2024/9/28 20:51
 * Description: ${DESCRIPTION}
 */
@SystemLog("日志管理")
@RestController
@RequestMapping("/v1/log")
public class LogController {
    @Autowired
    private LoggingService loggingService;

    /**
     * 日志查询列表
     * @param logPageQuery
     * @return
     */
    @SystemLog(value = "查询日志列表")
    @GetMapping("/search-log-list")
    public MybatisPage<LoggingVO> searchLogList(LogPageQuery logPageQuery){
        MybatisPage<LoggingVO> result = loggingService.searchLogList(logPageQuery);
        return result;
    }



    /**
     * 日志删除
     * @param idListVO
     * @return
     */
    @SystemLog(value = "删除日志",type = SystemLog.Type.DELETE)
    @PostMapping("/delete-log")
    public boolean deleteLog(@RequestBody IdListVO idListVO){
        loggingService.deleteLog(idListVO);
        return true;
    }
}
