feat: 新增书籍及书籍分类管理模块(entity/controller/service)

This commit is contained in:
Jony
2026-07-02 23:53:10 +08:00
parent 893b5316f3
commit f0fff0b113
6 changed files with 280 additions and 0 deletions
@@ -0,0 +1,20 @@
import { Body, Post, Provide } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { KnowledgeBookEntity } from '../../entity/book';
import { KnowledgeBookService } from '../../service/book';
@CoolController({
api: ['add', 'delete', 'update', 'info', 'list', 'page'],
entity: KnowledgeBookEntity,
service: KnowledgeBookService,
pageQueryOp: {
keyWordLikeFields: ['a.name', 'a.author'],
fieldEq: ['a.quality', 'a.priority', 'a.categoryId'],
},
})
export class AdminKnowledgeBookController extends BaseController {
@Post('/import', { summary: '批量导入书籍' })
async importBooks(@Body() books: any[]) {
return this.ok(await this.service.importBooks(books));
}
}