huminmin
6 天以前 7a8827c634b53bb1cb861ebc1fd4ac6d1ae6cb5a
src/main/java/com/ruoyi/approve/controller/KnowledgeBaseController.java
@@ -6,16 +6,23 @@
import com.ruoyi.approve.pojo.KnowledgeBase;
import com.ruoyi.approve.pojo.RpaProcessAutomation;
import com.ruoyi.approve.service.KnowledgeBaseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@RequestMapping("/knowledgeBase")
@AllArgsConstructor
@Api(tags = "知识库管理")
public class KnowledgeBaseController {
    @Autowired
    private KnowledgeBaseService knowledgeBaseService;
@@ -25,6 +32,7 @@
     * @return
     */
    @GetMapping("/getList")
    @Log(title = "获取知识库管理列表", businessType = BusinessType.OTHER)
    public AjaxResult getList(@RequestParam(defaultValue = "1") long current,
                              @RequestParam(defaultValue = "10") long size, KnowledgeBase knowledgeBase) {
        Page page = new Page(current, size);
@@ -35,6 +43,7 @@
     * @return
     */
    @PostMapping("/add")
    @Log(title = "新增知识库管理", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase){
        return AjaxResult.success(knowledgeBaseService.save(knowledgeBase));
    }
@@ -43,6 +52,7 @@
     * @return
     */
    @PostMapping("/update")
    @Log(title = "修改知识库管理", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase){
        return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase));
    }
@@ -51,9 +61,19 @@
     * @return
     */
    @DeleteMapping("/delete")
    @Log(title = "删除知识库管理", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids){
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return AjaxResult.success(knowledgeBaseService.removeByIds(ids));
    }
    @ApiOperation(value = "知识库管理导出")
    @PostMapping("/export")
    @Log(title = "知识库管理导出", businessType = BusinessType.EXPORT)
    public void export(HttpServletResponse response) {
        List<KnowledgeBase> accountExpenses = knowledgeBaseService.list();
        ExcelUtil<KnowledgeBase> util = new ExcelUtil<KnowledgeBase>(KnowledgeBase.class);
        util.exportExcel(response, accountExpenses, "知识库管理导出");
    }
}