zs 1 year ago
parent
commit
f9997eb914

+ 1 - 1
src/controller/system/user.controller.ts

@@ -4,7 +4,7 @@ import { UserService } from '../../service/system/user.service';
 import { CDTO_user, CVO_user, FVO_user, QDTO_user, QVO_user, UDTO_user, UVAO_user } from '../../interface/system/user.interface';
 import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
 import { Validate } from '@midwayjs/validate';
-@ApiTags(['用户'])
+@ApiTags(['平台用户'])
 @Controller('/user')
 export class UserController extends BaseController {
   @Inject()

+ 68 - 0
src/controller/users/company.controller.ts

@@ -0,0 +1,68 @@
+import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { CompanyService } from '../../service/users/company.service';
+import { CDTO_company, CVO_company, FVO_company, QDTO_company, QVO_company, UDTO_company, UVAO_company } from '../../interface/users/company.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['企业'])
+@Controller('/company')
+export class CompanyController extends BaseController {
+  @Inject()
+  service: CompanyService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_company })
+  async create(@Body() data: CDTO_company) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_company(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_company })
+  async query(@Query() filter: QDTO_company, @Query('skip') skip: number, @Query('limit') limit: number) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_company(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_company })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_company(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_company })
+  async update(@Param('id') id: string, @Body() body: UDTO_company) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 68 - 0
src/controller/users/expert.controller.ts

@@ -0,0 +1,68 @@
+import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { ExpertService } from '../../service/users/expert.service';
+import { CDTO_expert, CVO_expert, FVO_expert, QDTO_expert, QVO_expert, UDTO_expert, UVAO_expert } from '../../interface/users/expert.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['专家'])
+@Controller('/expert')
+export class ExpertController extends BaseController {
+  @Inject()
+  service: ExpertService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_expert })
+  async create(@Body() data: CDTO_expert) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_expert(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_expert })
+  async query(@Query() filter: QDTO_expert, @Query('skip') skip: number, @Query('limit') limit: number) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_expert(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_expert })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_expert(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_expert })
+  async update(@Param('id') id: string, @Body() body: UDTO_expert) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 68 - 0
src/controller/users/unit.controller.ts

@@ -0,0 +1,68 @@
+import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { UnitService } from '../../service/users/unit.service';
+import { CDTO_unit, CVO_unit, FVO_unit, QDTO_unit, QVO_unit, UDTO_unit, UVAO_unit } from '../../interface/users/unit.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['科研机构'])
+@Controller('/unit')
+export class UnitController extends BaseController {
+  @Inject()
+  service: UnitService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_unit })
+  async create(@Body() data: CDTO_unit) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_unit(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_unit })
+  async query(@Query() filter: QDTO_unit, @Query('skip') skip: number, @Query('limit') limit: number) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_unit(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_unit })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_unit(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_unit })
+  async update(@Param('id') id: string, @Body() body: UDTO_unit) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 1 - 3
src/entity/platform/achievement.entity.ts

