瀏覽代碼

修改字段

zs 1 年之前
父節點
當前提交
817a1b857e

+ 4 - 15
src/controller/Config.controller.ts

@@ -6,7 +6,6 @@ import {
   Inject,
   Param,
   Post,
-  Query,
 } from '@midwayjs/decorator';
 import { BaseController } from 'free-midway-component';
 import { ConfigService } from '../service/Config.service';
@@ -14,7 +13,6 @@ import {
   CDTO_Config,
   CVO_Config,
   FVO_Config,
-  QDTO_Config,
   QVO_Config,
   UDTO_Config,
   UVAO_Config,
@@ -38,19 +36,10 @@ export class ConfigController extends BaseController {
   @Get('/')
   @ApiQuery({ name: 'query' })
   @ApiResponse({ type: QVO_Config })
-  async query(
-    @Query() filter: QDTO_Config,
-    @Query('skip') skip: number,
-    @Query('limit') limit: number
-  ) {
-    const list = await this.service.query(filter, { skip, limit });
-    const data = [];
-    for (const i of list) {
-      const newData = new QVO_Config(i);
-      data.push(newData);
-    }
-    const total = await this.service.count(filter);
-    return { data, total };
+  async query() {
+    const data = await this.service.findByOne();
+    const result = new QVO_Config(data);
+    return result;
   }
 
   @Get('/:id')

+ 3 - 3
src/entity/Module.entity.ts

@@ -15,11 +15,11 @@ export class Module extends BaseModel {
   @prop({
     required: false,
     index: true,
-    zh: '状态',
-    remark: '字典表:status',
+    zh: '是否使用',
+    remark: 'is_use',
     default: '0',
   })
-  status: string;
+  is_use: string;
   @prop({ required: false, index: false, zh: '路由' })
   route: string;
 }

+ 2 - 4
src/entity/Role.entity.ts

@@ -12,8 +12,6 @@ export class Role extends BaseModel {
   brief: string;
   @prop({ required: false, index: false, zh: '底部菜单' })
   menu: Array<any>;
-  @prop({ required: false, index: true, zh: '状态', default: '0' })
-  status: string;
-  @prop({ required: false, index: true, zh: '账号类型' })
-  type: string;
+  @prop({ required: false, index: true, zh: '是否使用', default: '0' })
+  is_use: string;
 }

+ 1 - 1
src/entity/User.entity.ts

@@ -28,7 +28,7 @@ export class User extends BaseModel {
     required: false,
     index: false,
     zh: '性别',
-    remark: '0:女;1男;2未知',
+    remark: '0:男;1女;2未知',
     default: '2',
   })
   gender: number;

+ 2 - 2
src/interface/Config.interface.ts

@@ -15,7 +15,7 @@ export class FVO_Config {
   @ApiProperty({ description: '数据id' })
   _id: string = undefined;
   @ApiProperty({ description: 'logo' })
-  ' logo_url': Array<any> = undefined;
+  'logo_url': Array<any> = undefined;
 }
 
 export class QDTO_Config extends SearchBase {
@@ -37,7 +37,7 @@ export class QVO_Config extends FVO_Config {
 export class CDTO_Config {
   @ApiProperty({ description: 'logo' })
   @Rule(RuleType['array']().empty(''))
-  ' logo_url': Array<any> = undefined;
+  'logo_url': Array<any> = undefined;
 }
 
 export class CVO_Config extends FVO_Config {

+ 7 - 7
src/interface/Module.interface.ts

@@ -22,8 +22,8 @@ export class FVO_Module {
   'url': Array<any> = undefined;
   @ApiProperty({ description: '排序' })
   'sort': number = undefined;
-  @ApiProperty({ description: '状态' })
-  'status': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
   @ApiProperty({ description: '路由' })
   'route': string = undefined;
 }
@@ -31,7 +31,7 @@ export class FVO_Module {
 export class QDTO_Module extends SearchBase {
   constructor() {
     const like_prop = [];
-    const props = ['name', 'type', 'status'];
+    const props = ['name', 'type', 'is_use'];
     const mapping = [];
     super({ like_prop, props, mapping });
   }
@@ -39,8 +39,8 @@ export class QDTO_Module extends SearchBase {
   'name': string = undefined;
   @ApiProperty({ description: '类型' })
   'type': string = undefined;
-  @ApiProperty({ description: '状态' })
-  'status': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
 }
 
 export class QVO_Module extends FVO_Module {
@@ -63,9 +63,9 @@ export class CDTO_Module {
   @ApiProperty({ description: '排序' })
   @Rule(RuleType['number']().empty(''))
   'sort': number = undefined;
-  @ApiProperty({ description: '状态' })
+  @ApiProperty({ description: '是否使用' })
   @Rule(RuleType['string']().empty(''))
-  'status': string = undefined;
+  'is_use': string = undefined;
   @ApiProperty({ description: '路由' })
   @Rule(RuleType['string']().empty(''))
   'route': string = undefined;

+ 6 - 13
src/interface/Role.interface.ts

@@ -22,16 +22,14 @@ export class FVO_Role {
   'brief': string = undefined;
   @ApiProperty({ description: '底部菜单' })
   'menu': Array<any> = undefined;
-  @ApiProperty({ description: '状态' })
-  'status': string = undefined;
-  @ApiProperty({ description: '账号类型' })
-  'type': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
 }
 
 export class QDTO_Role extends SearchBase {
   constructor() {
     const like_prop = [];
-    const props = ['name', 'code', 'status', 'type'];
+    const props = ['name', 'code', 'is_use'];
     const mapping = [];
     super({ like_prop, props, mapping });
   }
@@ -39,10 +37,8 @@ export class QDTO_Role extends SearchBase {
   'name': string = undefined;
   @ApiProperty({ description: '角色编码' })
   'code': string = undefined;
-  @ApiProperty({ description: '状态' })
+  @ApiProperty({ description: '是否使用' })
   'status': string = undefined;
-  @ApiProperty({ description: '账号类型' })
-  'type': string = undefined;
 }
 
 export class QVO_Role extends FVO_Role {
@@ -65,12 +61,9 @@ export class CDTO_Role {
   @ApiProperty({ description: '底部菜单' })
   @Rule(RuleType['array']().empty(''))
   'menu': Array<any> = undefined;
-  @ApiProperty({ description: '状态' })
-  @Rule(RuleType['string']().empty(''))
-  'status': string = undefined;
-  @ApiProperty({ description: '账号类型' })
+  @ApiProperty({ description: '是否使用' })
   @Rule(RuleType['string']().empty(''))
-  'type': string = undefined;
+  'is_use': string = undefined;
 }
 
 export class CVO_Role extends FVO_Role {

+ 5 - 0
src/service/Config.service.ts

@@ -8,4 +8,9 @@ type modelType = ReturnModelType<typeof Config>;
 export class ConfigService extends BaseService<modelType> {
   @InjectEntityModel(Config)
   model: modelType;
+
+  async findByOne(): Promise<object> {
+    const result = await this.model.findOne({}).lean();
+    return result;
+  }
 }