package cn.iocoder.yudao.module.crm.controller.admin.crmoperatelog;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.crm.controller.admin.crmoperatelog.vo.CrmOperatelogPageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.crmoperatelog.vo.CrmOperatelogRespVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.crmoperatelog.CrmOperatelogDO;
import cn.iocoder.yudao.module.crm.service.crmoperatelog.CrmOperatelogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 操作日志")
@RestController
@RequestMapping("/crm/operatelog")
@Validated
public class CrmOperatelogController {

    @Resource
    private CrmOperatelogService operatelogService;



    @GetMapping("/page")
    @Operation(summary = "获得操作日志分页")
    public CommonResult<PageResult<CrmOperatelogRespVO>> getOperatelogPage(@Valid CrmOperatelogPageReqVO pageReqVO) {
        PageResult<CrmOperatelogDO> pageResult = operatelogService.getOperatelogPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, CrmOperatelogRespVO.class));
    }


}
