|
@@ -1,15 +1,20 @@
|
|
|
package org.dromara.commodityManagement.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.commodityManagement.domain.bo.BrandBo;
|
|
|
import org.dromara.commodityManagement.domain.vo.BrandVo;
|
|
|
import org.dromara.commodityManagement.service.BrandService;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
+import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+
|
|
|
/**
|
|
|
* 品牌组接口
|
|
|
*/
|
|
@@ -59,4 +64,22 @@ public class BrandController extends BaseController {
|
|
|
public R<Void> deleteBrandByIds(@PathVariable Long[] brandIds) {
|
|
|
return toAjax(brandService.deleteBrandById(brandIds));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据品牌Ids导出Excel
|
|
|
+ * @param response 响应对象
|
|
|
+ */
|
|
|
+ @GetMapping("/exportExcelByIds")
|
|
|
+ public void exportDiBuExcel(@RequestParam("ids") Long[] brandIds , HttpServletResponse response) {
|
|
|
+ ExcelUtil.exportTemplate(CollUtil.newArrayList(new HashMap<>(),brandService.selectBrandListByIds(brandIds)), "品牌列表.xlsx","excel/品牌导出模板.xlsx", response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过Excel导出所有品牌数据
|
|
|
+ * @param response 响应对象
|
|
|
+ */
|
|
|
+ @GetMapping("/exportExcel")
|
|
|
+ public void exportDiBuExcel(HttpServletResponse response) {
|
|
|
+ ExcelUtil.exportTemplate(CollUtil.newArrayList(new HashMap<>(),brandService.selectBrandList()), "品牌列表.xlsx","excel/品牌导出模板.xlsx", response);
|
|
|
+ }
|
|
|
}
|