فهرست منبع

新增所属产业

zs 9 ماه پیش
والد
کامیت
5a320b7dad

+ 71 - 0
src/controller/platform/sector.controller.ts

@@ -0,0 +1,71 @@
+import { SectorService } from '../../service/platform/sector.service';
+import { CVO_sector, FVO_sector, QVO_sector, UVAO_sector } from '../../interface/platform/sector.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+import { BaseController } from '../../frame/BaseController';
+import { ErrorCode, ServiceError } from '../../error/service.error';
+import { omit, pick } from 'lodash';
+import { Controller, Inject, Get, Param, Post, Body, Del, Query } from '@midwayjs/core';
+import { Context } from '@midwayjs/koa';
+const namePrefix = '行业';
+@ApiTags(['行业'])
+@Controller('/sector', { tagName: namePrefix })
+export class SectorController implements BaseController {
+  @Inject()
+  service: SectorService;
+
+  @Inject()
+  ctx: Context;
+
+  @Get('/')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_sector })
+  async index(@Query() query: object) {
+    const qobj = omit(query, ['skip', 'limit']);
+    const others: any = pick(query, ['skip', 'limit']);
+    const qbr = this.service.queryBuilder(qobj);
+    others.order = { sort: 'ASC' };
+    const result = await this.service.query(qbr, others);
+    return result;
+  }
+
+  @Get('/:id')
+  @ApiTags('单查询')
+  @ApiResponse({ type: FVO_sector })
+  async fetch(@Param('id') id: number) {
+    const qbr = this.service.queryBuilder({ id });
+    const data = await this.service.fetch(qbr);
+    const result = new FVO_sector(data);
+    return result;
+  }
+
+  @Post('/', { routerName: `创建${namePrefix}` })
+  @ApiTags('创建数据')
+  @Validate()
+  @ApiResponse({ type: CVO_sector })
+  async create(@Body() data: object) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_sector(dbData);
+    return result;
+  }
+
+  @Post('/:id', { routerName: `修改${namePrefix}` })
+  @ApiTags('修改数据')
+  @Validate()
+  @ApiResponse({ type: UVAO_sector })
+  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 - 0
src/entity/platform/achievement.entity.ts

@@ -7,6 +7,8 @@ import * as dayjs from 'dayjs';
 export class Achievement 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: '标签' })
   tags: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '专利号' })

+ 1 - 1
src/entity/platform/match.entity.ts

