Ver código fonte

排序赛事流程

zs 8 meses atrás
pai
commit
174415b1fb

+ 1 - 0
src/controller/platform/match.controller.ts

@@ -63,6 +63,7 @@ export class MatchController implements BaseController {
   async delete(@Param('id') id: number) {
     if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
     const result = await this.service.delete({ id });
+    await this.service.deleteFlow(id);
     return result;
   }
 

+ 2 - 1
src/controller/system/dictData.controller.ts

@@ -20,7 +20,8 @@ export class DictDataController implements BaseController {
   @ApiResponse({ type: QVO_dictData })
   async index(@Query() query: object) {
     const qobj = omit(query, ['skip', 'limit']);
-    const others = pick(query, ['skip', 'limit']);
+    const others: any = pick(query, ['skip', 'limit']);
+    others.order = { sort: 'ASC' };
     const result = await this.service.query(qobj, others);
     return result;
   }

+ 2 - 0
src/entity/platform/matchPath.entity.ts

@@ -17,4 +17,6 @@ export class MatchPath extends BaseModel {
   brief: string;
   @Column({ type: 'character varying', nullable: true, comment: '是否启用', default: '0' })
   is_use: string;
+  @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
+  status: string;
 }

+ 7 - 0
src/interface/platform/matchPath.interface.ts

@@ -22,6 +22,8 @@ export class FVO_matchPath {
   'brief': string = undefined;
   @ApiProperty({ description: '是否公开' })
   'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
 }
 
 export class QDTO_matchPath extends SearchBase {
@@ -35,6 +37,8 @@ export class QDTO_matchPath extends SearchBase {
   'order_num': number = undefined;
   @ApiProperty({ description: '是否公开' })
   'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
 }
 
 export class QVO_matchPath extends FVO_matchPath {
@@ -66,6 +70,9 @@ export class CDTO_matchPath {
   @ApiProperty({ description: '显示顺序' })
   @Rule(RuleType['number']().empty(''))
   'order_num': number = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
 }
 
 export class CVO_matchPath extends FVO_matchPath {

+ 14 - 0
src/service/platform/match.service.ts

@@ -4,6 +4,7 @@ import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Repository } from 'typeorm';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 import { ProjectService } from './project.service';
+import { MatchPathService } from './matchPath.service';
 import dayjs = require('dayjs');
 @Provide()
 export class MatchService extends BaseServiceV2 {
@@ -12,6 +13,9 @@ export class MatchService extends BaseServiceV2 {
 
   @Inject()
   projectService: ProjectService;
+
+  @Inject()
+  matchService: MatchPathService;
   getQueryColumnsOpera() {
     const obj = {
       tags: this.Opera.Json,
@@ -32,4 +36,14 @@ export class MatchService extends BaseServiceV2 {
       }
     }
   }
+
+  // 删除赛事 删除相应的流程
+  async deleteFlow(id) {
+    const result = await this.matchService.query({ match: id });
+    if (result && result.total > 0) {
+      for (const val of result.data) {
+        await this.matchService.delete({ id: val.id });
+      }
+    }
+  }
 }