@@ -4,14 +4,12 @@ import { BaseModel } from 'free-midway-component';
   schemaOptions: { collection: 'achievement' },
 })
 export class Achievement extends BaseModel {
-  @prop({ required: false, index: true, zh: '用户id' })
+  @prop({ required: false, index: true, zh: '平台用户id' })
   user: string;
   @prop({ required: false, index: true, zh: '专利号' })
   patent: string;
   @prop({ required: false, index: true, zh: '名称' })
   name: string;
-  @prop({ required: false, index: true, zh: '类型' })
-  type: string;
   @prop({ required: false, index: true, zh: '属性' })
   attribute: string;
   @prop({ required: false, index: true, zh: '出让方式' })

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

@@ -4,7 +4,7 @@ import { BaseModel } from 'free-midway-component';
   schemaOptions: { collection: 'demand' },
 })
 export class Demand extends BaseModel {
-  @prop({ required: false, index: true, zh: '用户id' })
+  @prop({ required: false, index: true, zh: '平台用户id' })
   user: string;
   @prop({ required: false, index: true, zh: '名称' })
   name: string;

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

@@ -4,7 +4,7 @@ import { BaseModel } from 'free-midway-component';
   schemaOptions: { collection: 'match' },
 })
 export class Match extends BaseModel {
-  @prop({ required: false, index: true, zh: '用户id' })
+  @prop({ required: false, index: true, zh: '平台用户id' })
   user: string;
   @prop({ required: false, index: true, zh: '名称' })
   name: string;

+ 1 - 1
src/entity/system/dictType.entity.ts

@@ -10,6 +10,6 @@ export class DictType extends BaseModel {
   code: string;
   @prop({ required: false, index: false, zh: '备注' })
   remark: string;
-  @prop({ required: false, index: true, zh: '是否使用' })
+  @prop({ required: false, index: true, zh: '是否使用', default: '0' })
   is_use: string;
 }

+ 25 - 6
src/entity/system/user.entity.ts

@@ -1,15 +1,34 @@
 import { modelOptions, prop } from '@typegoose/typegoose';
 import { BaseModel } from 'free-midway-component';
+import { isString } from 'lodash';
 @modelOptions({
   schemaOptions: { collection: 'user' },
 })
 export class User extends BaseModel {
-  @prop({ required: false, index: false, zh: '微信小程序id' })
-  openid: string;
+  @prop({ required: false, index: true, zh: '账号' })
+  account: string;
+  // 手动删除set前的大括号,处理太麻烦了.就手动删除吧
+  @prop({
+    required: false,
+    index: false,
+    zh: '密码',
+    select: false,
+    set: val => {
+      if (isString(val)) {
+        return { secret: val };
+      }
+      return val;
+    },
+  })
+  password: object;
   @prop({ required: false, index: false, zh: '昵称' })
   nick_name: string;
-  @prop({ required: false, index: false, zh: '电话' })
-  tel: string;
-  @prop({ required: false, index: false, zh: '部门' })
-  dept: string;
+  @prop({ required: false, index: false, zh: '性别' })
+  gender: string;
+  @prop({ required: false, index: true, zh: '手机号' })
+  phone: string;
+  @prop({ required: false, index: false, zh: '角色' })
+  role: Array<any>;
+  @prop({ required: false, index: true, zh: '状态', default: '0' })
+  status: string;
 }

+ 41 - 0
src/entity/users/company.entity.ts

@@ -0,0 +1,41 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'company' },
+})
+export class Company extends BaseModel {
+  @prop({ required: false, index: true, zh: '平台用户id' })
+  user: string;
+  @prop({ required: false, index: true, zh: '企业名称' })
+  name: string;
+  @prop({ required: false, index: false, zh: 'logo' })
+  logo: Array<any>;
+  @prop({ required: false, index: true, zh: '企业标签' })
+  tags: Array<any>;
+  @prop({ required: false, index: false, zh: '统一信用代码' })
+  code: string;
+  @prop({ required: false, index: true, zh: '联系电话' })
+  phone: string;
+  @prop({ required: false, index: true, zh: '所属行业' })
+  type: string;
+  @prop({ required: false, index: false, zh: '法定代表人' })
+  representative: string;
+  @prop({ required: false, index: false, zh: '电子邮箱' })
+  email: string;
+  @prop({ required: false, index: true, zh: '员工人数' })
+  person: number;
+  @prop({ required: false, index: false, zh: '注册资本' })
+  register: string;
+  @prop({ required: false, index: false, zh: '成立日期' })
+  create_time: string;
+  @prop({ required: false, index: true, zh: '更新时间' })
+  update_time: string;
+  @prop({ required: false, index: false, zh: '地址' })
+  address: string;
+  @prop({ required: false, index: false, zh: '简介' })
+  brief: string;
+  @prop({ required: false, index: true, zh: '是否公开' })
+  is_show: string;
+  @prop({ required: false, index: true, zh: '状态', default: '0' })
+  status: string;
+}

+ 31 - 0
src/entity/users/expert.entity.ts

@@ -0,0 +1,31 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'expert' },
+})
+export class Expert extends BaseModel {
+  @prop({ required: false, index: true, zh: '平台用户id' })
+  user: string;
+  @prop({ required: false, index: true, zh: '专家姓名' })
+  name: string;
+  @prop({ required: false, index: true, zh: '性别' })
+  gender: string;
+  @prop({ required: false, index: false, zh: '出生年月' })
+  birth: string;
+  @prop({ required: false, index: true, zh: '联系电话' })
+  phone: string;
+  @prop({ required: false, index: true, zh: '所属领域' })
+  field: string;
+  @prop({ required: false, index: true, zh: '单位类型' })
+  type: string;
+  @prop({ required: false, index: true, zh: '学历' })
+  education: string;
+  @prop({ required: false, index: false, zh: '简介' })
+  brief: string;
+  @prop({ required: false, index: true, zh: '所在地区' })
+  region: string;
+  @prop({ required: false, index: true, zh: '是否公开' })
+  is_show: string;
+  @prop({ required: false, index: true, zh: '状态', default: '0' })
+  status: string;
+}

