mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 授权管理支持模糊查询
This commit is contained in:
@@ -57,7 +57,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: false,
|
||||
},
|
||||
search: {
|
||||
show: false,
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
wrapper: {
|
||||
|
||||
@@ -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