| | |
| | | import { BaseSysLoginService } from '../../service/sys/login'; |
| | | import { BaseSysParamService } from '../../service/sys/param'; |
| | | import { DataService } from '../../service/dataapi/dataapi'; |
| | | import { CreateEntityUtil } from '../../utils/createEntity'; |
| | | |
| | | /** |
| | | * 不需要登录的后台接口 |
| | |
| | | baseSysParamService: BaseSysParamService; |
| | | |
| | | @Inject() |
| | | dataService: DataService; |
| | | dataService: DataService; |
| | | |
| | | @Inject() |
| | | createEntityUtil: CreateEntityUtil; |
| | | |
| | | @Inject() |
| | | ctx: Context; |
| | |
| | | /** |
| | | * 获得数据 |
| | | */ |
| | | @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]) |
| | | }) |
| | | } |
| | | |
| | | } |