|
@@ -298,6 +298,13 @@ public class AdminKnowledgeController {
|
|
|
|
|
|
|
|
@GetMapping("/brands/export")
|
|
@GetMapping("/brands/export")
|
|
|
public ResponseEntity<?> exportBrands(@RequestParam(required = false) String ids) {
|
|
public ResponseEntity<?> exportBrands(@RequestParam(required = false) String ids) {
|
|
|
|
|
+ if (ids == null || ids.isBlank()) {
|
|
|
|
|
+ byte[] bytes = brandRecommendService.exportBrandsCsvBytes(null);
|
|
|
|
|
+ return ResponseEntity.ok()
|
|
|
|
|
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=brands_all.csv")
|
|
|
|
|
+ .contentType(MediaType.parseMediaType("text/csv; charset=UTF-8"))
|
|
|
|
|
+ .body(bytes);
|
|
|
|
|
+ }
|
|
|
Set<Integer> idSet = parseIds(ids);
|
|
Set<Integer> idSet = parseIds(ids);
|
|
|
if (idSet.isEmpty()) {
|
|
if (idSet.isEmpty()) {
|
|
|
return ResponseEntity.badRequest().body(Map.of("ok", false, "message", "请选择要导出的品牌"));
|
|
return ResponseEntity.badRequest().body(Map.of("ok", false, "message", "请选择要导出的品牌"));
|
|
@@ -376,6 +383,13 @@ public class AdminKnowledgeController {
|
|
|
@GetMapping("/brand-recommend-rules/export")
|
|
@GetMapping("/brand-recommend-rules/export")
|
|
|
public ResponseEntity<?> exportBrandRecommendRules(
|
|
public ResponseEntity<?> exportBrandRecommendRules(
|
|
|
@RequestParam(required = false) String ids) {
|
|
@RequestParam(required = false) String ids) {
|
|
|
|
|
+ if (ids == null || ids.isBlank()) {
|
|
|
|
|
+ byte[] bytes = brandRecommendService.exportRulesCsvBytes(null);
|
|
|
|
|
+ return ResponseEntity.ok()
|
|
|
|
|
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=brand_recommend_rules_all.csv")
|
|
|
|
|
+ .contentType(MediaType.parseMediaType("text/csv; charset=UTF-8"))
|
|
|
|
|
+ .body(bytes);
|
|
|
|
|
+ }
|
|
|
Set<Integer> idSet = parseIds(ids);
|
|
Set<Integer> idSet = parseIds(ids);
|
|
|
if (idSet.isEmpty()) {
|
|
if (idSet.isEmpty()) {
|
|
|
return ResponseEntity.badRequest().body(Map.of("ok", false, "message", "请选择要导出的推荐规则"));
|
|
return ResponseEntity.badRequest().body(Map.of("ok", false, "message", "请选择要导出的推荐规则"));
|