Przeglądaj źródła

新增孵化器企业关联表

zs 8 miesięcy temu
rodzic
commit
416d6a8a6d

+ 2 - 1
src/controller/platform/journal.controller.ts

@@ -19,7 +19,8 @@ export class JournalController implements BaseController {
   @ApiResponse({ type: QVO_journal })
   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;
   }

+ 70 - 0
src/controller/users/cirelation.controller.ts

@@ -0,0 +1,70 @@
+import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/core';
+import { CirelationService } from '../../service/users/cirelation.service';
+import { CVO_cirelation, FVO_cirelation, QVO_cirelation, UVAO_cirelation } from '../../interface/users/cirelation.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+import { BaseController } from '../../frame/BaseController';
+import { omit, pick } from 'lodash';
+import { ErrorCode, ServiceError } from '../../error/service.error';
+import { ServiceUtilService } from '../../service/serviceUtil.service';
+const namePrefix = '企业孵化器关联';
+@ApiTags(['企业孵化器关联'])
+@Controller('/cirelation', { tagName: namePrefix })
+export class cirelationController implements BaseController {
+  @Inject()
+  service: CirelationService;
+
+  @Inject()
+  serviceUtil: ServiceUtilService;
+
+  @Get('/')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_cirelation })
+  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);
+    return result;
+  }
+
+  @Get('/:id')
+  @ApiTags('单查询')
+  @ApiResponse({ type: FVO_cirelation })
+  async fetch(@Param('id') id: number) {
+    const data = await this.service.fetch({ id });
+    const result = new FVO_cirelation(data);
+    return result;
+  }
+
+  @Post('/', { routerName: `创建${namePrefix}` })
+  @ApiTags('创建数据')
+  @Validate()
+  @ApiResponse({ type: CVO_cirelation })
+  async create(@Body() data: object) {
+    const dbData = await this.service.create(data);
+    this.serviceUtil.fillIdentity(data, 'cirelation');
+    const result = new CVO_cirelation(dbData);
+    return result;
+  }
+
+  @Post('/:id', { routerName: `修改${namePrefix}` })
+  @ApiTags('修改数据')
+  @Validate()
+  @ApiResponse({ type: UVAO_cirelation })
+  async update(@Param('id') id: number, @Body() data: object) {
+    if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
+    const result = await this.service.update({ id }, data);
+    this.serviceUtil.fillIdentity(data, 'cirelation');
+    return result;
+  }
+
+  @Del('/:id', { routerName: `删除${namePrefix}` })
+  @ApiTags('删除数据')
+  @Validate()
+  async delete(@Param('id') id: number) {
+    if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
+    const result = await this.service.delete({ id });
+    return result;
+  }
+}

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

@@ -11,6 +11,8 @@ export class Journal extends BaseModel {
   file: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '简介' })
   brief: string;
+  @Column({ type: 'integer', nullable: true, comment: '排序' })
+  sort: number;
   @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
   is_use: string;
   @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })

+ 16 - 0
src/entity/users/cirelation.entity.ts

@@ -0,0 +1,16 @@
+import { Entity, Column } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+// 企业孵化器关联
+@Entity('cirelation')
+export class Cirelation extends BaseModel {
+  @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
+  user: number;
+  @Column({ type: 'integer', nullable: true, comment: '孵化器id' })
+  incubator: number;
+  @Column({ type: 'integer', nullable: true, comment: '企业id' })
+  company: number;
+  @Column({ type: 'character varying', nullable: true, comment: '申请时间' })
+  time: string;
+  @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
+  status: string;
+}

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

@@ -14,6 +14,8 @@ export class FVO_journal {
   'file': Array<any> = undefined;
   @ApiProperty({ description: '名称' })
   'name': string = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
   @ApiProperty({ description: '简介' })
   'brief': string = undefined;
   @ApiProperty({ description: '是否使用' })
@@ -27,6 +29,8 @@ export class QDTO_journal extends SearchBase {
   'user': number = undefined;
   @ApiProperty({ description: '名称' })
   'name': string = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
   @ApiProperty({ description: '是否使用' })
   'is_use': string = undefined;
   @ApiProperty({ description: '状态' })
@@ -53,6 +57,9 @@ export class CDTO_journal {
   @ApiProperty({ description: '简介' })
   @Rule(RuleType['string']().empty(''))
   'brief': string = undefined;
+  @ApiProperty({ description: '排序' })
+  @Rule(RuleType['number']().empty(''))
+  'sort': number = undefined;
   @ApiProperty({ description: '是否使用' })
   @Rule(RuleType['string']().empty(''))
   'is_use': string = undefined;

+ 78 - 0
src/interface/users/cirelation.interface.ts

@@ -0,0 +1,78 @@
+import { ApiProperty } from '@midwayjs/swagger';
+import { Rule, RuleType } from '@midwayjs/validate';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_cirelation {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: string = undefined;
+  @ApiProperty({ description: '平台用户id' })
+  'user': number = undefined;
+  @ApiProperty({ description: '孵化器id' })
+  'incubator': number = undefined;
+  @ApiProperty({ description: '企业id' })
+  'company': number = undefined;
+  @ApiProperty({ description: '申请时间' })
+  'time': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_cirelation {
+  @ApiProperty({ description: '平台用户id' })
+  'user': number = undefined;
+  @ApiProperty({ description: '孵化器id' })
+  'incubator': number = undefined;
+  @ApiProperty({ description: '企业id' })
+  'company': number = undefined;
+  @ApiProperty({ description: '申请时间' })
+  'time': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_cirelation extends FVO_cirelation {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_cirelation {
+  @ApiProperty({ description: '平台用户id' })
+  @Rule(RuleType['number']().empty(''))
+  'user': number = undefined;
+  @ApiProperty({ description: '孵化器id' })
+  @Rule(RuleType['number']().empty(''))
+  'incubator': number = undefined;
+  @ApiProperty({ description: '企业id' })
+  @Rule(RuleType['number']().empty(''))
+  'company': number = undefined;
+  @ApiProperty({ description: '申请时间' })
+  @Rule(RuleType['string']().empty(''))
+  'time': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_cirelation extends FVO_cirelation {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_cirelation extends CDTO_cirelation {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_cirelation extends FVO_cirelation {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 13 - 0
src/service/users/cirelation.service.ts

@@ -0,0 +1,13 @@
+import { Provide } from '@midwayjs/core';
+import { InjectEntityModel } from '@midwayjs/typeorm';
+import { Repository } from 'typeorm';
+import { Cirelation } from '../../entity/users/cirelation.entity';
+import { BaseServiceV2 } from '../../frame/BaseServiceV2';
+@Provide()
+export class CirelationService extends BaseServiceV2 {
+  getQueryColumnsOpera(): object {
+    return {};
+  }
+  @InjectEntityModel(Cirelation)
+  model: Repository<Cirelation>;
+}