@@ -13,7 +13,7 @@ export class Match extends BaseModel {
   type: string;
   @Column({ type: 'character varying', nullable: true, comment: '组织单位' })
   work: string;
-  @Column({ type: 'character varying', nullable: true, comment: '业' })
+  @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
   industry: string;
   @Column({ type: 'character varying', nullable: true, comment: '类别' })
   form: string;

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

@@ -0,0 +1,18 @@
+import { Column, Entity } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+// 行业
+@Entity('sector')
+export class Sector extends BaseModel {
+  @Column({ type: 'character varying', nullable: true, comment: '标题' })
+  title: string;
+  @Column({ type: 'character varying', nullable: true, comment: '路由' })
+  href: string;
+  @Column({ type: 'character varying', nullable: true, comment: '英文标题' })
+  English: string;
+  @Column({ type: 'integer', nullable: true, comment: '排序' })
+  sort: number;
+  @Column({ type: 'character varying', nullable: true, comment: '备注' })
+  remark: string;
+  @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
+  is_use: string;
+}

+ 1 - 1
src/entity/platform/tags.entity.ts

@@ -13,7 +13,7 @@ export class Tags extends BaseModel {
   English: string;
   @Column({ type: 'jsonb', nullable: true, comment: '子目录' })
   children: Array<any>;
-  @Column({ type: 'character varying', nullable: true, comment: '排序' })
+  @Column({ type: 'integer', nullable: true, comment: '排序' })
   sort: number;
   @Column({ type: 'character varying', nullable: true, comment: '备注' })
   remark: string;

+ 2 - 2
src/entity/system/user.entity.ts

@@ -6,10 +6,10 @@ import * as bcrypt from 'bcryptjs';
 export class User extends BaseModel {
   @Column({ type: 'character varying', nullable: true, comment: '昵称' })
   nick_name: string;
-
   @Column({ type: 'character varying', comment: '账号', unique: true })
   account: string;
-
+  @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
+  industry: string;
   @Column({
     type: 'character varying',
     select: false,

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

@@ -6,6 +6,8 @@ import * as dayjs from 'dayjs';
 export class Company 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: '标签' })
   tags: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '企业名称' })
@@ -30,10 +32,8 @@ export class Company extends BaseModel {
   email: string;
   @Column({ type: 'integer', nullable: true, comment: '员工人数' })
   person: number;
-
   @Column({ type: 'character varying', nullable: true, comment: '简介' })
   register: string;
-
   @Column({ type: 'timestamp without time zone', nullable: true, comment: '成立日期', transformer: { from: value => dayjs(value).format('YYYY-MM-DD HH:mm:ss'), to: value => value } })
   create_time: Date;
   @Column({ type: 'character varying', nullable: true, comment: '地址' })
@@ -47,6 +47,6 @@ export class Company extends BaseModel {
   @Column({ type: 'character varying', default: '0', comment: '状态' })
   status: string;
 
-  @Column({ type: 'character varying', nullable: true, comment: '是否公开' })
+  @Column({ type: 'character varying', nullable: true, comment: '产品' })
   products: string;
 }

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

@@ -43,7 +43,7 @@ export class Expert extends BaseModel {
   status: string;
   @Column({ type: 'character varying', nullable: true, comment: '产业类型' })
   industry_type: string;
-  @Column({ type: 'character varying', nullable: true, comment: '产业' })
+  @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
   industry: string;
   @Column({ type: 'character varying', nullable: true, comment: '工作单位类型' })
   work_type: string;

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

@@ -11,6 +11,8 @@ export class FVO_achievement {
   'tags': Array<any> = undefined;
   @ApiProperty({ description: '用户id' })
   'user': number = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '专利号' })
   'patent': string = undefined;
   @ApiProperty({ description: '名称' })
@@ -52,6 +54,8 @@ export class FVO_achievement {
 export class QDTO_achievement {
   @ApiProperty({ description: '用户id' })
   'user': number = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '标签' })
   'tags': Array<any> = undefined;
   @ApiProperty({ description: '专利号' })
@@ -95,6 +99,9 @@ export class CDTO_achievement {
   @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;

+ 3 - 3
src/interface/platform/match.interface.ts

@@ -18,7 +18,7 @@ export class FVO_match {
   'type': string = undefined;
   @ApiProperty({ description: '组织单位' })
   'work': string = undefined;
-  @ApiProperty({ description: '业' })
+  @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '类别' })
   'form': string = undefined;
@@ -49,7 +49,7 @@ export class QDTO_match extends SearchBase {
   'name': string = undefined;
   @ApiProperty({ description: '类型' })
   'type': string = undefined;
-  @ApiProperty({ description: '业' })
+  @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '类别' })
   'form': string = undefined;
@@ -84,7 +84,7 @@ export class CDTO_match {
   @ApiProperty({ description: '组织单位' })
   @Rule(RuleType['string']().empty(''))
   'work': string = undefined;
-  @ApiProperty({ description: '业' })
+  @ApiProperty({ description: '所属产业' })
   @Rule(RuleType['string']().empty(''))
   'industry': string = undefined;
   @ApiProperty({ description: '类别' })

+ 3 - 3
src/interface/platform/project.interface.ts

@@ -36,7 +36,7 @@ export class FVO_project {
   'track_unit': string = undefined;
   @ApiProperty({ description: '项目来源' })
   'source': string = undefined;
-  @ApiProperty({ description: '产业分类' })
+  @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '简介' })
   'brief': string = undefined;
@@ -73,7 +73,7 @@ export class QDTO_project extends SearchBase {
   'track_unit': string = undefined;
   @ApiProperty({ description: '项目来源' })
   'source': string = undefined;
-  @ApiProperty({ description: '产业分类' })
+  @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '状态' })
   'status': string = undefined;
