mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
perf: 授权管理支持模糊查询
This commit is contained in:
@@ -23,8 +23,13 @@ export class AccessController extends CrudController<AccessService> {
|
||||
async page(@Body(ALL) body) {
|
||||
body.query = body.query ?? {};
|
||||
delete body.query.userId;
|
||||
body.query.userId = this.getUserId()
|
||||
let name = body.query?.name;
|
||||
delete body.query.name;
|
||||
const buildQuery = qb => {
|
||||
qb.andWhere('user_id = :userId', { userId: this.getUserId() });
|
||||
if (name) {
|
||||
qb.andWhere('name like :name', { name: `%${name.trim()}%` });
|
||||
}
|
||||
};
|
||||
const res = await this.service.page({
|
||||
query: body.query,
|
||||
|
||||
Reference in New Issue
Block a user