提交 ccd6152e 作者: zhenjie

目录查询

上级 17b51a7f
......@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Min;
import java.util.List;
/**
* @Author lw @Date 2023/5/15 13:24 @Version 1.0
......@@ -128,4 +129,13 @@ public class BackstageCategoriesController {
Integer type) {
return categoriesService.queryCategoryInfoByType(type);
}
@ApiOperation(value = "feign根据类型获取各个目录及分类信息", hidden = true)
@GetMapping("feignQqueryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public List<AllCategoryDTO> feignQqueryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.feigQqueryCategoryInfoByType(type);
}
}
......@@ -8,6 +8,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
......@@ -19,8 +20,8 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AllCategoryDTO {
public class AllCategoryDTO implements Serializable {
private static final long serialVersionUID = 1171841063641249397L;
private Integer directoryId;
private String name;
private List<CategoriesInfoListDTO> categoriesInfoListDTO;
......
......@@ -6,6 +6,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Auto-generated: 2023-06-08 16:2:43
*
......@@ -16,7 +18,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategoriesInfoListDTO {
public class CategoriesInfoListDTO implements Serializable {
private static final long serialVersionUID = -8381856228953745772L;
private Integer id;
private Integer directoryId;
private String name;
......
......@@ -4,13 +4,14 @@ import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.DistrictDO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
......@@ -50,4 +51,5 @@ public interface CategoriesService {
List<Categories> getCategoriesListByIds(Set<Integer> ids);
List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type);
}
package com.mmc.pms.service.Impl;
import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.CategoriesDao;
......@@ -237,6 +238,22 @@ public class CategoriesServiceImpl implements CategoriesService {
}
@Override
public List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type) {
List<DirectoryDO> categoryDirectoryList = getCategoryDirectoryList(type);
if (CollectionUtils.isNotEmpty(categoryDirectoryList)){
List<AllCategoryDTO> allCategoryDTOList =
categoryDirectoryList.stream()
.map(DirectoryDO::buildAllCategoryDTO)
.collect(Collectors.toList());
Map<Integer, List<CategoriesInfoListDTO>> categoryMap = getCategoryMap(allCategoryDTOList);
addSubCategories(allCategoryDTOList, categoryMap);
System.out.println("Res: " + JSONObject.toJSON(allCategoryDTOList));
return allCategoryDTOList;
}
return null;
}
@Override
public ResultBody deleteRelevantBusiness(Integer id) {
int count = categoriesDao.deleteById(id);
return ResultBody.success();
......
......@@ -9,5 +9,6 @@ data-filter:
- /pms/product/spec/feignGetSpecLeaseUnitPrice
- /pms/product/mall/deviceList
- /pms/classify/queryCategoryInfoByType
- /pms/classify/feignQqueryCategoryInfoByType
- /pms/product/mall/getLeaseGoodsDetail
- /pms/product/mall/getPageHomeCategories
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论