package com.hzs.activity.declaration.controller.manage;


import com.hzs.activity.add.param.AcAddUpgradeListParam;
import com.hzs.activity.declaration.param.AcDeclarationListParam;
import com.hzs.activity.declaration.param.AcDeclarationListTotalParam;
import com.hzs.activity.declaration.service.IAcDeclarationGiftRecordService;
import com.hzs.activity.declaration.vo.AcDeclarationListVO;
import com.hzs.activity.declaration.vo.AcDeclarationTotalListVO;
import com.hzs.common.core.annotation.Log;
import com.hzs.common.core.enums.EOperationBusiness;
import com.hzs.common.core.enums.EOperationMethod;
import com.hzs.common.core.enums.EOperationModule;
import com.hzs.common.core.utils.poi.ExcelUtil;
import com.hzs.common.core.web.controller.BaseController;
import com.hzs.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 报单赠品明细表 前端控制器
 * </p>
 *
 * @author bd
 * @since 2025-10-13
 */
@RestController
@RequestMapping("/manage/acDeclarationRecord")
public class AcDeclarationGiftRecordController extends BaseController {

    @Autowired
    private IAcDeclarationGiftRecordService acDeclarationGiftRecordService;
    /**
     *
     * @param param
     * @return
     */
    @Log(module = EOperationModule.AC_DECLARATION_GIFT_LIST, business = EOperationBusiness.AC_DECLARATION_GIFT_LIST, method = EOperationMethod.SELECT)
    @GetMapping("/list")
    public TableDataInfo directPushUpgradeList(AcDeclarationListParam param) {
        startPage();
        return getDataTable(acDeclarationGiftRecordService.selectDeclarationList(param));
    }

    @Log(module = EOperationModule.AC_DECLARATION_GIFT_LIST_EXPORT, business = EOperationBusiness.AC_DECLARATION_GIFT_LIST_EXPORT, method = EOperationMethod.SELECT)
    @PostMapping("/listExport")
    public void export(AcDeclarationListParam param, HttpServletResponse response) {
        startPage();
        List<AcDeclarationListVO> list = acDeclarationGiftRecordService.selectDeclarationList(param);
        ExcelUtil<AcDeclarationListVO> util = new ExcelUtil<>(AcDeclarationListVO.class);
        util.exportExcel(response, list, "报单赠送明细数据导出");
    }
    /**
     *
     * @param param
     * @return
     */
    @Log(module = EOperationModule.AC_DECLARATION_GIFT_LIST_TOTAL, business = EOperationBusiness.AC_DECLARATION_GIFT_LIST_TOTAL, method = EOperationMethod.SELECT)
    @GetMapping("/list-total")
    public TableDataInfo directPushUpgradeListTotal(AcDeclarationListTotalParam param) {
        startPage();
        return getDataTable(acDeclarationGiftRecordService.selectDeclarationListTotal(param));
    }

    /**
     *
     * @param param
     * @return
     */
    @Log(module = EOperationModule.AC_DECLARATION_GIFT_LIST_TOTAL_EXPORT, business = EOperationBusiness.AC_DECLARATION_GIFT_LIST_TOTAL_EXPORT, method = EOperationMethod.SELECT)
    @PostMapping("/list-total-export")
    public void directPushUpgradeListTotalExport(AcDeclarationListTotalParam param, HttpServletResponse response) {
        startPage();
        List<AcDeclarationTotalListVO> list = acDeclarationGiftRecordService.selectDeclarationListTotal(param);
        ExcelUtil<AcDeclarationTotalListVO> util = new ExcelUtil<>(AcDeclarationTotalListVO.class);
        util.exportExcel(response, list, "报单赠送总计数据导出");
    }


}
