Selaa lähdekoodia

Merge branch 'main' of http://git.cc-lotus.info/Information/cxyy-service

lrf 9 kuukautta sitten
vanhempi
commit
cfe4354adb

+ 106 - 0
public/importMapping.js

@@ -0,0 +1,106 @@
+// 注释是表名
+// achievement
+const achievement = [
+  { index: 1, field: 'name', zh: '名称' },
+  { index: 2, field: 'industry', zh: '所属产业' },
+  { index: 3, field: 'patent', zh: '专利号' },
+  { index: 4, field: 'name', zh: '名称' },
+  { index: 5, field: 'attribute', type: 'dict', code: 'attribute', zh: '属性' },
+  { index: 6, field: 'sell', type: 'dict', code: 'sell', zh: '出让方式' },
+  { index: 7, field: 'mature', type: 'dict', code: 'mature', zh: '成熟度' },
+  { index: 8, field: 'field', type: 'dict', code: 'field', zh: '行业领域' },
+  { index: 9, field: 'technology', type: 'dict', code: 'technology', zh: '技术分类' },
+  { index: 10, field: 'area', type: 'area', zh: '地区' },
+  { index: 10, field: 'money', zh: '参考价格' },
+  { index: 11, field: 'time', type: 'date', zh: '发布时间' },
+  { index: 12, field: 'source', zh: '项目来源' },
+  { index: 13, field: 'person', zh: '负责人' },
+  { index: 14, field: 'tel', zh: '联系电话' },
+  { index: 15, field: 'brief', zh: '简介' },
+];
+
+// project
+const project = [
+  { index: 1, field: 'name', zh: '名称' },
+  { index: 2, field: 'industry', zh: '所属产业' },
+  { index: 3, field: 'time', type: 'date', zh: '发布时间' },
+  { index: 4, field: 'type', type: 'dict', code: 'industry', zh: '行业分类' },
+  { index: 5, field: 'maturity', type: 'dict', code: 'projectMaturity', zh: '成熟度' },
+  { index: 6, field: 'skill', type: 'dict', code: 'technology', zh: '技术类型' },
+  { index: 7, field: 'field', type: 'dict', code: 'field', zh: '行业领域' },
+  { index: 8, field: 'cooperate', type: 'dict', code: 'projectType', zh: '合作类型' },
+  { index: 9, field: 'area', type: 'area', zh: '地区' },
+  { index: 10, field: 'main', zh: '项目主体' },
+  { index: 11, field: 'progress', zh: '项目进展' },
+  { index: 12, field: 'main', zh: '项目主体' },
+  { index: 13, field: 'track_unit', zh: '跟踪支持单位' },
+  { index: 14, field: 'source', zh: '项目来源' },
+  { index: 15, field: 'brief', zh: '简介' },
+];
+
+// demand
+const demand = [
+  { index: 1, field: 'name', zh: '名称' },
+  { index: 2, field: 'industry', zh: '所属产业' },
+  { index: 3, field: 'start_time', type: 'date', zh: '开始时间' },
+  { index: 4, field: 'end_time', type: 'date', zh: '结束时间' },
+  { index: 5, field: 'money', type: 'date', zh: '价格' },
+  { index: 6, field: 'type', type: 'dict', code: 'type', zh: '类型' },
+  { index: 7, field: 'field', type: 'dict', code: 'field', zh: '行业领域' },
+  { index: 8, field: 'urgent', type: 'dict', code: 'urgent', zh: '需求紧急度' },
+  { index: 9, field: 'method', type: 'dict', code: 'method', zh: '合作方式' },
+  { index: 10, field: 'area', type: 'area', zh: '地区' },
+  { index: 11, field: 'company', zh: '所属企业' },
+  { index: 12, field: 'company_brief', zh: '企业简况' },
+  { index: 13, field: 'contacts', zh: '联系人' },
+  { index: 14, field: 'tel', zh: '联系电话' },
+  { index: 15, field: 'year', zh: '年份' },
+  { index: 16, field: 'month', zh: '月份' },
+  { index: 17, field: 'tec_name', zh: '技术需求名称' },
+  { index: 18, field: 'question', zh: '待解决问题' },
+  { index: 19, field: 'brief', zh: '简介' },
+];
+
+// supply
+const supply = [
+  { index: 1, field: 'name', zh: '名称' },
+  { index: 2, field: 'industry', zh: '所属产业' },
+  { index: 3, field: 'start_time', type: 'date', zh: '开始时间' },
+  { index: 4, field: 'end_time', type: 'date', zh: '结束时间' },
+  { index: 5, field: 'money', type: 'date', zh: '价格' },
+  { index: 6, field: 'type', type: 'dict', code: 'type', zh: '类型' },
+  { index: 7, field: 'field', type: 'dict', code: 'field', zh: '行业领域' },
+  { index: 8, field: 'urgent', type: 'dict', code: 'urgent', zh: '需求紧急度' },
+  { index: 9, field: 'method', type: 'dict', code: 'method', zh: '合作方式' },
+  { index: 10, field: 'area', type: 'area', zh: '地区' },
+  { index: 11, field: 'source', zh: '项目来源' },
+  { index: 19, field: 'brief', zh: '简介' },
+];
+
+// company
+const company = [
+  { index: 1, field: 'name', zh: '名称' },
+  { index: 2, field: 'industry', zh: '所属产业' },
+  { index: 3, field: 'code', zh: '企业统一信用代码名称' },
+  { index: 3, field: 'representative', zh: '法定代表人' },
+  { index: 3, field: 'email', zh: '电子邮箱' },
+  { index: 3, field: 'number', zh: '员工人数' },
+  { index: 3, field: 'register', zh: '注册资本' },
+  { index: 3, field: 'create_time', type: 'date', zh: '成立时间' },
+  { index: 6, field: 'pattern', type: 'dict', code: 'pattern', zh: '企业类型' },
+  { index: 7, field: 'scale', type: 'dict', code: 'scale', zh: '企业规模' },
+  { index: 7, field: 'type', type: 'dict', code: 'type', zh: '所属行业' },
+  { index: 10, field: 'area', type: 'area', zh: '地区' },
+  { index: 11, field: 'phone', zh: '联系电话' },
+  { index: 12, field: 'address', zh: '地址' },
+  { index: 13, field: 'products', zh: '产品' },
+  { index: 19, field: 'brief', zh: '简介' },
+];
+
+module.exports = {
+  achievement,
+  project,
+  demand,
+  supply,
+  company,
+};

