package com.jwipc.sys.controller.pc;

import com.jwipc.page.PageView;
import com.jwipc.sys.dto.MoldMoveDTO;
import com.jwipc.sys.logic.AuditLogLogic;
import com.jwipc.sys.model.dto.AuditLogDTO;
import com.jwipc.sys.model.query.AuditLogQuery;
import com.jwipc.util.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

import static com.jwipc.sys.constant.ModuleConst.MODULE_ROOT;

/**
 *
 * @author qzc
 * @since 2025-11-20
 */
@RestController
@RequestMapping(MODULE_ROOT +"/auditLog/rest")
@RequiredArgsConstructor
public class AuditLogRestController {

    private final AuditLogLogic auditLogLogic;


    /**
     * 列表
     * @param query
     * @return
     */
    @RequestMapping("/list")
    public PageView list(AuditLogQuery query) {
        return auditLogLogic.findByPage(query);
    }

    @PostMapping("/save")
    public ResponseEntity auditLogSave(AuditLogDTO auditLogDTO,HttpServletRequest request){
        auditLogDTO.setIp(RequestUtil.getIpAddress(request));
        auditLogLogic.auditLogSave(auditLogDTO);
        return ResponseEntity.ok(true);
    }

}
