mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-04-04 19:50:08 +00:00
整理代码
This commit is contained in:
parent
a66d67cf64
commit
591fc20e6f
@ -30,27 +30,29 @@ import { DemoAppGoodsEntity } from '../../entity/goods';
|
||||
// 指定返回字段
|
||||
select: ['a.*', 'b.name'],
|
||||
// 关联表用户表
|
||||
leftJoin: [{
|
||||
leftJoin: [
|
||||
{
|
||||
// 管理的表
|
||||
entity: BaseSysUserEntity,
|
||||
// 别名
|
||||
alias: 'b',
|
||||
// 关联条件
|
||||
condition: 'a.userId = b.id'
|
||||
}],
|
||||
condition: 'a.userId = b.id',
|
||||
},
|
||||
],
|
||||
// 增加其他条件
|
||||
where: async (ctx: Context) => {
|
||||
return [
|
||||
// 价格大于90
|
||||
['a.price > :price', { price: 90.00 }]
|
||||
]
|
||||
['a.price > :price', { price: 90.0 }],
|
||||
];
|
||||
},
|
||||
// 添加排序
|
||||
addOrderBy: {
|
||||
// 排序字段及排序方式
|
||||
price: 'desc'
|
||||
}
|
||||
}
|
||||
price: 'desc',
|
||||
},
|
||||
},
|
||||
})
|
||||
export class DemoAdminGoodsController extends BaseController {
|
||||
/**
|
||||
|
||||
@ -20,5 +20,5 @@ export class DemoAppGoodsEntity extends BaseEntity {
|
||||
price: number;
|
||||
|
||||
@Column({ comment: '分类', type: 'tinyint' })
|
||||
type: number
|
||||
type: number;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user