+ 76 - 0
src/controller/platform/friend.controller.ts

@@ -0,0 +1,76 @@
+import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/core';
+import { BaseController } from '../../frame/BaseController';
+import { ApiQuery, ApiResponse, ApiTags } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+import { omit, pick } from 'lodash';
+import { ErrorCode, ServiceError } from '../../error/service.error';
+import { CVO_friend, FVO_friend, QVO_friend, UVAO_friend } from '../../interface/platform/friend.interface';
+import { FriendService } from '../../service/platform/friend.service';
+import { Context } from '@midwayjs/koa';
+const namePrefix = '合作伙伴';
+@ApiTags(['合作伙伴'])
+@Controller('/friend', { tagName: namePrefix })
+export class FriendController implements BaseController {
+  @Inject()
+  service: FriendService;
+
+  @Inject()
+  ctx: Context;
+
+  @Get('/')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_friend })
+  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('/list')
+  async list() {
+    const list = await this.service.list(this.ctx.query);
+    const data = list.data;
+    const total = list.total;
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiTags('单查询')
+  @ApiResponse({ type: FVO_friend })
+  async fetch(@Param('id') id: number) {
+    const data = await this.service.fetch({ id });
+    const result = new FVO_friend(data);
+    return result;
+  }
+
+  @Post('/', { routerName: `创建${namePrefix}` })
+  @ApiTags('创建数据')
+  @Validate()
+  @ApiResponse({ type: CVO_friend })
+  async create(@Body() data: object) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_friend(dbData);
+    return result;
+  }
+
+  @Post('/:id', { routerName: `修改${namePrefix}` })
+  @ApiTags('修改数据')
+  @Validate()
+  @ApiResponse({ type: UVAO_friend })
+  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;
+  }
+}

+ 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;
+  }
+}

+ 11 - 2
src/controller/users/incubator.controller.ts

@@ -8,8 +8,8 @@ import { Context } from '@midwayjs/koa';
 import { IncubatorService } from '../../service/users/incubator.service';
 import { QVO_incubator, FVO_incubator, CVO_incubator, UVAO_incubator } from '../../interface/users/incubator.interface';
 import { ServiceUtilService } from '../../service/serviceUtil.service';
-const namePrefix = '孵化';
-@ApiTags(['孵化'])
+const namePrefix = '孵化基地';
+@ApiTags(['孵化基地'])
 @Controller('/incubator', { tagName: namePrefix })
 export class IncubatorController implements BaseController {
   @Inject()
@@ -70,4 +70,13 @@ export class IncubatorController implements BaseController {
     const result = await this.service.delete({ id });
     return result;
   }
+
+  @Get('/detail/:id')
+  @ApiResponse({ type: FVO_incubator })
+  async detail(@Param('id') id: string) {
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data, 'incubator');
+    return data;
+  }
 }

+ 52 - 0
src/controller/util.controller.ts

