mirror of
https://github.com/apgzs/cool-admin-api.git
synced 2025-04-06 03:58:06 +08:00
新增示例
This commit is contained in:
parent
74e6f2ffdd
commit
1cd1aa1639
@ -2,6 +2,7 @@
|
||||
* 演示地址:https://show.cool-admin.com
|
||||
* 文档地址:https://docs.cool-admin.com
|
||||
* 官网:https://www.cool-admin.com
|
||||
|
||||
## 技术选型
|
||||
Node版后台基础框架基于[Egg.js](https://eggjs.org/zh-cn/)(阿里出品)
|
||||
* 基础:**[egg.js](https://eggjs.org/zh-cn/)**
|
||||
@ -42,6 +43,8 @@ Node版后台基础框架基于[Egg.js](https://eggjs.org/zh-cn/)(阿里出品)
|
||||

|
||||
|
||||
## 快速开发6个接口
|
||||
<iframe src="//player.bilibili.com/player.html?aid=69398358&cid=120277692&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
|
||||
|
||||
## 数据模型
|
||||
数据模型必须放在`app/entities/*`下,否则[typeorm](https://typeorm.io "typeorm")无法识别,如:
|
||||
```js
|
||||
|
@ -170,18 +170,18 @@ export abstract class BaseService extends Service {
|
||||
const find = entity
|
||||
.createQueryBuilder()
|
||||
.take(parseInt(size))
|
||||
.skip(String((page - 1) * size))
|
||||
.where(option.where);
|
||||
.skip(String((page - 1) * size));
|
||||
if (option) {
|
||||
// 默认条件
|
||||
if (option.where) {
|
||||
find.where(option.where);
|
||||
}
|
||||
// 附加排序
|
||||
if (!_.isEmpty(option.addOrderBy)) {
|
||||
for (const key in option.addOrderBy) {
|
||||
find.addOrderBy(key, option.addOrderBy[key].toUpperCase());
|
||||
}
|
||||
}
|
||||
// 接口请求的排序
|
||||
if (sort && order) {
|
||||
find.addOrderBy(order, sort.toUpperCase());
|
||||
}
|
||||
// 关键字模糊搜索
|
||||
if (keyWord) {
|
||||
keyWord = `%${ keyWord }%`;
|
||||
@ -202,6 +202,11 @@ export abstract class BaseService extends Service {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 接口请求的排序
|
||||
if (sort && order) {
|
||||
find.addOrderBy(order, sort.toUpperCase());
|
||||
}
|
||||
return find;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user