Pārlūkot izejas kodu

修改行研产研

zs 9 mēneši atpakaļ
vecāks
revīzija
262053223d

+ 1 - 1
src/controller/platform/footplate.controller.ts

@@ -9,7 +9,7 @@ import { QVO_footplate, FVO_footplate, CVO_footplate, UVAO_footplate } from '../
 const namePrefix = '中试平台';
 @ApiTags(['中试平台'])
 @Controller('/footplate', { tagName: namePrefix })
-export class footplateController implements BaseController {
+export class FootplateController implements BaseController {
   @Inject()
   service: FootplateService;
 

+ 66 - 0
src/controller/platform/journal.controller.ts

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

+ 66 - 0
src/controller/platform/notes.controller.ts

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

+ 1 - 1
src/controller/platform/support.controller.ts

@@ -9,7 +9,7 @@ import { QVO_support, FVO_support, CVO_support, UVAO_support } from '../../inter
 const namePrefix = '服务支撑';
 @ApiTags(['服务支撑'])
 @Controller('/support', { tagName: namePrefix })
-export class supportController implements BaseController {
+export class SupportController implements BaseController {
   @Inject()
   service: SupportService;
 

+ 67 - 0
src/controller/system/region.controller.ts

@@ -0,0 +1,67 @@
+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_region, FVO_region, QVO_region, UVAO_region } from '../../interface/system/region.interface';
+import { RegionService } from '../../service/system/region.service';
+const namePrefix = '地区';
+@ApiTags(['地区'])
+@Controller('/region', { tagName: namePrefix })
+export class RegionController implements BaseController {
+  controllerCode = 'system_dict';
+  @Inject()
+  service: RegionService;
+
+  @Get('/')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_region })
+  async index(@Query() query: object) {
+    const qobj = omit(query, ['skip', 'limit']);
+    const others = pick(query, ['skip', 'limit']);
+    const qbr = this.service.queryBuilder(qobj);
+    const result = await this.service.query(qbr, others);
+    return result;
+  }
+
+  @Get('/:id')
+  @ApiTags('单查询')
+  @ApiResponse({ type: FVO_region })
+  async fetch(@Param('id') id: number) {
+    const qbr = this.service.queryBuilder({ id });
+    const data = await this.service.fetch(qbr);
+    const result = new FVO_region(data);
+    return result;
+  }
+
+  @Post('/', { routerName: `创建${namePrefix}` })
+  @ApiTags('创建数据')
+  @Validate()
+  @ApiResponse({ type: CVO_region })
+  async create(@Body() data: object) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_region(dbData);
+    return result;
+  }
+
+  @Post('/:id', { routerName: `修改${namePrefix}` })
+  @ApiTags('修改数据')
+  @Validate()
+  @ApiResponse({ type: UVAO_region })
+  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;
+  }
+}

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

@@ -0,0 +1,16 @@
+import { Entity, Column } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+// 行研产研
+@Entity('journal')
+export class Journal extends BaseModel {
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
+  name: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '封面' })
+  file: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '简介' })
+  brief: string;
+  @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
+  is_use: string;
+  @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
+  status: string;
+}

+ 22 - 0
src/entity/platform/notes.entity.ts

@@ -0,0 +1,22 @@
+import { Entity, Column } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+// 期刊
+@Entity('notes')
+export class Notes extends BaseModel {
+  @Column({ type: 'integer', nullable: true, comment: '所属期刊' })
+  journal: number;
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
+  name: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '封面' })
+  file: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '委托方' })
+  client: string;
+  @Column({ type: 'character varying', nullable: true, comment: '合作方' })
+  partner: string;
+  @Column({ type: 'character varying', nullable: true, comment: '简介' })
+  brief: string;
+  @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
+  is_use: string;
+  @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
+  status: string;
+}

+ 2 - 0
src/entity/system/region.entity.ts

@@ -11,4 +11,6 @@ export class Region extends BaseModel {
   parent_code: string;
   @Column({ type: 'character varying', nullable: true, comment: '等级:province;city;area;street' })
   level: string;
+  @Column({ type: 'character varying', comment: '是否启用', default: '0' })
+  is_use: string;
 }

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

@@ -0,0 +1,75 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from '../../frame/SearchBase';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_journal {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '封面' })
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_journal extends SearchBase {
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_journal extends FVO_journal {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_journal {
+  @ApiProperty({ description: '封面' })
+  @Rule(RuleType['array']().empty(''))
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_journal extends FVO_journal {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_journal extends CDTO_journal {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_journal extends FVO_journal {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 96 - 0
src/interface/platform/notes.interface.ts

@@ -0,0 +1,96 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from '../../frame/SearchBase';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_notes {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '所属期刊' })
+  'journal': number = undefined;
+  @ApiProperty({ description: '封面' })
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '委托方' })
+  'client': string = undefined;
+  @ApiProperty({ description: '合作方' })
+  'partner': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_notes extends SearchBase {
+  @ApiProperty({ description: '所属期刊' })
+  'journal': number = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '委托方' })
+  'client': string = undefined;
+  @ApiProperty({ description: '合作方' })
+  'partner': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_notes extends FVO_notes {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_notes {
+  @ApiProperty({ description: '所属期刊' })
+  @Rule(RuleType['number']().empty(''))
+  'journal': number = undefined;
+  @ApiProperty({ description: '封面' })
+  @Rule(RuleType['array']().empty(''))
+  'file': Array<any> = undefined;
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '委托方' })
+  @Rule(RuleType['string']().empty(''))
+  'client': string = undefined;
+  @ApiProperty({ description: '合作方' })
+  @Rule(RuleType['string']().empty(''))
+  'partner': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_notes extends FVO_notes {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_notes extends CDTO_notes {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_notes extends FVO_notes {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 78 - 0
src/interface/system/region.interface.ts

@@ -0,0 +1,78 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_region {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '编码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '上级编码' })
+  'parent_code': string = undefined;
+  @ApiProperty({ description: '等级' })
+  'level': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QDTO_region {
+  @ApiProperty({ description: '编码' })
+  'code': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '上级编码' })
+  'parent_code': string = undefined;
+  @ApiProperty({ description: '等级' })
+  'level': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+}
+
+export class QVO_region extends FVO_region {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_region {
+  @ApiProperty({ description: '编码' })
+  @Rule(RuleType['string']().empty(''))
+  'code': string = undefined;
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '上级编码' })
+  @Rule(RuleType['string']().empty(''))
+  'parent_code': string = undefined;
+  @ApiProperty({ description: '等级' })
+  @Rule(RuleType['string']().empty(''))
+  'level': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+}
+
+export class CVO_region extends FVO_region {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_region extends CDTO_region {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_region extends FVO_region {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

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

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

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

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

+ 10 - 0
src/service/system/region.service.ts

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