mirror of https://github.com/certd/certd
perf: 授权管理支持模糊查询
parent
86b3df1941
commit
866eb6241b
|
@ -57,7 +57,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
show: false,
|
show: true,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
wrapper: {
|
wrapper: {
|
||||||
|
|
|
@ -23,8 +23,13 @@ export class AccessController extends CrudController<AccessService> {
|
||||||
async page(@Body(ALL) body) {
|
async page(@Body(ALL) body) {
|
||||||
body.query = body.query ?? {};
|
body.query = body.query ?? {};
|
||||||
delete body.query.userId;
|
delete body.query.userId;
|
||||||
|
body.query.userId = this.getUserId()
|
||||||
|
let name = body.query?.name;
|
||||||
|
delete body.query.name;
|
||||||
const buildQuery = qb => {
|
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({
|
const res = await this.service.page({
|
||||||
query: body.query,
|
query: body.query,
|
||||||
|
|
Loading…
Reference in New Issue