@@ -0,0 +1,52 @@
+import { Controller, Post, Inject } from '@midwayjs/core';
+import { Context } from '@midwayjs/koa';
+import { ApiTags } from '@midwayjs/swagger';
+import { UtilService } from '../service/util.service';
+const Excel = require('exceljs');
+@ApiTags(['工具'])
+@Controller('/util')
+export class UtilController {
+  @Inject()
+  service: UtilService;
+
+  @Inject()
+  ctx: Context;
+
+  @Post('/toImport')
+  async toImport() {
+    const stream = await this.ctx.getFileStream();
+    const workbook = new Excel.Workbook();
+    await workbook.xlsx.read(stream);
+    const result = [];
+    const sheetList = [];
+    workbook.eachSheet(sheet => {
+      // 整理出的数据
+      const rows = [];
+      sheet.eachRow((row, ri) => {
+        if (ri !== 1) {
+          const rd = [null];
+          row.eachCell({ includeEmpty: true }, c => {
+            const value = c.value;
+            rd.push(value);
+          });
+          rows.push(rd);
+        }
+      });
+      sheetList.push({ sheet: sheet.name, rows });
+    });
+    for (const s of sheetList) {
+      const { sheet, rows } = s;
+      const func = this.service.nameToFunction(sheet);
+      if (!func) continue;
+      try {
+        const num = await this.service[func](rows);
+        result[sheet] = num.result;
+        result.push({ key: sheet, num: num.result, errorList: num.errorList.join(',') });
+      } catch (error) {
+        console.log(error);
+        result.push({ key: sheet, num: 'error' });
+      }
+    }
+    this.ctx.ok({ data: result });
+  }
+}

+ 18 - 0
src/entity/platform/friend.entity.ts

@@ -0,0 +1,18 @@
+import { Entity, Column } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+
+@Entity('friend')
+export class Friend extends BaseModel {
+  @Column({ type: 'character varying', nullable: true, comment: '编码' })
+  code: string;
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
+  name: string;
+  @Column({ type: 'jsonb', nullable: true, comment: 'logo', default: [] })
+  file: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '简介' })
+  brief: string;
+  @Column({ type: 'character varying', nullable: true, comment: '上级编码' })
+  parent_code: string;
+  @Column({ type: 'character varying', comment: '是否启用', default: '0' })
+  is_use: string;
+}

+ 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' })

+ 4 - 0
src/entity/platform/match.entity.ts

@@ -13,6 +13,8 @@ export class Match extends BaseModel {
   type: string;
   @Column({ type: 'character varying', nullable: true, comment: '赛事类型' })
   match_type: string;
+  @Column({ type: 'character varying', nullable: true, comment: '赛事规模' })
+  scale: string;
   @Column({ type: 'character varying', nullable: true, comment: '路由' })
   href: string;
   @Column({ type: 'character varying', nullable: true, comment: '组织单位' })
@@ -35,6 +37,8 @@ export class Match extends BaseModel {
   brief: string;
   @Column({ type: 'jsonb', nullable: true, comment: '封面', default: [] })
   file: Array<any>;
+  @Column({ type: 'jsonb', nullable: true, comment: '视频', default: [] })
+  video: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '赛事状态', default: '0' })
   match_status: 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;
+}

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

@@ -12,7 +12,7 @@ export class Company extends BaseModel {
   tags: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '企业名称' })
   name: string;
-  @Column({ type: 'jsonb', nullable: true, comment: 'logo' })
+  @Column({ type: 'jsonb', nullable: true, comment: 'logo', default: [] })
   logo: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '企业统一信用代码名称' })
   code: string;

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

@@ -11,7 +11,7 @@ export class Expert extends BaseModel {
   tags: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '专家姓名' })
   name: string;
-  @Column({ type: 'jsonb', nullable: true, comment: '头像' })
+  @Column({ type: 'jsonb', nullable: true, comment: '头像', default: [] })
   icon: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '性别' })
   gender: string;

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

@@ -1,22 +1,32 @@
 import { Column, Entity } from 'typeorm';
 import { BaseModel } from '../../frame/BaseModel';
-//孵化
+//孵化基地
 @Entity('incubator')
 export class Incubator extends BaseModel {
   @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
   user: number;
+  @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
+  industry: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '标签', default: [] })
+  tags: Array<any>;
+  @Column({ type: 'jsonb', nullable: true, comment: 'logo', default: [] })
+  logo: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '名称' })
   name: string;
   @Column({ type: 'character varying', nullable: true, comment: '负责人姓名' })
   person: string;
   @Column({ type: 'character varying', nullable: true, comment: '负责人电话' })
   person_phone: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '所在地区' })
