|
|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.model.entity.Information;
|
|
|
import com.cyksj.model.entity.InformationCategory;
|
|
|
import com.cyksj.model.views.GoodsFrontListView;
|
|
|
import com.cyksj.model.views.InformationDetailView;
|
|
|
@@ -64,7 +65,14 @@ public class InformationController {
|
|
|
*/
|
|
|
@GetMapping("/get/category")
|
|
|
public Result<List<InformationCategory>> getInformationCategory() {
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(informationCategoryService.list(Wrappers.lambdaQuery(InformationCategory.class).orderByAsc(InformationCategory::getSortBy)));
|
|
|
+ List<InformationCategory> list = informationCategoryService.list(Wrappers.lambdaQuery(InformationCategory.class).orderByAsc(InformationCategory::getSortBy));
|
|
|
+ list.forEach(category -> {
|
|
|
+ int count = informationService.count(Wrappers.lambdaQuery(Information.class).apply("JSON_CONTAINS(category_ids,'\"" + category.getId() + "\"')").eq(Information::getStatus, true).eq(Information::getDeleted, true));
|
|
|
+ if (count == 0){
|
|
|
+ list.remove(category);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
}
|
|
|
|
|
|
/**
|