zs 11 ماه پیش
والد
کامیت
953e06f9cc

+ 1 - 1
src/controller/home.controller.ts

@@ -7,7 +7,7 @@ export class HomeController {
   @Inject()
   service: initTwoService;
   @Inject()
-  regionService: InitRegionService
+  regionService: InitRegionService;
   @Get('/')
   async home(): Promise<any> {
     // const result: any = await this.adminService.create();

+ 67 - 0
src/controller/platform/footplate.controller.ts

@@ -0,0 +1,67 @@
+import { Controller, Inject, Get, Param, Post, Body, Del, Query } from '@midwayjs/core';
+import { FootplateService } from '../../service/platform/footplate.service';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+import { omit, pick } from 'lodash';
+import { BaseController } from '../../frame/BaseController';
+import { ServiceError, ErrorCode } from '../../error/service.error';
+import { QVO_footplate, FVO_footplate, CVO_footplate, UVAO_footplate } from '../../interface/platform/footplate.interface';
+const namePrefix = '中试平台';
+
+@ApiTags(['中试平台'])
+@Controller('/footplate', { tagName: namePrefix })
+export class footplateController implements BaseController {
+  @Inject()
+  service: FootplateService;
+
+  @Get('/')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_footplate })
+  async index(@Query() query: object) {
+    const qobj = omit(query, ['skip', 'limit']);
+    const others = pick(query, ['skip', 'limit']);
+    const qbr = this.service.queryBuilder(qobj);
+    const result = await this.service.query(qbr, others);
+    return result;
+  }
+
+  @Get('/:id')
+  @ApiTags('单查询')
+  @ApiResponse({ type: FVO_footplate })
+  async fetch(@Param('id') id: number) {
+    const qbr = this.service.queryBuilder({ id });
+    const data = await this.service.fetch(qbr);
+    const result = new FVO_footplate(data);
+    return result;
+  }
+
+  @Post('/', { routerName: `创建${namePrefix}` })
+  @ApiTags('创建数据')
+  @Validate()
+  @ApiResponse({ type: CVO_footplate })
+  async create(@Body() data: object) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_footplate(dbData);
+    return result;
+  }
+
+  @Post('/:id', { routerName: `修改${namePrefix}` })
+  @ApiTags('修改数据')
+  @Validate()
+  @ApiResponse({ type: UVAO_footplate })
+  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);
+    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;
+  }
+}

+ 4 - 2
src/entity/platform/demand.entity.ts

@@ -17,8 +17,10 @@ export class Demand extends BaseModel {
   urgent: string;
   @Column({ type: 'character varying', nullable: true, comment: '合作方式' })
   method: string;
-  @Column({ type: 'jsonb', nullable: true, comment: '有效期' })
-  time: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '开始时间' })
+  start_time: string;
+  @Column({ type: 'character varying', nullable: true, comment: '结束时间' })
+  end_time: string;
   @Column({ type: 'character varying', nullable: true, comment: '价格' })
   money: string;
   @Column({ type: 'jsonb', nullable: true, comment: '需求地区' })

+ 32 - 0
src/entity/platform/footplate.entity.ts

@@ -0,0 +1,32 @@
+import { Entity, Column } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+// 中试平台
+@Entity('footplate')
+export class Footplate extends BaseModel {
+  @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
+  user: number;
+  @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
+  industry: string;
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
+  name: string;
+  @Column({ type: 'character varying', nullable: true, comment: '建设主体' })
+  build: string;
+  @Column({ type: 'character varying', nullable: true, comment: '运营主体' })
+  operate: string;
+  @Column({ type: 'character varying', nullable: true, comment: '服务产业领域' })
+  field: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '所在地区' })
+  area: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '地址' })
+  address: string;
+  @Column({ type: 'character varying', nullable: true, comment: '联系人' })
+  contacts: string;
+  @Column({ type: 'character varying', nullable: true, comment: '联系电话' })
+  phone: string;
+  @Column({ type: 'character varying', nullable: true, comment: '简介' })
+  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;
+}

+ 4 - 2
src/entity/platform/supply.entity.ts

@@ -17,8 +17,10 @@ export class Supply extends BaseModel {
   urgent: string;
   @Column({ type: 'character varying', nullable: true, comment: '合作方式' })
   method: string;
-  @Column({ type: 'jsonb', nullable: true, comment: '有效期' })
-  time: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '开始时间' })
+  start_time: string;
+  @Column({ type: 'character varying', nullable: true, comment: '结束时间' })
+  end_time: string;
   @Column({ type: 'character varying', nullable: true, comment: '价格' })
   money: string;
   @Column({ type: 'jsonb', nullable: true, comment: '供给地区' })

+ 14 - 7
src/interface/platform/demand.interface.ts

