package com.dsk.cscec.controller;


import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.common.excel.ExcelUtils;
import com.dsk.cscec.domain.DCustomer;
import com.dsk.cscec.domain.bo.DCustomerSearchBo;
import com.dsk.cscec.domain.vo.DCustomerListVo;
import com.dsk.cscec.service.IDCustomerService;
import com.dsk.jsk.domain.JskCombineSearchDto;
import com.dsk.jsk.domain.vo.JskCombineWinBidProjectExportVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

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

/**
 * 组织维表(DCustomer)表控制层
 *
 * @author lcl
 * @since 2023-12-08 14:57:22
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/customer")
public class DCustomerController extends BaseController {
    /**
     * 服务对象
     */
    private final IDCustomerService baseService;

    /**
     * 供应商总台账筛选
     */
    @PostMapping("/all/searchList")
    public TableDataInfo<DCustomerListVo> allSearchList(@RequestBody DCustomerSearchBo bo,@RequestBody PageQuery query) {
        return baseService.allSearchList(bo,query);
    }

    /**
     * 供应商信息
     */
    @GetMapping("/info/{customerKey}")
    public R<DCustomer> info(@PathVariable String customerKey) {
        return R.ok(baseService.info(customerKey));
    }

    /**
     * 供应商信息
     */
    @PostMapping("/export")
    public void export(@RequestBody DCustomerSearchBo bo, HttpServletResponse response) {
        List<DCustomerListVo> list = baseService.exportList(bo);
        ExcelUtils<DCustomerListVo> util = new ExcelUtils<>(DCustomerListVo.class);
        util.exportExcel(response, list, "sheet1","大数据经营管理支撑服务平台供应商导出", true);
    }

  
}