@@ -134,7 +134,7 @@ export class CDTO_project {
   @ApiProperty({ description: '项目来源' })
   @Rule(RuleType['string']().empty(''))
   'source': string = undefined;
-  @ApiProperty({ description: '产业分类' })
+  @ApiProperty({ description: '所属产业' })
   @Rule(RuleType['string']().empty(''))
   'industry': string = undefined;
   @ApiProperty({ description: '是否公开' })

+ 78 - 0
src/interface/platform/sector.interface.ts

@@ -0,0 +1,78 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from '../../frame/SearchBase';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_sector {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '标题' })
+  'title': string = undefined;
+  @ApiProperty({ description: '路由' })
+  'href': string = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
+  @ApiProperty({ description: '英文标题' })
+  'English': string = undefined;
+  @ApiProperty({ description: '备注' })
+  'remark': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QDTO_sector extends SearchBase {
+  @ApiProperty({ description: '标题' })
+  'title': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QVO_sector extends FVO_sector {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_sector {
+  @ApiProperty({ description: '标题' })
+  @Rule(RuleType['string']().empty(''))
+  'title': string = undefined;
+  @ApiProperty({ description: '路由' })
+  @Rule(RuleType['string']().empty(''))
+  'href': string = undefined;
+  @ApiProperty({ description: '英文标题' })
+  @Rule(RuleType['string']().empty(''))
+  'English': string = undefined;
+  @ApiProperty({ description: '排序' })
+  @Rule(RuleType['number']().empty(''))
+  'sort': number = undefined;
+  @ApiProperty({ description: '备注' })
+  @Rule(RuleType['string']().empty(''))
+  'remark': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+}
+
+export class CVO_sector extends FVO_sector {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_sector extends CDTO_sector {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_sector extends FVO_sector {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 6 - 0
src/interface/system/user.interface.ts

@@ -11,6 +11,8 @@ export class FVO_user {
   'account': string = undefined;
   @ApiProperty({ description: '密码' })
   'password': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '昵称' })
   'nick_name': string = undefined;
   @ApiProperty({ description: '性别' })
@@ -32,6 +34,8 @@ export class QDTO_user {
   'account': string = undefined;
   @ApiProperty({ description: '昵称' })
   'nick_name': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '手机号' })
   'phone': string = undefined;
   @ApiProperty({ description: '电子邮箱' })
@@ -54,6 +58,8 @@ export class CDTO_user {
   @ApiProperty({ description: '密码' })
   @Rule(RuleType['string']().empty(''))
   'password': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '昵称' })
   @Rule(RuleType['string']().empty(''))
   'nick_name': string = undefined;

+ 14 - 0
src/interface/users/company.interface.ts

@@ -9,6 +9,8 @@ export class FVO_company {
   id: number = undefined;
   @ApiProperty({ description: '平台用户id' })
   'user': number = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '标签' })
   'tags': Array<any> = undefined;
   @ApiProperty({ description: '企业名称' })
@@ -47,6 +49,8 @@ export class FVO_company {
   'companyStatus': string = undefined;
   @ApiProperty({ description: '状态' })
   'status': string = undefined;
+  @ApiProperty({ description: '产品' })
+  'products': string = undefined;
 }
 
 export class QDTO_company {
@@ -54,6 +58,8 @@ export class QDTO_company {
   'user': number = undefined;
   @ApiProperty({ description: '企业名称' })
   'name': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
   @ApiProperty({ description: '标签' })
   'tags': Array<any> = undefined;
   @ApiProperty({ description: '联系电话' })
@@ -70,6 +76,8 @@ export class QDTO_company {
   'companyStatus': string = undefined;
   @ApiProperty({ description: '状态' })
   'status': string = undefined;
+  @ApiProperty({ description: '产品' })
+  'products': string = undefined;
 }
 
 export class QVO_company extends FVO_company {
@@ -83,6 +91,9 @@ export class CDTO_company {
   @ApiProperty({ description: '平台用户id' })
   @Rule(RuleType['number']().empty(''))
   'number': string = undefined;
+  @ApiProperty({ description: '所属产业' })
+  @Rule(RuleType['string']().empty(''))
+  'industry': string = undefined;
   @ApiProperty({ description: '标签' })
   @Rule(RuleType['array']().empty(''))
   'tags': Array<any> = undefined;
@@ -140,6 +151,9 @@ export class CDTO_company {
   @ApiProperty({ description: '状态' })
   @Rule(RuleType['string']().empty(''))
   'status': string = undefined;
+  @ApiProperty({ description: '产品' })
+  @Rule(RuleType['string']().empty(''))
+  'products': string = undefined;
 }
 
 export class CVO_company extends FVO_company {

+ 5 - 5
src/interface/users/expert.interface.ts

@@ -35,7 +35,7 @@ export class FVO_expert {
   'work': string = undefined;
   @ApiProperty({ description: '工作类型' })
   'work_type': string = undefined;
-  @ApiProperty({ description: '产业' })
+  @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '产业类型' })
   'industry_type': string = undefined;
@@ -74,7 +74,7 @@ export class QDTO_expert {
   'area': Array<any> = undefined;
   @ApiProperty({ description: '工作类型' })
   'work_type': string = undefined;
-  @ApiProperty({ description: '产业' })
+  @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '产业类型' })
   'industry_type': string = undefined;
@@ -131,13 +131,13 @@ export class CDTO_expert {
   @ApiProperty({ description: '工作单位' })
   @Rule(RuleType['string']().empty(''))
   'work': string = undefined;
-  @ApiProperty({ description: '工作类型' })
+  @ApiProperty({ description: '产业类型' })
   @Rule(RuleType['string']().empty(''))
   'industry_type': string = undefined;
-  @ApiProperty({ description: '产业' })
+  @ApiProperty({ description: '所属产业' })
   @Rule(RuleType['string']().empty(''))
   'industry': string = undefined;
-  @ApiProperty({ description: '产业类型' })
+  @ApiProperty({ description: '工作类型' })
   @Rule(RuleType['string']().empty(''))
   'work_type': string = undefined;
   @ApiProperty({ description: '职称' })

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

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