+  area: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '地址' })
   address: string;
   @Column({ type: 'text', nullable: true, comment: '简介' })
   brief: string;
   @Column({ type: 'character varying', nullable: true, comment: '是否公开' })
   is_show: string;
+  @Column({ type: 'character varying', nullable: true, comment: '是否和平台合作标识' })
+  cooperate: string;
   @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
   status: string;
 }

+ 82 - 0
src/interface/platform/friend.interface.ts

@@ -0,0 +1,82 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_friend {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '编码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: 'logo' })
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '上级编码' })
+  'parent_code': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QDTO_friend {
+  @ApiProperty({ description: '编码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '上级编码' })
+  'parent_code': string = undefined;
+
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QVO_friend extends FVO_friend {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_friend {
+  @ApiProperty({ description: '编码' })
+  @Rule(RuleType['string']().empty(''))
+  'code': string = undefined;
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: 'logo' })
+  @Rule(RuleType['array']().empty(''))
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '上级编码' })
+  @Rule(RuleType['string']().empty(''))
+  'parent_code': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+}
+
+export class CVO_friend extends FVO_friend {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_friend extends CDTO_friend {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_friend extends FVO_friend {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 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;

+ 12 - 0
src/interface/platform/match.interface.ts

@@ -18,6 +18,8 @@ export class FVO_match {
   'type': string = undefined;
   @ApiProperty({ description: '赛事类型' })
   'match_type': string = undefined;
+  @ApiProperty({ description: '赛事规模' })
+  'scale': string = undefined;
   @ApiProperty({ description: '路由' })
   'href': string = undefined;
   @ApiProperty({ description: '组织单位' })
@@ -40,6 +42,8 @@ export class FVO_match {
   'brief': string = undefined;
   @ApiProperty({ description: '封面' })
   'file': Array<any> = undefined;
+  @ApiProperty({ description: '视频' })
+  'video': Array<any> = undefined;
   @ApiProperty({ description: '赛事状态' })
   'match_status': string = undefined;
   @ApiProperty({ description: '是否公开' })
@@ -63,6 +67,8 @@ export class QDTO_match extends SearchBase {
   'type': string = undefined;
   @ApiProperty({ description: '赛事类型' })
   'match_type': string = undefined;
+  @ApiProperty({ description: '赛事规模' })
+  'scale': string = undefined;
   @ApiProperty({ description: '路由' })
   'href': string = undefined;
   @ApiProperty({ description: '开始时间' })
@@ -108,6 +114,9 @@ export class CDTO_match {
   @ApiProperty({ description: '赛事类型' })
   @Rule(RuleType['string']().empty(''))
   'match_type': string = undefined;
+  @ApiProperty({ description: '赛事规模' })
+  @Rule(RuleType['string']().empty(''))
+  'scale': string = undefined;
   @ApiProperty({ description: '路由' })
   @Rule(RuleType['string']().empty(''))
   'href': string = undefined;
@@ -141,6 +150,9 @@ export class CDTO_match {
   @ApiProperty({ description: '封面' })
   @Rule(RuleType['array']().empty(''))
   'file': Array<any> = undefined;
+  @ApiProperty({ description: '视频' })
+  @Rule(RuleType['array']().empty(''))
+  'video': Array<any> = undefined;
   @ApiProperty({ description: '赛事状态' })
   @Rule(RuleType['string']().empty(''))
   'match_status': 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);
+  }
+}

+ 33 - 0
src/interface/users/incubator.interface.ts

@@ -9,18 +9,28 @@ export class FVO_incubator {
   id: number = undefined;
   @ApiProperty({ description: '平台用户id' })
   'user': number = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
+  @ApiProperty({ description: '标签' })
+  'tags': Array<any> = undefined;
   @ApiProperty({ description: '名称' })
   'name': string = undefined;
+  @ApiProperty({ description: 'logo' })
+  'logo': Array<any> = undefined;
   @ApiProperty({ description: '负责人姓名' })
   'person': string = undefined;
   @ApiProperty({ description: '负责人电话' })
   'person_phone': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  'area': Array<any> = undefined;
   @ApiProperty({ description: '地址' })
   'address': string = undefined;
   @ApiProperty({ description: '简介' })
   'brief': string = undefined;
   @ApiProperty({ description: '是否公开' })
   'is_show': string = undefined;
+  @ApiProperty({ description: '是否和平台合作标识' })
+  'cooperate': string = undefined;
   @ApiProperty({ description: '状态' })
   'status': string = undefined;
 }
@@ -28,12 +38,20 @@ export class FVO_incubator {
 export class QDTO_incubator {
   @ApiProperty({ description: '平台用户id' })
   'user': number = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
+  @ApiProperty({ description: '标签' })
+  'tags': Array<any> = undefined;
   @ApiProperty({ description: '名称' })
   'name': string = undefined;
+  @ApiProperty({ description: 'logo' })
+  'logo': Array<any> = undefined;
   @ApiProperty({ description: '负责人电话' })
   'person_phone': string = undefined;
   @ApiProperty({ description: '是否公开' })
   'is_show': string = undefined;
+  @ApiProperty({ description: '是否和平台合作标识' })
+  'cooperate': string = undefined;
   @ApiProperty({ description: '状态' })
   'status': string = undefined;
 }
@@ -49,15 +67,27 @@ export class CDTO_incubator {
   @ApiProperty({ description: '平台用户id' })
   @Rule(RuleType['number']().empty(''))
   'user': number = undefined;
+  @ApiProperty({ description: '所属产业' })
+  @Rule(RuleType['string']().empty(''))
+  'industry': string = undefined;
+  @ApiProperty({ description: '标签' })
+  @Rule(RuleType['array']().empty(''))
+  'tags': Array<any> = undefined;
   @ApiProperty({ description: '名称' })
   @Rule(RuleType['string']().empty(''))
   'name': string = undefined;
+  @ApiProperty({ description: 'logo' })
+  @Rule(RuleType['array']().empty(''))
+  'logo': Array<any> = undefined;
   @ApiProperty({ description: '负责人姓名' })
   @Rule(RuleType['string']().empty(''))
   'person': string = undefined;
   @ApiProperty({ description: '负责人电话' })
   @Rule(RuleType['string']().empty(''))
   'person_phone': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  @Rule(RuleType['array']().empty(''))
+  'area': Array<any> = undefined;
   @ApiProperty({ description: '地址' })
   @Rule(RuleType['string']().empty(''))
   'address': string = undefined;
@@ -67,6 +97,9 @@ export class CDTO_incubator {
   @ApiProperty({ description: '是否公开' })
   @Rule(RuleType['string']().empty(''))
   'is_show': string = undefined;
+  @ApiProperty({ description: '是否和平台合作标识' })
+  @Rule(RuleType['string']().empty(''))
+  'cooperate': string = undefined;
   @ApiProperty({ description: '状态' })
   @Rule(RuleType['string']().empty(''))
   'status': string = undefined;

+ 1 - 1
src/service/initData/dataDeal.service.ts

@@ -277,7 +277,7 @@ export class DataDealService {
     await this.Role.update({ code: In(justCommonRole) }, { menu: common });
     // 第一类菜单
     const menus1 = [...common, 'center_news2', 'center_demand', 'center_supply', 'center_achievement', 'center_project', 'center_footplate', 'center_service'];
-    // 第一类菜单用户: 用户,科研机构,孵化,企业,高校
+    // 第一类菜单用户: 用户,科研机构,孵化基地,企业,高校
     const roleUseMenus1 = ['Expert', 'Unit', 'Incubator', 'Company', 'YX'];
     await this.Role.update({ code: In(roleUseMenus1) }, { menu: menus1 });
     // 创业大赛用户: 需要去掉报名管理,加入赛事管理

+ 7 - 3
src/service/platform/collection.service.ts

@@ -13,6 +13,7 @@ import { NewsService } from '../platform/news.service';
 import { ExpertService } from '../../service/users/expert.service';
 import { DemandService } from '../platform/demand.service';
 import { CompanyService } from '../../service/users/company.service';
+import { IncubatorService } from '../users/incubator.service';
 @Provide()
 export class CollectionService extends BaseServiceV2 {
   getQueryColumnsOpera(): object {
@@ -41,19 +42,22 @@ export class CollectionService extends BaseServiceV2 {
   demand: DemandService;
   @Inject()
   company: CompanyService;
+  @Inject()
+  incubator: IncubatorService;
 
   // 转化来源数据名称
   async fillScource(data) {
     const { type, source } = data;
     const dataRes = await this[type].fetch({ id: source });
-    if (dataRes) data = { ...data, source_name: dataRes.name || dataRes.title };
+    if (dataRes) data = { ...data, source_name: dataRes.name || dataRes.title, status: '1' };
+    else data = { ...data, source_name: '已失效', status: '-1' };
     return data;
   }
 
   // 取消收藏
   async cancel(data) {
-    const { user, source } = data;
-    const d = await this.model.findOne({ where: { user: Equal(user), source: Equal(source) } });
+    const { user, source, type } = data;
+    const d = await this.model.findOne({ where: { user: Equal(user), source: Equal(source), type: Equal(type) } });
     await this.model.delete(d.id);
   }
 }

+ 29 - 0
src/service/platform/friend.service.ts

@@ -0,0 +1,29 @@
+import { Provide } from '@midwayjs/core';
+import { InjectEntityModel } from '@midwayjs/typeorm';
+import { Friend } from '../../entity/platform/friend.entity';
+import { BaseServiceV2 } from '../../frame/BaseServiceV2';
+import { get, pick } from 'lodash';
+import { IsNull, Equal, Repository } from 'typeorm';
+@Provide()
+export class FriendService extends BaseServiceV2 {
+  @InjectEntityModel(Friend)
+  model: Repository<Friend>;
+
+  // 合作伙伴列表
+  async list(query) {
+    const { skip = 0, limit = 0, parent_code, ...info } = pick(query, ['skip', 'limit', 'code', 'parent_code']);
+    const whereObject: any = { parent_code, ...info };
+    if (!parent_code) whereObject.parent_code = IsNull();
+    const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
+    const data = await builder.getMany();
+    const total = await builder.getCount();
+    for (const val of data) {
+      if (get(val, 'code')) {
+        // 查询下一级
+        const region = await this.model.findOne({ where: { parent_code: Equal(val.code) } });
+        if (region) Object.assign(val, { hasChildren: true });
+      }
+    }
+    return { data, total };
+  }
+}

+ 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>;
+}

+ 9 - 0
src/service/users/incubator.service.ts

@@ -7,4 +7,13 @@ import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 export class IncubatorService extends BaseServiceV2 {
   @InjectEntityModel(Incubator)
   model: Repository<Incubator>;
+  getQueryColumnsOpera() {
+    const obj = {
+      name: this.Opera.Like,
+      industry: this.Opera.In,
+      tags: this.Opera.Json,
+      area: this.Opera.Json,
+    };
+    return obj;
+  }
 }

+ 276 - 40
src/service/util.service.ts

@@ -1,54 +1,290 @@
 import { Inject, Provide } from '@midwayjs/core';
-// import { Achievement } from '../entity/platform/achievement.entity';
-import { TypeORMDataSourceManager } from '@midwayjs/typeorm';
+import { get } from 'lodash';
 import { Context } from '@midwayjs/koa';
-import { Test } from '../entity/test.entity';
+import { InjectEntityModel } from '@midwayjs/typeorm';
+import { ServiceError, ErrorCode } from '../error/service.error';
+import dayjs = require('dayjs');
+import { DictDataService } from './system/dictData.service';
+import { Equal, Repository } from 'typeorm';
+import { Achievement } from '../entity/platform/achievement.entity';
+import { Company } from '../entity/users/company.entity';
+import { Supply } from '../entity/platform/supply.entity';
+import { Project } from '../entity/platform/project.entity';
+import { Demand } from '../entity/platform/demand.entity';
+const mappings = require('../../public/importMapping');
+/**
+ * 工具类服务,为其他地方提供一些通用的函数
+ */
 @Provide()
 export class UtilService {
   @Inject()
   ctx: Context;
+  @InjectEntityModel(Achievement)
+  achievementModel: Repository<Achievement>;
+  @InjectEntityModel(Project)
+  projectModel: Repository<Project>;
+  @InjectEntityModel(Demand)
+  demandModel: Repository<Demand>;
+  @InjectEntityModel(Supply)
+  supplyModel: Repository<Supply>;
+  @InjectEntityModel(Company)
+  companyModel: Repository<Company>;
+  @Inject()
+  dictDataService: DictDataService;
+
   randomStr(len = 6) {
     return Math.random().toString(36).slice(-len);
   }
 
-  // 修改后信息后用户重新审核
-  async updateUserAfter(id, body, role_type) {
-    // const { status } = body;
-    // if (status === '0') {
-    //   const model = GetModel(upperFirst(role_type));
-    //   const data = await model.findById(id).lean();
-    //   await this.uModel.updateOne({ _id: data.user }, { status: '0' });
-    // }
+  /**
+   * 成果
+   * @param {Object} rows excel数据
+   */
+  async achievement(rows) {
+    const mappingList = mappings.achievement;
+    const result = await this.dealRows(rows, mappingList);
+    const errorList = [];
+    // 需要查看是否有人,有人更新数据,没人添加数据
+    const user_id = this.ctx.user.id;
+    for (const [index, i] of result.entries()) {
+      // 根据 成果名称 查重
+      const { name } = i;
+      const data = await this.achievementModel.findOne({ where: { user: Equal(user_id), name: Equal(name) } });
+      if (data && data.id) {
+        try {
+          i.id = data.id;
+          await this.achievementModel.update({ id: data.id }, i);
+        } catch (error) {
+          errorList.push(`修改第${index + 1}条出现错误!!!`);
+        }
+      } else {
+        try {
+          await this.achievementModel.create({ ...i, user: user_id });
+        } catch (error) {
+          const namek = Object.keys(error.errors)[0];
+          const mapping = mappingList.find(i => i.field === namek);
+          errorList.push(`第${index + 1}条${mapping.zh}列字段出现错误!!!`);
+        }
+      }
+    }
+    return { result: result.length, errorList };
   }
-  @Inject()
-  dataSourceManager: TypeORMDataSourceManager;
-  async DBTransaction() {
-    const dataSource = this.dataSourceManager.getDataSource('default');
-    const data: any = {
-      nick_name: '测试',
-      account: `test-${new Date().getTime()}`, //
-      hobby: ['睡觉'],
-      props: { hobby: '睡觉' },
-      array_props: [{ hobby: '睡觉', lik: 'nothing' }],
+
+  /**
+   * 项目
+   * @param {Object} rows excel数据
+   */
+  async project(rows) {
+    const mappingList = mappings.project;
+    const result = await this.dealRows(rows, mappingList);
+    const errorList = [];
+    // 需要查看是否有人,有人更新数据,没人添加数据
+    const user_id = this.ctx.user.id;
+    for (const [index, i] of result.entries()) {
+      // 根据 项目名称 查重
+      const { name } = i;
+      const data = await this.projectModel.findOne({ where: { user: Equal(user_id), name: Equal(name) } });
+      if (data && data.id) {
+        try {
+          i.id = data.id;
+          await this.projectModel.update({ id: data.id }, i);
+        } catch (error) {
+          errorList.push(`修改第${index + 1}条出现错误!!!`);
+        }
+      } else {
+        try {
+          await this.projectModel.create({ ...i, user: user_id });
+        } catch (error) {
+          const namek = Object.keys(error.errors)[0];
+          const mapping = mappingList.find(i => i.field === namek);
+          errorList.push(`第${index + 1}条${mapping.zh}列字段出现错误!!!`);
+        }
+      }
+    }
+    return { result: result.length, errorList };
+  }
+  /**
+   * 需求
+   * @param {Object} rows excel数据
+   */
+  async demand(rows) {
+    const mappingList = mappings.demand;
+    const result = await this.dealRows(rows, mappingList);
+    const errorList = [];
+    // 需要查看是否有人,有人更新数据,没人添加数据
+    const user_id = this.ctx.user.id;
+    for (const [index, i] of result.entries()) {
+      // 根据 需求名称 查重
+      const { name } = i;
+      const data = await this.demandModel.findOne({ where: { user: Equal(user_id), name: Equal(name) } });
+      if (data && data.id) {
+        try {
+          i.id = data.id;
+          await this.demandModel.update({ id: data.id }, i);
+        } catch (error) {
+          errorList.push(`修改第${index + 1}条出现错误!!!`);
+        }
+      } else {
+        try {
+          await this.demandModel.create({ ...i, user: user_id });
+        } catch (error) {
+          const namek = Object.keys(error.errors)[0];
+          const mapping = mappingList.find(i => i.field === namek);
+          errorList.push(`第${index + 1}条${mapping.zh}列字段出现错误!!!`);
+        }
+      }
+    }
+    return { result: result.length, errorList };
+  }
+  /**
+   * 供给
+   * @param {Object} rows excel数据
+   */
+  async supply(rows) {
+    const mappingList = mappings.supply;
+    const result = await this.dealRows(rows, mappingList);
+    const errorList = [];
+    // 需要查看是否有人,有人更新数据,没人添加数据
+    const user_id = this.ctx.user.id;
+    for (const [index, i] of result.entries()) {
+      // 根据 供给名称 查重
+      const { name } = i;
+      const data = await this.supplyModel.findOne({ where: { user: Equal(user_id), name: Equal(name) } });
+      if (data && data.id) {
+        try {
+          i.id = data.id;
+          await this.supplyModel.update({ id: data.id }, i);
+        } catch (error) {
+          errorList.push(`修改第${index + 1}条出现错误!!!`);
+        }
+      } else {
+        try {
+          await this.supplyModel.create({ ...i, user: user_id });
+        } catch (error) {
+          const namek = Object.keys(error.errors)[0];
+          const mapping = mappingList.find(i => i.field === namek);
+          errorList.push(`第${index + 1}条${mapping.zh}列字段出现错误!!!`);
+        }
+      }
+    }
+    return { result: result.length, errorList };
+  }
+
+  /**
+   * 企业
+   * @param {Object} rows excel数据
+   */
+  async company(rows) {
+    const mappingList = mappings.company;
+    const result = await this.dealRows(rows, mappingList);
+    const errorList = [];
+    // 需要查看是否有人,有人更新数据,没人添加数据
+    const user_id = this.ctx.user.id;
+    for (const [index, i] of result.entries()) {
+      // 根据 企业名称 查重
+      const { name } = i;
+      const data = await this.companyModel.findOne({ where: { user: Equal(user_id), name: Equal(name) } });
+      if (data && data.id) {
+        try {
+          i.id = data.id;
+          await this.companyModel.update({ id: data.id }, i);
+        } catch (error) {
+          errorList.push(`修改第${index + 1}条出现错误!!!`);
+        }
+      } else {
+        try {
+          await this.companyModel.create({ ...i, user: user_id });
+        } catch (error) {
+          const namek = Object.keys(error.errors)[0];
+          const mapping = mappingList.find(i => i.field === namek);
+          errorList.push(`第${index + 1}条${mapping.zh}列字段出现错误!!!`);
+        }
+      }
+    }
+    return { result: result.length, errorList };
+  }
+  /**
+   * 处理excel传来的数据
+   * @param {Array} rows excel数据,二维数组
+   * @param {Object} mappingList 设置的某个映射
+   * @return {Array} result 数据
+   */
+  async dealRows(rows, mappingList) {
+    const result = [];
+    const user = this.ctx.user;
+    if (!user) throw new ServiceError(ErrorCode.USER_NOT_FOUND);
+    for (let i = 0; i < rows.length; i++) {
+      const rowData = rows[i];
+      const obj = { user: user.id };
+      for (let k = 0; k < rowData.length; k++) {
+        let val = rowData[k];
+        if (val === null) continue;
+        if (typeof val === 'object' && val !== null) {
+          const richText = get(val, 'richText');
+          if (richText) {
+            let texts = '';
+            // 使用map提取name字段,然后检查是否为undefined
+            // eslint-disable-next-line array-callback-return
+            const mappedNames = richText.map(item => {
+              // 判断字段是否存在
+              if ('text' in item) {
+                return item.text;
+              }
+            });
+            // 过滤掉null或undefined的值
+            const filteredNames = mappedNames.filter(text => text !== null && text !== undefined);
+            // 拼接字符串
+            texts = filteredNames.join('');
+            val = texts;
+          }
+        }
+        const mapping = mappingList.find(f => f.index === k);
+        if (mapping) {
+          const { field, type } = mapping;
+          if (type) val = await this.dealTypeValue(mapping, val);
+          obj[field] = val;
+        }
+      }
+      result.push(obj);
+    }
+    return result;
+  }
+
+  /**
+   * 转换数据
+   * @param {Object} mapping 当前要处理的映射
+   * @param {any} val excel值
+   * @return {any} result 转换后的数据
+   */
+  async dealTypeValue(mapping, val) {
+    const { type, code } = mapping;
+    let result;
+    if (type === 'date') {
+      // 判断日期对不对,经过moment处理下
+      const mobj = dayjs(val);
+      if (mobj.isValid()) {
+        result = mobj.format('YYYY-MM-DD');
+      }
+    } else if (type === 'dict') {
+      const req = await this.dictDataService.query({}, { code });
+      if (req.data) {
+        const selected = req.data.find(f => f.label === val);
+        if (selected) result = get(selected, 'value');
+      }
+    } else if (type === 'area') {
+      if (val) result = val.split('-');
+    }
+    return result;
+  }
+
+  nameToFunction(name) {
+    const obj = {
+      成果: 'achievement',
+      项目: 'project',
+      需求: 'demand',
+      供给: 'supply',
+      企业: 'company',
     };
-    await dataSource.transaction(async em => {
-      // 事务中的操作会依次做好,并且下一步会在上一步的基础上进行.只有整个函数执行完,才会落实到数据库中
-      // const res = await em.update(Test, { id: 1 }, { account: 'test' });
-      // const ri = await em.insert(Test, data);
-      // const r2 = await em.count(Test, { where: { account: 'test-2' } });
-      // if (r2 > 0) throw new ServiceError('data exists');
-      // const r = await em.getRepository(Test).query('select json_query(\'{"a": [1, 2, 3, 4, 5], "b": ["2", "a b"], "c": {"d": 4, "e": "ab c"}}\'::jsonb,\'$.b\');');
-      const tb = em
-        .getRepository(Test)
-        .createQueryBuilder()
-        // .where('props @> :hobby', { hobby: { hobby: '睡觉' } });
-        .where('hobby @> :hobby', { hobby: '睡觉' });
-      const tres = await tb.getOne();
-      console.log(tres);
-      // const builder = em.getRepository(Test).createQueryBuilder('test').select(['test.id', 'test.array_props']).where({ id: 1 });
-      // console.log(builder.getSql());
-      // const res = await builder.getOne();
-      // console.log(res);
-    });
+    return get(obj, name);
   }
 }