package com.red.circle.console.app.command.admin.query;

import com.red.circle.console.app.convertor.OperationReqAppConvertor;
import com.red.circle.console.app.dto.clienobject.admin.OperationLogCO;
import com.red.circle.console.app.dto.cmd.admin.PageOperationLogQryCmd;
import com.red.circle.console.infra.database.rds.service.admin.OperationLogService;
import com.red.circle.framework.dto.PageResult;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 后台管理，操作认日志分页列表.
 *
 * @author pengliang on 2023/5/12
 */
@Component
@RequiredArgsConstructor
public class OperationReqLogPageQryExe {

  private final OperationLogService operationLogService;
  private final OperationReqAppConvertor operationReqAppConvertor;

  public PageResult<OperationLogCO> execute(PageOperationLogQryCmd cmd) {
    return operationLogService
        .pageLog(operationReqAppConvertor.toOperationLogQuery(cmd))
        .convert(operationReqAppConvertor::toOperationLogCO);
  }

}
