zs 8 months ago
parent
commit
ef6010c815

+ 2 - 2
src/controller/users/competition.controller.ts

@@ -1,4 +1,4 @@
-import { Body, Controller, Del, Get, Inject, Param, Post } from '@midwayjs/core';
+import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/core';
 import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
 import { Validate } from '@midwayjs/validate';
 import { BaseController } from '../../frame/BaseController';
@@ -21,7 +21,7 @@ export class CompetitionController implements BaseController {
   @ApiTags('列表查询')
   @ApiQuery({ name: 'query' })
   @ApiResponse({ type: QVO_competition })
-  async index(query: object) {
+  async index(@Query() query: object) {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const result = await this.service.query(qobj, others);

+ 3 - 3
src/entity/users/association.entity.ts

@@ -3,9 +3,9 @@ import { BaseModel } from '../../frame/BaseModel';
 // 商协会
 @Entity('association')
 export class Association extends BaseModel {
-  @Column({ type: 'integer', comment: '平台用户id' })
+  @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
   user: number;
-  @Column({ type: 'character varying', comment: '名称' })
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
   name: string;
   @Column({ type: 'character varying', nullable: true, comment: '负责人' })
   person: string;
@@ -19,6 +19,6 @@ export class Association extends BaseModel {
 
   @Column({ type: 'character varying', nullable: true, comment: '是否公开' })
   is_show: string;
-  @Column({ type: 'character varying', default: '0', comment: '状态' })
+  @Column({ type: 'character varying', nullable: true, default: '0', comment: '状态' })
   status: string;
 }

+ 5 - 5
src/entity/users/competition.entity.ts

@@ -3,13 +3,13 @@ import { BaseModel } from '../../frame/BaseModel';
 // 赛事管理人
 @Entity('competition')
 export class Competition extends BaseModel {
-  @Column({ type: 'integer', comment: '平台用户id' })
+  @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
   user: number;
-  @Column({ type: 'character varying', comment: '名称' })
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
   name: string;
-  @Column({ type: 'character varying', comment: '负责人名称' })
+  @Column({ type: 'character varying', nullable: true, comment: '负责人名称' })
   person: string;
-  @Column({ type: 'character varying', comment: '负责人电话' })
+  @Column({ type: 'character varying', nullable: true, comment: '负责人电话' })
   person_phone: string;
   @Column({ type: 'text', nullable: true, comment: '简介' })
   brief: string;
@@ -17,6 +17,6 @@ export class Competition extends BaseModel {
   address: string;
   @Column({ type: 'character varying', nullable: true, comment: '是否公开' })
   is_show: string;
-  @Column({ type: 'character varying', default: '0', comment: '状态' })
+  @Column({ type: 'character varying', nullable: true, default: '0', comment: '状态' })
   status: string;
 }

+ 1 - 1
src/entity/users/incubator.entity.ts

@@ -3,7 +3,7 @@ import { BaseModel } from '../../frame/BaseModel';
 //孵化器
 @Entity('incubator')
 export class Incubator extends BaseModel {
-  @Column({ type: 'integer', comment: '平台用户id' })
+  @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
   user: number;
   @Column({ type: 'character varying', nullable: true, comment: '名称' })
   name: string;

+ 1 - 1
src/service/serviceUtil.service.ts

@@ -58,7 +58,7 @@ export class ServiceUtilService {
       const dataUser = await this.userService.fetch({ id: get(data, 'user') });
       if (dataUser) {
         const role = union(get(dataUser, 'role'), [type]);
-        await this.userService.update(get(dataUser, 'id'), { id: get(dataUser, 'id'), role, status: '0' });
+        await this.userService.update({ id: get(dataUser, 'id') }, { id: get(dataUser, 'id'), role, status: '0' });
       }
     }
   }