| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-01-24 17:10:35 |
| 4 | * @LastEditors: nevin |
| 5 | * @Description: 用户服务 |
| 6 | */ |
| 7 | import { AppDataSource } from '../../db'; |
| 8 | import { Injectable } from '../core/decorators'; |
| 9 | import { Repository } from 'typeorm'; |
| 10 | import { AccountModel } from '../../db/models/account'; |
| 11 | |
| 12 | @Injectable() |
| 13 | export class TestService { |
| 14 | private accountRepository: Repository<AccountModel>; |
| 15 | constructor() { |
| 16 | this.accountRepository = AppDataSource.getRepository(AccountModel); |
| 17 | } |
| 18 | |
| 19 | // 获取用户 |
| 20 | async getInfoById(id: number) { |
| 21 | return await this.accountRepository.findOne({ where: { id } }); |
| 22 | } |
| 23 | } |
| 24 |