clue.module.ts
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Module } from '@nestjs/common';
import { ClueController } from './clue.controller';
import { ClueService } from './clue.service';
import { PrismaModule } from 'nestjs-prisma';
import { TypeOrmModule } from '@nestjs/typeorm'
import { DB1_Table1Entity } from './db1/entities/table1.entity';
import { DB1_Table2Entity } from './db1/entities/table2.entity'
import { DB2_Table3Entity } from './db2/entities/table3.entity';
import { DB1_Table4Entity } from './db1/entities/table4.entity';
@Module({
imports: [
TypeOrmModule.forRoot({
name: 'db1', // 连接名称
type: 'mysql',
// host: '192.168.1.39',
// port: 3306,
// username: 'user_chenwq',
// password: 'IxQstO23',
host: '192.168.5.23',
port: 3306,
username: 'user_chenwq',
password: '5bL3Vk1x',
database: 'dj_smartcarlife',
entities: [DB1_Table1Entity, DB1_Table2Entity, DB1_Table4Entity],
synchronize: false,
}),
TypeOrmModule.forRoot({
name: 'db2', // 连接名称
type: 'mysql',
// host: '192.168.3.227',
// port: 3306,
// username: 'os_user',
// password: 'os#123',
host: '192.168.5.1',
port: 3310,
username: 'user_chenwq',
password: 'n41X5tbK',
database: 'scrm_clue',
entities: [DB2_Table3Entity],
synchronize: false,
}),
TypeOrmModule.forFeature([DB1_Table1Entity, DB1_Table2Entity, DB1_Table4Entity], 'db1'),
TypeOrmModule.forFeature([DB2_Table3Entity], 'db2'),
],
controllers: [ClueController],
providers: [ClueService],
exports: [ClueService],
})
export class ClueModule {}