xuhy
2025-12-16 2ee5451fd30b1d78b459eccc0b7771366617b896
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TMerchantController.java
@@ -25,6 +25,7 @@
import com.ruoyi.system.service.TMerchantService;
import com.ruoyi.system.service.TMerchantTypeService;
import com.ruoyi.system.vo.TMerchantVO;
import com.ruoyi.web.controller.tool.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -47,6 +48,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * <p>
@@ -149,9 +151,14 @@
    @GetMapping("/import-template")
    public void importTemplate() {
        List<MerchantImport> merchantImports = new ArrayList<>();
        MerchantImport merchantImport = new MerchantImport();
        merchantImports.add(merchantImport);
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), MerchantImport.class, merchantImports);
        // 查询分类列表
        List<TMerchantType> merchantTypes = merchantTypeService.list(Wrappers.lambdaQuery(TMerchantType.class).orderByDesc(TMerchantType::getCreateTime));
        List<String> dataList = new ArrayList<>();
        if (!CollectionUtils.isEmpty(merchantTypes)) {
            dataList = merchantTypes.stream().map(TMerchantType::getTypeName).collect(Collectors.toList());
        }
        ExcelUtil.selectList(workbook, 1, 65535, 2, 2, dataList.toArray(new String[dataList.size()]), 1);
        HttpServletResponse response = WebUtils.response();
        ServletOutputStream outputStream = null;
        try {