+ 23 - 0
src/entity/users/unit.entity.ts

@@ -0,0 +1,23 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'unit' },
+})
+export class Unit extends BaseModel {
+  @prop({ required: false, index: true, zh: '平台用户id' })
+  user: string;
+  @prop({ required: false, index: false, zh: '科研机构名称' })
+  name: string;
+  @prop({ required: false, index: true, zh: '联系人' })
+  contacts: string;
+  @prop({ required: false, index: true, zh: '联系电话' })
+  contacts_phone: string;
+  @prop({ required: false, index: false, zh: '图片' })
+  file: Array<any>;
+  @prop({ required: false, index: false, zh: '简介' })
+  brief: string;
+  @prop({ required: false, index: true, zh: '状态' })
+  status: string;
+  @prop({ required: false, index: true, zh: '是否公开' })
+  is_show: string;
+}

+ 1 - 0
src/interface/login.interface.ts

@@ -3,6 +3,7 @@ import { Rule, RuleType } from '@midwayjs/validate';
 import { get } from 'lodash';
 export enum LoginType {
   Admin = 'Admin',
+  User = 'User',
 }
 
 export class LoginDTO {

+ 1 - 8
src/interface/platform/achievement.interface.ts

@@ -20,8 +20,6 @@ export class FVO_achievement {
   'patent': string = undefined;
   @ApiProperty({ description: '名称' })
   'name': string = undefined;
-  @ApiProperty({ description: '类型' })
-  'type': string = undefined;
   @ApiProperty({ description: '属性' })
   'attribute': string = undefined;
   @ApiProperty({ description: '出让方式' })
@@ -53,7 +51,7 @@ export class FVO_achievement {
 export class QDTO_achievement extends SearchBase {
   constructor() {
     const like_prop = [];
-    const props = ['user', 'patent', 'name', 'type', 'attribute', 'sell', 'mature', 'field', 'technology', 'money', 'status', 'achievement_status', 'is_use'];
+    const props = ['user', 'patent', 'name', 'attribute', 'sell', 'mature', 'field', 'technology', 'money', 'status', 'achievement_status', 'is_use'];
     const mapping = [];
     super({ like_prop, props, mapping });
   }
@@ -63,8 +61,6 @@ export class QDTO_achievement extends SearchBase {
   'patent': string = undefined;
   @ApiProperty({ description: '名称' })
   'name': string = undefined;
-  @ApiProperty({ description: '类型' })
-  'type': string = undefined;
   @ApiProperty({ description: '属性' })
   'attribute': string = undefined;
   @ApiProperty({ description: '出让方式' })
@@ -102,9 +98,6 @@ export class CDTO_achievement {
   @ApiProperty({ description: '名称' })
   @Rule(RuleType['string']().empty(''))
   'name': string = undefined;
-  @ApiProperty({ description: '类型' })
-  @Rule(RuleType['string']().empty(''))
-  'type': string = undefined;
   @ApiProperty({ description: '属性' })
   @Rule(RuleType['string']().empty(''))
   'attribute': string = undefined;

+ 36 - 13
src/interface/system/user.interface.ts

@@ -14,23 +14,37 @@ export class FVO_user {
   }
   @ApiProperty({ description: '数据id' })
   _id: string = undefined;
-  @ApiProperty({ description: '微信小程序id' })
-  'openid': string = undefined;
+  @ApiProperty({ description: '账号' })
+  'account': string = undefined;
+  @ApiProperty({ description: '密码' })
+  'password': string = undefined;
   @ApiProperty({ description: '昵称' })
   'nick_name': string = undefined;
-  @ApiProperty({ description: '电话' })
-  'tel': string = undefined;
-  @ApiProperty({ description: '部门' })
-  'dept': string = undefined;
+  @ApiProperty({ description: '性别' })
+  'gender': string = undefined;
+  @ApiProperty({ description: '手机号' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '角色' })
+  'role': Array<any> = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
 }
 
 export class QDTO_user extends SearchBase {
   constructor() {
     const like_prop = [];
-    const props = [];
+    const props = ['account', 'nick_name', 'phone', 'status'];
     const mapping = [];
     super({ like_prop, props, mapping });
   }
+  @ApiProperty({ description: '账号' })
+  'account': string = undefined;
+  @ApiProperty({ description: '昵称' })
+  'nick_name': string = undefined;
+  @ApiProperty({ description: '手机号' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
 }
 
 export class QVO_user extends FVO_user {
@@ -41,18 +55,27 @@ export class QVO_user extends FVO_user {
 }
 
 export class CDTO_user {
-  @ApiProperty({ description: '微信小程序id' })
+  @ApiProperty({ description: '账号' })
   @Rule(RuleType['string']().empty(''))
-  'openid': string = undefined;
+  'account': string = undefined;
+  @ApiProperty({ description: '密码' })
+  @Rule(RuleType['string']().empty(''))
+  'password': string = undefined;
   @ApiProperty({ description: '昵称' })
   @Rule(RuleType['string']().empty(''))
   'nick_name': string = undefined;
-  @ApiProperty({ description: '电话' })
+  @ApiProperty({ description: '性别' })
+  @Rule(RuleType['string']().empty(''))
+  'gender': string = undefined;
+  @ApiProperty({ description: '手机号' })
   @Rule(RuleType['string']().empty(''))
-  'tel': string = undefined;
-  @ApiProperty({ description: '部门' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '角色' })
+  @Rule(RuleType['array']().empty(''))
+  'role': Array<any> = undefined;
+  @ApiProperty({ description: '状态' })
   @Rule(RuleType['string']().empty(''))
-  'dept': string = undefined;
+  'status': string = undefined;
 }
 
 export class CVO_user extends FVO_user {

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

@@ -0,0 +1,159 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_company {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '企业名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: 'logo' })
+  'logo': Array<any> = undefined;
+  @ApiProperty({ description: '企业标签' })
+  'tags': Array<any> = undefined;
+  @ApiProperty({ description: '统一信用代码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '所属行业' })
+  'type': string = undefined;
+  @ApiProperty({ description: '法定代表人' })
+  'representative': string = undefined;
+  @ApiProperty({ description: '电子邮箱' })
+  'email': string = undefined;
+  @ApiProperty({ description: '员工人数' })
+  'person': number = undefined;
+  @ApiProperty({ description: '注册资本' })
+  'register': string = undefined;
+  @ApiProperty({ description: '成立日期' })
+  'create_time': string = undefined;
+  @ApiProperty({ description: '更新时间' })
+  'update_time': string = undefined;
+  @ApiProperty({ description: '地址' })
+  'address': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  'is_show': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_company extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['user', 'name', 'tags', 'phone', 'type', 'person', 'update_time', 'is_show', 'status'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '企业名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '企业标签' })
+  'tags': Array<any> = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '所属行业' })
+  'type': string = undefined;
+  @ApiProperty({ description: '员工人数' })
+  'person': number = undefined;
+  @ApiProperty({ description: '更新时间' })
+  'update_time': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  'is_show': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_company extends FVO_company {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_company {
+  @ApiProperty({ description: '平台用户id' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = 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['array']().empty(''))
+  'tags': Array<any> = undefined;
+  @ApiProperty({ description: '统一信用代码' })
+  @Rule(RuleType['string']().empty(''))
+  'code': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  @Rule(RuleType['string']().empty(''))
+  'phone': string = undefined;
+  @ApiProperty({ description: '所属行业' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+  @ApiProperty({ description: '法定代表人' })
+  @Rule(RuleType['string']().empty(''))
+  'representative': string = undefined;
+  @ApiProperty({ description: '电子邮箱' })
+  @Rule(RuleType['string']().empty(''))
+  'email': string = undefined;
+  @ApiProperty({ description: '员工人数' })
+  @Rule(RuleType['number']().empty(''))
+  'person': number = undefined;
+  @ApiProperty({ description: '注册资本' })
+  @Rule(RuleType['string']().empty(''))
+  'register': string = undefined;
+  @ApiProperty({ description: '成立日期' })
+  @Rule(RuleType['string']().empty(''))
+  'create_time': string = undefined;
+  @ApiProperty({ description: '更新时间' })
+  @Rule(RuleType['string']().empty(''))
+  'update_time': string = undefined;
+  @ApiProperty({ description: '地址' })
+  @Rule(RuleType['string']().empty(''))
+  'address': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  @Rule(RuleType['string']().empty(''))
+  'is_show': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_company extends FVO_company {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_company extends CDTO_company {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_company extends FVO_company {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 136 - 0
src/interface/users/expert.interface.ts

@@ -0,0 +1,136 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_expert {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '专家姓名' })
+  'name': string = undefined;
+  @ApiProperty({ description: '性别' })
+  'gender': string = undefined;
+  @ApiProperty({ description: '出生年月' })
+  'birth': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '所属领域' })
+  'field': string = undefined;
+  @ApiProperty({ description: '单位类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '学历' })
+  'education': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  'region': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  'is_show': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_expert extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['user', 'name', 'gender', 'phone', 'field', 'type', 'education', 'region', 'is_show', 'status'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '专家姓名' })
+  'name': string = undefined;
+  @ApiProperty({ description: '性别' })
+  'gender': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '所属领域' })
+  'field': string = undefined;
+  @ApiProperty({ description: '单位类型' })
+  'type': string = undefined;
+  @ApiProperty({ description: '学历' })
+  'education': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  'region': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  'is_show': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_expert extends FVO_expert {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_expert {
+  @ApiProperty({ description: '平台用户id' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = undefined;
+  @ApiProperty({ description: '专家姓名' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '性别' })
+  @Rule(RuleType['string']().empty(''))
+  'gender': string = undefined;
+  @ApiProperty({ description: '出生年月' })
+  @Rule(RuleType['string']().empty(''))
+  'birth': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  @Rule(RuleType['string']().empty(''))
+  'phone': string = undefined;
+  @ApiProperty({ description: '所属领域' })
+  @Rule(RuleType['string']().empty(''))
+  'field': string = undefined;
+  @ApiProperty({ description: '单位类型' })
+  @Rule(RuleType['string']().empty(''))
+  'type': string = undefined;
+  @ApiProperty({ description: '学历' })
+  @Rule(RuleType['string']().empty(''))
+  'education': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  @Rule(RuleType['string']().empty(''))
+  'region': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  @Rule(RuleType['string']().empty(''))
+  'is_show': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_expert extends FVO_expert {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_expert extends CDTO_expert {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_expert extends FVO_expert {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 106 - 0
src/interface/users/unit.interface.ts

@@ -0,0 +1,106 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_unit {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '科研机构名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'contacts_phone': string = undefined;
+  @ApiProperty({ description: '图片' })
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  'is_show': string = undefined;
+}
+
+export class QDTO_unit extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = ['user', 'contacts', 'contacts_phone', 'status', 'is_show'];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '平台用户id' })
+  'user': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'contacts_phone': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  'is_show': string = undefined;
+}
+
+export class QVO_unit extends FVO_unit {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_unit {
+  @ApiProperty({ description: '平台用户id' })
+  @Rule(RuleType['string']().empty(''))
+  'user': string = undefined;
+  @ApiProperty({ description: '科研机构名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  @Rule(RuleType['string']().empty(''))
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  @Rule(RuleType['string']().empty(''))
+  'contacts_phone': string = undefined;
+  @ApiProperty({ description: '图片' })
+  @Rule(RuleType['array']().empty(''))
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+  @ApiProperty({ description: '是否公开' })
+  @Rule(RuleType['string']().empty(''))
+  'is_show': string = undefined;
+}
+
+export class CVO_unit extends FVO_unit {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_unit extends CDTO_unit {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_unit extends FVO_unit {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 0 - 1
src/service/login.service.ts

@@ -10,7 +10,6 @@ import { Context } from '@midwayjs/koa';
 export class LoginService {
   @Inject()
   roleService: RoleService;
-
   @Inject()
   ctx: Context;
   @Config('loginSign')

+ 11 - 0
src/service/users/company.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Company } from '../../entity/users/company.entity';
+type modelType = ReturnModelType<typeof Company>;
+@Provide()
+export class CompanyService extends BaseService<modelType> {
+  @InjectEntityModel(Company)
+  model: modelType;
+}

+ 11 - 0
src/service/users/expert.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Expert } from '../../entity/users/expert.entity';
+type modelType = ReturnModelType<typeof Expert>;
+@Provide()
+export class ExpertService extends BaseService<modelType> {
+  @InjectEntityModel(Expert)
+  model: modelType;
+}

+ 11 - 0
src/service/users/unit.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { Unit } from '../../entity/users/unit.entity';
+type modelType = ReturnModelType<typeof Unit>;
+@Provide()
+export class UnitService extends BaseService<modelType> {
+  @InjectEntityModel(Unit)
+  model: modelType;
+}