This commit is contained in:
xiaojunnuo
2024-12-24 01:12:12 +08:00
parent cb27d4b490
commit ffa4de6911
14 changed files with 107 additions and 33 deletions
@@ -39,14 +39,18 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
@Post('/add', { summary: Constants.per.authOnly })
async add(@Body(ALL) bean: any) {
bean.userId = this.getUserId();
return await super.add(bean);
const res = await this.service.add(bean);
await this.service.check(res.id);
return this.ok(res);
}
@Post('/update', { summary: Constants.per.authOnly })
async update(@Body(ALL) bean) {
await this.service.checkUserId(bean.id, this.getUserId());
delete bean.userId;
return await super.update(bean);
await this.service.update(bean);
await this.service.check(bean.id);
return this.ok();
}
@Post('/info', { summary: Constants.per.authOnly })
async info(@Query('id') id: number) {
@@ -4,6 +4,7 @@ import { CrudController } from '@certd/lib-server';
import { RoleService } from '../../../modules/sys/authority/service/role-service.js';
import { PermissionService } from '../../../modules/sys/authority/service/permission-service.js';
import { Constants } from '@certd/lib-server';
import { In } from 'typeorm';
/**
* 系统用户
@@ -23,6 +24,24 @@ export class UserController extends CrudController<UserService> {
return this.service;
}
@Post('/getSimpleUserByIds', { summary: 'sys:auth:user:add' })
async getSimpleUserByIds(@Body('ids') ids: number[]) {
const users = await this.service.find({
select: {
id: true,
username: true,
nickName: true,
mobile: true,
phoneCode: true,
},
where: {
id: In(ids),
},
});
return this.ok(users);
}
@Post('/page', { summary: 'sys:auth:user:view' })
async page(
@Body(ALL)