| | |
| | | import com.ruoyi.approve.pojo.KnowledgeBase; |
| | | import com.ruoyi.approve.service.KnowledgeBaseService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/knowledgeBase") |
| | | @AllArgsConstructor |
| | | @Api(tags = "知识库管理") |
| | | public class KnowledgeBaseController { |
| | | @Tag(name = "知识库管理") |
| | | public class KnowledgeBaseController extends BaseController { |
| | | private KnowledgeBaseService knowledgeBaseService; |
| | | |
| | | /**、 |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "10") long size, KnowledgeBase knowledgeBase) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | return R.ok(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | } |
| | | /**、 |
| | | * 增添 |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.save(knowledgeBase)); |
| | | public R<?> add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.save(knowledgeBase)); |
| | | } |
| | | /** |
| | | * 更新 |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase)); |
| | | public R<?> update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.updateById(knowledgeBase)); |
| | | } |
| | | /** |
| | | * 删除 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(knowledgeBaseService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(knowledgeBaseService.removeByIds(ids)); |
| | | } |
| | | |
| | | @ApiOperation(value = "知识库管理导出") |
| | | @Operation(summary = "知识库管理导出") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<KnowledgeBase> accountExpenses = knowledgeBaseService.list(); |