| | |
| | | if(Objects.isNull(category) |
| | | || Objects.isNull(category.getType()) |
| | | || Objects.isNull(category.getName()) |
| | | || StringUtils.isBlank(category.getDetail()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | // type=2(寄存说明)detail不必填,其他类型必填 |
| | | if (!Constants.equalsInteger(category.getType(), Constants.TWO) && StringUtils.isBlank(category.getDetail())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | validateByType(category); |
| | |
| | | || Objects.isNull(category.getId()) |
| | | || Objects.isNull(category.getType()) |
| | | || Objects.isNull(category.getName()) |
| | | || StringUtils.isBlank(category.getDetail()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | // type=2(寄存说明)detail不必填,其他类型必填 |
| | | if (!Constants.equalsInteger(category.getType(), Constants.TWO) && StringUtils.isBlank(category.getDetail())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | validateByType(category); |
| | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryList)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.OSS,Constants.CATEGORY_FILES).getCode(); |
| | | // 收集非空的 relationId 批量查询 |
| | | java.util.Set<Integer> relationIds = new java.util.HashSet<>(); |
| | | for (Category category : categoryList) { |
| | | if (category.getRelationId() != null) { |
| | | relationIds.add(category.getRelationId()); |
| | | } |
| | | } |
| | | java.util.Map<Integer, String> relationNameMap = new java.util.HashMap<>(); |
| | | if (!relationIds.isEmpty()) { |
| | | categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .in(Category::getId, relationIds) |
| | | .eq(Category::getDeleted, Constants.ZERO)) |
| | | .forEach(c -> relationNameMap.put(c.getId(), c.getName())); |
| | | } |
| | | for (Category category:categoryList) { |
| | | if(StringUtils.isNotBlank(category.getIcon())){ |
| | | category.setIconFull(path + category.getIcon()); |
| | | } |
| | | if (category.getRelationId() != null) { |
| | | category.setRelationName(relationNameMap.get(category.getRelationId())); |
| | | } |
| | | } |
| | | } |
| | |
| | | .orderByAsc(Category::getSortnum)); |
| | | // 3. 拼接图标全路径 |
| | | if (!CollectionUtils.isEmpty(sizeList)) { |
| | | String path = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.RESOURCE_PATH).getCode() |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.CATEGORY_FILES).getCode(); |
| | | for (Category cate : sizeList) { |
| | | if (StringUtils.isNotBlank(cate.getIcon())) { |