fix
Hentua
2023-04-25 05c40a68b5664c5ed41dbaa57ba30f0c73757b26
src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java
@@ -7,7 +7,10 @@
import cc.mrbird.febs.mall.dto.MallNewsInfoDto;
import cc.mrbird.febs.mall.entity.MallNewsCategory;
import cc.mrbird.febs.mall.entity.MallNewsInfo;
import cc.mrbird.febs.mall.service.IMallNewsCategoryService;
import cc.mrbird.febs.mall.service.IMallNewsInfoService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
@@ -31,6 +34,7 @@
public class AdminNewsInfoController extends BaseController {
    private final IMallNewsInfoService mallNewsInfoService;
    private final IMallNewsCategoryService mallNewsCategoryService;
    /**
     * 新闻中心-列表
@@ -95,8 +99,12 @@
    }
    @GetMapping(value = "findAllCategoryList")
    public FebsResponse findAllCategoryList() {
        List<MallNewsCategory> categories = mallNewsInfoService.findAllCategory();
    public FebsResponse findAllCategoryList(String code) {
        LambdaQueryWrapper<MallNewsCategory> query = new LambdaQueryWrapper<>();
        if (StrUtil.isNotBlank(code)) {
            query.eq(MallNewsCategory::getCode, code);
        }
        List<MallNewsCategory> categories = mallNewsCategoryService.list(query);
        return new FebsResponse().success().data(categories);
    }