bpframework-cli
Version:
cli of bpframework
40 lines (33 loc) • 800 B
text/typescript
;
/**
* Copyright (c) 2022 bpframework Co.,Ltd. All Rights Reserved.
* Author: brian.li
* Date: 2022-01-23 16:27
* Desc:
*/
import { Autowired, Service } from 'bpframework';
import { IDemoService } from '../IDemoService';
import { Table1Mapper } from '@/mappers/Table1Mapper';
import { IDBTemplate } from '@bpframework/middleware-db';
()
class DemoService implements IDemoService {
/**
* autowired db template.
*/
('dbTemplate')
dbTemplate: IDBTemplate;
foo(): string {
return 'foo';
}
/**
* 测试数据库。
*/
async testDatabaseMapper(): Promise<void> {
// get mapper.
let mapper: Table1Mapper = this.dbTemplate.getMapper(
Table1Mapper
) as Table1Mapper;
// query.
await mapper.select('1=1');
}
}