|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.commodityManagement.controller;
|
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -11,6 +12,7 @@ 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.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.HashMap;
|
|
@@ -41,7 +43,7 @@ public class BrandController extends BaseController {
|
|
|
* @return 新增结果
|
|
|
*/
|
|
|
@PostMapping()
|
|
|
- public R<Void> insertBrand(@RequestBody BrandBo brand) {
|
|
|
+ public R<Void> insertBrand(@Validated @RequestBody BrandBo brand) {
|
|
|
return toAjax(brandService.insertBrand(brand));
|
|
|
}
|
|
|
|
|
@@ -71,15 +73,16 @@ public class BrandController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/exportExcelByIds")
|
|
|
public void exportDiBuExcel(@RequestParam("ids") Long[] brandIds , HttpServletResponse response) {
|
|
|
- ExcelUtil.exportTemplate(CollUtil.newArrayList(new HashMap<>(),brandService.selectBrandListByIds(brandIds)), "品牌列表.xlsx","excel/品牌导出模板.xlsx", response);
|
|
|
+ ExcelUtil.exportTemplate(CollUtil.newArrayList(new HashMap<>(),brandService.selectBrandListByIds(brandIds)), "品牌列表","excel/品牌导出模板.xlsx", response);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通过Excel导出所有品牌数据
|
|
|
* @param response 响应对象
|
|
|
*/
|
|
|
+ @SaIgnore
|
|
|
@GetMapping("/exportExcel")
|
|
|
public void exportDiBuExcel(HttpServletResponse response) {
|
|
|
- ExcelUtil.exportTemplate(CollUtil.newArrayList(new HashMap<>(),brandService.selectBrandList()), "品牌列表.xlsx","excel/品牌导出模板.xlsx", response);
|
|
|
+ ExcelUtil.exportTemplate(CollUtil.newArrayList(new HashMap<>(),brandService.selectBrandList()), "品牌列表","excel/品牌导出模板.xlsx", response);
|
|
|
}
|
|
|
}
|