From a45591fc22c088fe45fafb651b0c4575cc5c2f0f Mon Sep 17 00:00:00 2001
From: wangrong <wangrong@shsening.com>
Date: 星期三, 16 三月 2022 18:37:41 +0800
Subject: [PATCH] 添加业务接口代码
---
src/app/modules/base/controller/admin/open.ts | 53 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/src/app/modules/base/controller/admin/open.ts b/src/app/modules/base/controller/admin/open.ts
index 6e4b8ec..8bf708c 100644
--- a/src/app/modules/base/controller/admin/open.ts
+++ b/src/app/modules/base/controller/admin/open.ts
@@ -13,6 +13,7 @@
import { BaseSysLoginService } from '../../service/sys/login';
import { BaseSysParamService } from '../../service/sys/param';
import { DataService } from '../../service/dataapi/dataapi';
+import { CreateEntityUtil } from '../../utils/createEntity';
/**
* 涓嶉渶瑕佺櫥褰曠殑鍚庡彴鎺ュ彛
@@ -27,7 +28,10 @@
baseSysParamService: BaseSysParamService;
@Inject()
- dataService: DataService;
+ dataService: DataService;
+
+ @Inject()
+ createEntityUtil: CreateEntityUtil;
@Inject()
ctx: Context;
@@ -85,19 +89,46 @@
/**
* 鑾峰緱鏁版嵁
*/
- @Get('/getdata', { summary: '鏁版嵁鎺ュ彛' })
- async getData(@Query(ALL) params: any) {
- console.log('-------------------------------------------------------');
- console.log(params);
- return this.ok(await this.dataService.getData(params));
- }
+ @Get('/getdata', { summary: '鏁版嵁鎺ュ彛' })
+ async getData(@Query(ALL) params: any) {
+ console.log(params);
+ return this.ok(await this.dataService.getData(params));
+ }
/**
* 鑾峰緱鏁版嵁
*/
- @Post('/postdata', { summary: '鏁版嵁鎺ュ彛' })
- async postData(@Query(ALL) params: any) {
- return this.ok(await this.dataService.getData(params));
- }
+ @Post('/postdata', { summary: '鏁版嵁鎺ュ彛' })
+ async postData(@Query(ALL) params: any) {
+ return this.ok(await this.dataService.getData(params));
+ }
+
+ @Get('/createEntity', {})
+ async createEntity() {
+ console.log('鐢熸垚缁煎悎瀹炰綋绫讳换鍔″紑濮嬫墽琛�');
+
+ let tables = await this.dataService.getDataByNative({ "bid": "getTableNeedCreate", "pageindex": "1", "pagesize": "300" })
+ let columns = await this.dataService.getDataByNative({ "bid": "getColumns", "pageindex": "1", "pagesize": "300" }) //bid_obj_[0], query?.pageindex || null , query?.pagesize || null, query
+ console.log(`${tables.length} and columnlength ${columns.length}`)
+ let tabs = {};
+ tables.forEach(element => {
+ tabs[element.name] = element;
+ });
+ columns.forEach(element => {
+ let tbname = element.table_name;
+ if (!tabs[tbname]) {
+ tabs[tbname] = {}
+ }
+ if (!tabs[tbname].tbcolumn) {
+ tabs[tbname].tbcolumn = [];
+ }
+ tabs[tbname].tbcolumn.push(element)
+ });
+ Object.keys(tabs).forEach(key => {
+ this.createEntityUtil.createEntity(tabs[key])
+ this.createEntityUtil.createService(tabs[key])
+ this.createEntityUtil.createController(tabs[key])
+ })
+ }
}
--
Gitblit v1.9.1