luo
2023-12-25 23c4967b4cb8dbce8277f830f7152d315c5a4a57
guns-admin/src/main/java/com/stylefeng/guns/modular/api/EncyclopedicKnowledgeController.java
@@ -2,17 +2,20 @@
import com.stylefeng.guns.modular.system.model.EncyclopedicKnowledge;
import com.stylefeng.guns.modular.system.model.SysDataType;
import com.stylefeng.guns.modular.system.service.IAppUserService;
import com.stylefeng.guns.modular.system.service.IEncyclopedicKnowledgeService;
import com.stylefeng.guns.modular.system.service.ISysDataTypeService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.res.EncyclopedicKnowledgeInfoRes;
import com.stylefeng.guns.modular.system.warpper.res.EncyclopedicKnowledgeRes;
import com.stylefeng.guns.modular.system.warpper.req.SearchHouseResourceReq;
import com.stylefeng.guns.modular.system.warpper.req.SearchIntermediaryReq;
import com.stylefeng.guns.modular.system.warpper.res.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -35,7 +38,13 @@
    @ApiOperation(value = "获取类别", tags = {"知识百科"})
    public ResultUtil<List<SysDataType>> getEncyclopedicKnowledgeType(){
        List<SysDataType> sysDataType = sysDataTypeService.getSysDataType(1);
        return ResultUtil.success(sysDataType);
        List<SysDataType> res = new ArrayList<>();
        // 如果当前类别下 没有内容就不展示了
        for (SysDataType dataType : sysDataType) {
            List<EncyclopedicKnowledgeRes> list = encyclopedicKnowledgeService.getEncyclopedicKnowledgeList(dataType.getId());
            if (list.size()!=0) res.add(dataType);
        }
        return ResultUtil.success(res);
    }
@@ -75,4 +84,8 @@
    public ResultUtil upvoteEncyclopedicKnowledge(Integer id){
        return encyclopedicKnowledgeService.upvoteEncyclopedicKnowledge(id);
    }
}