import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { PDepart } from 'kkk-lib/auth/entity/p-depart'; import { Repository } from 'typeorm'; @Injectable() export class DepartService { constructor( @InjectRepository(PDepart) private readonly repository: Repository, ) {} async create(depart: { name: string; deptId?: string }): Promise { return this.repository.save(depart); } async findOne(name: string): Promise { const p:any = {name:name}; const depart = await this.repository.findOne(p); return depart; } }