2024-07-15 00:30:33 +08:00
|
|
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
2023-01-29 13:44:19 +08:00
|
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
2024-08-05 12:49:44 +08:00
|
|
|
import { In, Repository } from 'typeorm';
|
2024-07-15 00:30:33 +08:00
|
|
|
import { BaseService } from '../../../basic/base-service.js';
|
|
|
|
|
import { HistoryLogEntity } from '../entity/history-log.js';
|
2023-01-29 13:44:19 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 证书申请
|
|
|
|
|
*/
|
|
|
|
|
@Provide()
|
|
|
|
|
@Scope(ScopeEnum.Singleton)
|
|
|
|
|
export class HistoryLogService extends BaseService<HistoryLogEntity> {
|
|
|
|
|
@InjectEntityModel(HistoryLogEntity)
|
|
|
|
|
repository: Repository<HistoryLogEntity>;
|
|
|
|
|
|
|
|
|
|
getRepository() {
|
|
|
|
|
return this.repository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async save(bean: HistoryLogEntity) {
|
|
|
|
|
if (bean.id > 0) {
|
|
|
|
|
await this.update(bean);
|
|
|
|
|
} else {
|
|
|
|
|
await this.add(bean);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-05 12:49:44 +08:00
|
|
|
|
|
|
|
|
async deleteByHistoryIds(numbers: number[]) {
|
|
|
|
|
if (numbers.length === 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await this.repository.delete({ historyId: In(numbers) });
|
|
|
|
|
}
|
2023-01-29 13:44:19 +08:00
|
|
|
}
|