mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-03-10 18:06:09 +00:00
4.x 就绪
This commit is contained in:
parent
61c3dec78f
commit
a3f1ef9edc
@ -34,7 +34,7 @@ export class BaseCommController extends BaseController {
|
||||
* 实体信息与路径
|
||||
* @returns
|
||||
*/
|
||||
@Get('/eps')
|
||||
@Get('/eps', { summary: '实体信息与路径' })
|
||||
public async getEps() {
|
||||
return this.ok(this.eps);
|
||||
}
|
||||
@ -42,7 +42,7 @@ export class BaseCommController extends BaseController {
|
||||
/**
|
||||
* 获得个人信息
|
||||
*/
|
||||
@Get('/person')
|
||||
@Get('/person', { summary: '个人信息' })
|
||||
async person() {
|
||||
return this.ok(await this.baseSysUserService.person());
|
||||
}
|
||||
@ -50,7 +50,7 @@ export class BaseCommController extends BaseController {
|
||||
/**
|
||||
* 修改个人信息
|
||||
*/
|
||||
@Post('/personUpdate')
|
||||
@Post('/personUpdate', { summary: '修改个人信息' })
|
||||
async personUpdate(@Body(ALL) user: BaseSysUserEntity) {
|
||||
await this.baseSysUserService.personUpdate(user);
|
||||
return this.ok();
|
||||
@ -59,7 +59,7 @@ export class BaseCommController extends BaseController {
|
||||
/**
|
||||
* 权限菜单
|
||||
*/
|
||||
@Get('/permmenu')
|
||||
@Get('/permmenu', { summary: '权限与菜单' })
|
||||
async permmenu() {
|
||||
return this.ok(
|
||||
await this.baseSysPermsService.permmenu(this.ctx.admin.roleIds)
|
||||
@ -69,7 +69,7 @@ export class BaseCommController extends BaseController {
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@Post('/upload')
|
||||
@Post('/upload', { summary: '文件上传' })
|
||||
async upload() {
|
||||
return this.ok(await this.coolFile.upload(this.ctx));
|
||||
}
|
||||
@ -77,7 +77,7 @@ export class BaseCommController extends BaseController {
|
||||
/**
|
||||
* 文件上传模式,本地或者云存储
|
||||
*/
|
||||
@Get('/uploadMode')
|
||||
@Get('/uploadMode', { summary: '文件上传模式' })
|
||||
async uploadMode() {
|
||||
return this.ok(this.coolFile.getMode());
|
||||
}
|
||||
@ -85,7 +85,7 @@ export class BaseCommController extends BaseController {
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
@Post('/logout')
|
||||
@Post('/logout', { summary: '退出' })
|
||||
async logout() {
|
||||
await this.baseSysLoginService.logout();
|
||||
return this.ok();
|
||||
|
||||
@ -31,7 +31,7 @@ export class BaseOpenController extends BaseController {
|
||||
/**
|
||||
* 根据配置参数key获得网页内容(富文本)
|
||||
*/
|
||||
@Get('/html')
|
||||
@Get('/html', { summary: '获得网页内容的参数值' })
|
||||
async htmlByKey(@Query() key: string) {
|
||||
this.ctx.body = await this.baseSysParamService.htmlByKey(key);
|
||||
}
|
||||
@ -40,7 +40,7 @@ export class BaseOpenController extends BaseController {
|
||||
* 登录
|
||||
* @param login
|
||||
*/
|
||||
@Post('/login')
|
||||
@Post('/login', { summary: '登录' })
|
||||
async login(@Body(ALL) login: LoginDTO) {
|
||||
return this.ok(await this.baseSysLoginService.login(login));
|
||||
}
|
||||
@ -48,7 +48,7 @@ export class BaseOpenController extends BaseController {
|
||||
/**
|
||||
* 获得验证码
|
||||
*/
|
||||
@Get('/captcha')
|
||||
@Get('/captcha', { summary: '验证码' })
|
||||
async captcha(
|
||||
@Query() type: string,
|
||||
@Query() width: number,
|
||||
@ -60,7 +60,7 @@ export class BaseOpenController extends BaseController {
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
@Get('/refreshToken')
|
||||
@Get('/refreshToken', { summary: '刷新token' })
|
||||
async refreshToken(@Query() refreshToken: string) {
|
||||
return this.ok(await this.baseSysLoginService.refreshToken(refreshToken));
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ export class BasePluginInfoController extends BaseController {
|
||||
/**
|
||||
* 插件列表
|
||||
*/
|
||||
@Post('/list')
|
||||
@Post('/list', { summary: '列表' })
|
||||
async list(@Body() keyWord: string) {
|
||||
return this.ok(await this.basePluginInfoService.list(keyWord));
|
||||
}
|
||||
@ -23,7 +23,7 @@ export class BasePluginInfoController extends BaseController {
|
||||
* @param namespace
|
||||
* @param config
|
||||
*/
|
||||
@Post('/config')
|
||||
@Post('/config', { summary: '配置' })
|
||||
async config(@Body() namespace: string, @Body() config: any) {
|
||||
await this.basePluginInfoService.config(namespace, config);
|
||||
return this.ok();
|
||||
@ -34,7 +34,7 @@ export class BasePluginInfoController extends BaseController {
|
||||
* @param namespace
|
||||
* @param config
|
||||
*/
|
||||
@Get('/getConfig')
|
||||
@Get('/getConfig', { summary: '获得配置' })
|
||||
async getConfig(@Query() namespace: string) {
|
||||
return this.ok(await this.basePluginInfoService.getConfig(namespace));
|
||||
}
|
||||
@ -43,7 +43,7 @@ export class BasePluginInfoController extends BaseController {
|
||||
* 启用插件
|
||||
* @param enable
|
||||
*/
|
||||
@Post('/enable')
|
||||
@Post('/enable', { summary: '启用|禁用' })
|
||||
async enable(@Body() namespace: string, @Body() enable: number) {
|
||||
await this.basePluginInfoService.enable(namespace, enable);
|
||||
return this.ok();
|
||||
|
||||
@ -19,7 +19,7 @@ export class BaseDepartmentController extends BaseController {
|
||||
/**
|
||||
* 部门排序
|
||||
*/
|
||||
@Post('/order')
|
||||
@Post('/order', { summary: '排序' })
|
||||
async order(@Body(ALL) params: any) {
|
||||
await this.baseDepartmentService.order(params);
|
||||
return this.ok();
|
||||
|
||||
@ -34,7 +34,7 @@ export class BaseSysLogController extends BaseController {
|
||||
/**
|
||||
* 清空日志
|
||||
*/
|
||||
@Post('/clear')
|
||||
@Post('/clear', { summary: '清理' })
|
||||
public async clear() {
|
||||
await this.baseSysLogService.clear(true);
|
||||
return this.ok();
|
||||
@ -43,7 +43,7 @@ export class BaseSysLogController extends BaseController {
|
||||
/**
|
||||
* 设置日志保存时间
|
||||
*/
|
||||
@Post('/setKeep')
|
||||
@Post('/setKeep', { summary: '设置保存时间' })
|
||||
public async setKeep(@Body() value: number) {
|
||||
await this.baseSysConfService.updateVaule('logKeep', value);
|
||||
return this.ok();
|
||||
@ -52,7 +52,7 @@ export class BaseSysLogController extends BaseController {
|
||||
/**
|
||||
* 获得日志保存时间
|
||||
*/
|
||||
@Get('/getKeep')
|
||||
@Get('/getKeep', { summary: '获得设置保存时间' })
|
||||
public async getKeep() {
|
||||
return this.ok(await this.baseSysConfService.getValue('logKeep'));
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ export class BaseSysParamController extends BaseController {
|
||||
/**
|
||||
* 根据配置参数key获得网页内容(富文本)
|
||||
*/
|
||||
@Get('/html')
|
||||
@Get('/html', { summary: '获得网页内容的参数值' })
|
||||
async htmlByKey(@Query() key: string) {
|
||||
this.ctx.body = await this.baseSysParamService.htmlByKey(key);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ export class BaseSysUserController extends BaseController {
|
||||
/**
|
||||
* 移动部门
|
||||
*/
|
||||
@Post('/move')
|
||||
@Post('/move', { summary: '移动部门' })
|
||||
async move(@Body() departmentId: number, @Body() userIds: []) {
|
||||
await this.baseSysUserService.move(departmentId, userIds);
|
||||
return this.ok();
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { Get, Provide } from '@midwayjs/decorator';
|
||||
import { Context } from 'egg';
|
||||
import { CoolController, BaseController } from '@cool-midway/core';
|
||||
import { BaseSysUserEntity } from '../../../base/entity/sys/user';
|
||||
import { DemoGoodsEntity } from '../../entity/goods';
|
||||
|
||||
/**
|
||||
@ -27,19 +26,6 @@ import { DemoGoodsEntity } from '../../entity/goods';
|
||||
keyWordLikeFields: ['title'],
|
||||
// 让type字段支持筛选
|
||||
fieldEq: ['type'],
|
||||
// 指定返回字段
|
||||
select: ['a.*', 'b.name'],
|
||||
// 关联表用户表
|
||||
leftJoin: [
|
||||
{
|
||||
// 管理的表
|
||||
entity: BaseSysUserEntity,
|
||||
// 别名
|
||||
alias: 'b',
|
||||
// 关联条件
|
||||
condition: 'a.userId = b.id',
|
||||
},
|
||||
],
|
||||
// 增加其他条件
|
||||
where: async (ctx: Context) => {
|
||||
return [
|
||||
|
||||
@ -1,28 +1,11 @@
|
||||
import { EntityModel } from '@midwayjs/orm';
|
||||
import { BaseEntity, CoolEntityCrud } from '@cool-midway/core';
|
||||
import { Column, SelectQueryBuilder } from 'typeorm';
|
||||
import { DemoGoodsEntity } from './goods';
|
||||
import { Column } from 'typeorm';
|
||||
|
||||
/**
|
||||
* 实体类crud demo
|
||||
*/
|
||||
@CoolEntityCrud({
|
||||
pageQueryOp: {
|
||||
fieldEq: ['name'],
|
||||
select: ['a.*', 'b.id as price'],
|
||||
join: [
|
||||
{
|
||||
entity: DemoGoodsEntity,
|
||||
alias: 'b',
|
||||
condition: 'a.id = b.id',
|
||||
type: 'innerJoin',
|
||||
},
|
||||
],
|
||||
extend: async (find: SelectQueryBuilder<DemoCrudEntity>) => {
|
||||
find.groupBy('a.id');
|
||||
},
|
||||
},
|
||||
})
|
||||
@CoolEntityCrud()
|
||||
@EntityModel('demo_crud')
|
||||
export class DemoCrudEntity extends BaseEntity {
|
||||
@Column({ comment: '头像' })
|
||||
|
||||
@ -30,7 +30,7 @@ export class TaskInfoController extends BaseController {
|
||||
/**
|
||||
* 手动执行一次
|
||||
*/
|
||||
@Post('/once')
|
||||
@Post('/once', { summary: '执行一次' })
|
||||
async once(@Body() id: number) {
|
||||
await this.taskInfoService.once(id);
|
||||
this.ok();
|
||||
@ -39,7 +39,7 @@ export class TaskInfoController extends BaseController {
|
||||
/**
|
||||
* 暂停任务
|
||||
*/
|
||||
@Post('/stop')
|
||||
@Post('/stop', { summary: '停止' })
|
||||
async stop(@Body() id: number) {
|
||||
await this.taskInfoService.stop(id);
|
||||
this.ok();
|
||||
@ -48,7 +48,7 @@ export class TaskInfoController extends BaseController {
|
||||
/**
|
||||
* 开始任务
|
||||
*/
|
||||
@Post('/start')
|
||||
@Post('/start', { summary: '开始' })
|
||||
async start(@Body() id: number, @Body() type: number) {
|
||||
await this.taskInfoService.start(id, type);
|
||||
this.ok();
|
||||
@ -57,7 +57,7 @@ export class TaskInfoController extends BaseController {
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
@Get('/log')
|
||||
@Get('/log', { summary: '日志' })
|
||||
async log(@Query(ALL) params: any) {
|
||||
return this.ok(await this.taskInfoService.log(params));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user