package cn.ezhizao.project.business.history.controller;

import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import cn.ezhizao.project.business.history.domain.BizHistory;
import cn.ezhizao.project.business.history.service.IBizHistoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.ezhizao.framework.aspectj.lang.annotation.Log;
import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
import cn.ezhizao.framework.web.controller.BaseController;
import cn.ezhizao.framework.web.domain.AjaxResult;
import cn.ezhizao.common.utils.poi.ExcelUtil;
import cn.ezhizao.framework.web.page.TableDataInfo;

/**
 * 企业租户Controller
 *
 * @author ruoyi
 * @date 2024-09-09
 */
@RestController
@RequestMapping("/business/history")
public class BizHistoryController extends BaseController
{
    @Resource
    private IBizHistoryService bizHistoryService;

    /**
     * 查询
     */
    @GetMapping("/list")
    public TableDataInfo list(BizHistory bizHistory) throws NoSuchFieldException, IllegalAccessException
    {
        setTenantId(bizHistory);
        startPage();
        List<BizHistory> list = bizHistoryService.getList(bizHistory);
        return getDataTable(list);
    }

    /**
     * 导出
     */
    @Log(title = "企业租户", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizHistory bizHistory) throws NoSuchFieldException, IllegalAccessException
    {
        setTenantId(bizHistory);
        List<BizHistory> list = bizHistoryService.getList(bizHistory);
        ExcelUtil<BizHistory> util = new ExcelUtil<BizHistory>(BizHistory.class);
        util.exportExcel(response, list, "企业租户数据");
    }



}