@@ -21,8 +21,10 @@ export class FVO_demand {
   'urgent': string = undefined;
   @ApiProperty({ description: '合作方式' })
   'method': string = undefined;
-  @ApiProperty({ description: '有效期' })
-  'time': Array<any> = undefined;
+  @ApiProperty({ description: '开始时间' })
+  'start_time': string = undefined;
+  @ApiProperty({ description: '结束时间' })
+  'end_time': string = undefined;
   @ApiProperty({ description: '价格' })
   'money': string = undefined;
   @ApiProperty({ description: '需求地区' })
@@ -70,8 +72,10 @@ export class QDTO_demand {
   'method': string = undefined;
   @ApiProperty({ description: '需求紧急度' })
   'urgent': string = undefined;
-  @ApiProperty({ description: '有效期' })
-  'time': Array<any> = undefined;
+  @ApiProperty({ description: '开始时间' })
+  'start_time': string = undefined;
+  @ApiProperty({ description: '结束时间' })
+  'end_time': string = undefined;
   @ApiProperty({ description: '价格' })
   'money': string = undefined;
   @ApiProperty({ description: '需求地区' })
@@ -131,9 +135,12 @@ export class CDTO_demand {
   @ApiProperty({ description: '合作方式' })
   @Rule(RuleType['string']().empty(''))
   'method': string = undefined;
-  @ApiProperty({ description: '有效期' })
-  @Rule(RuleType['array']().empty(''))
-  'time': Array<any> = undefined;
+  @ApiProperty({ description: '开始时间' })
+  @Rule(RuleType['string']().empty(''))
+  'start_time': string = undefined;
+  @ApiProperty({ description: '结束时间' })
+  @Rule(RuleType['string']().empty(''))
+  'end_time': string = undefined;
   @ApiProperty({ description: '价格' })
   @Rule(RuleType['string']().empty(''))
   'money': string = undefined;

+ 129 - 0
src/interface/platform/footplate.interface.ts

@@ -0,0 +1,129 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from '../../frame/SearchBase';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_footplate {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '建设主体' })
+  'build': string = undefined;
+  @ApiProperty({ description: '运营主体' })
+  'operate': string = undefined;
+  @ApiProperty({ description: '服务产业领域' })
+  'field': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  'area': Array<any> = undefined;
+  @ApiProperty({ description: '地址' })
+  'address': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_footplate extends SearchBase {
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '建设主体' })
+  'build': string = undefined;
+  @ApiProperty({ description: '运营主体' })
+  'operate': string = undefined;
+  @ApiProperty({ description: '服务产业领域' })
+  'field': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_footplate extends FVO_footplate {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_footplate {
+  @ApiProperty({ description: '平台用户id' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  @Rule(RuleType['string']().empty(''))
+  'industry': string = undefined;
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '建设主体' })
+  @Rule(RuleType['string']().empty(''))
+  'build': string = undefined;
+  @ApiProperty({ description: '运营主体' })
+  @Rule(RuleType['string']().empty(''))
+  'operate': string = undefined;
+  @ApiProperty({ description: '服务产业领域' })
+  @Rule(RuleType['string']().empty(''))
+  'field': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  @Rule(RuleType['array']().empty(''))
+  'area': Array<any> = undefined;
+  @ApiProperty({ description: '地址' })
+  @Rule(RuleType['string']().empty(''))
+  'address': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  @Rule(RuleType['string']().empty(''))
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  @Rule(RuleType['string']().empty(''))
+  'phone': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_footplate extends FVO_footplate {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_footplate extends CDTO_footplate {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_footplate extends FVO_footplate {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 14 - 5
src/interface/platform/supply.interface.ts

@@ -22,8 +22,10 @@ export class FVO_supply {
   'urgent': string = undefined;
   @ApiProperty({ description: '合作方式' })
   'method': string = undefined;
-  @ApiProperty({ description: '有效期' })
-  'time': Array<any> = undefined;
+  @ApiProperty({ description: '开始时间' })
+  'start_time': string = undefined;
+  @ApiProperty({ description: '结束时间' })
+  'end_time': string = undefined;
   @ApiProperty({ description: '价格' })
   'money': string = undefined;
   @ApiProperty({ description: '需求地区' })
@@ -57,6 +59,10 @@ export class QDTO_supply extends SearchBase {
   'method': string = undefined;
   @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
+  @ApiProperty({ description: '开始时间' })
+  'start_time': string = undefined;
+  @ApiProperty({ description: '结束时间' })
+  'end_time': string = undefined;
   @ApiProperty({ description: '项目来源' })
   'source': string = undefined;
   @ApiProperty({ description: '需求状态' })
@@ -96,9 +102,12 @@ export class CDTO_supply {
   @ApiProperty({ description: '合作方式' })
   @Rule(RuleType['string']().empty(''))
   'method': string = undefined;
-  @ApiProperty({ description: '有效期' })
-  @Rule(RuleType['array']().empty(''))
-  'time': Array<any> = undefined;
+  @ApiProperty({ description: '开始时间' })
+  @Rule(RuleType['string']().empty(''))
+  'start_time': string = undefined;
+  @ApiProperty({ description: '结束时间' })
+  @Rule(RuleType['string']().empty(''))
+  'end_time': string = undefined;
   @ApiProperty({ description: '价格' })
   @Rule(RuleType['string']().empty(''))
   'money': string = undefined;

+ 10 - 0
src/service/platform/footplate.service.ts

@@ -0,0 +1,10 @@
+import { Provide } from '@midwayjs/core';
+import { InjectEntityModel } from '@midwayjs/typeorm';
+import { Repository } from 'typeorm';
+import { Footplate } from '../../entity/platform/footplate.entity';
+import { BaseService } from '../../frame/BaseService';
+@Provide()
+export class FootplateService extends BaseService<Footplate> {
+  @InjectEntityModel(Footplate)
+  model: Repository<Footplate>;
+}