package com.fs.hisStore.controller.store;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.hisStore.domain.FsStoreScrm;
import com.fs.hisStore.domain.StoreLoginUserScrm;
import com.fs.hisStore.domain.SysOperLogScrm;
import com.fs.hisStore.service.ISysOperLogScrmService;
import com.fs.hisStore.utils.UserUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 操作日志记录
 *

 */
@RestController
@RequestMapping("/store/operlogScrm")
public class SysOperlogScrmController extends BaseController
{
    private final ISysOperLogScrmService operLogService;

    public SysOperlogScrmController(ISysOperLogScrmService operLogService) {
        this.operLogService = operLogService;
    }

    @GetMapping("/list")
    public TableDataInfo list(SysOperLogScrm operLog)
    {
        startPage();
        List<SysOperLogScrm> list = operLogService.selectOperLogList(operLog);
        return getDataTable(list);
    }

    @Log(title = "操作日志", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SysOperLogScrm operLog)
    {
        //FsStoreScrm store = UserUtil.getLoginUser().getFsStore();
        List<SysOperLogScrm> list = operLogService.selectOperLogList(operLog);
        ExcelUtil<SysOperLogScrm> util = new ExcelUtil<>(SysOperLogScrm.class);
        return util.exportExcel(list, "操作日志");
    }

}
