fix: 归档删除改为软删除

This commit is contained in:
2026-07-17 14:13:17 +08:00
parent 3131d2e141
commit f7328d670d
49 changed files with 520 additions and 354 deletions

View File

@@ -74,7 +74,7 @@ export class AttendanceDevicesController {
userId: req.user?.id,
username: req.user?.username,
module: '考勤机',
action: '删除考勤机绑定',
action: '停用考勤机绑定',
targetId: id,
targetType: 'attendanceDevice',
ipAddress,

View File

@@ -74,8 +74,11 @@ export class AttendanceDevicesService {
async remove(id: number) {
const device = await this.repo.findOne({ where: { id } });
if (!device) throw new NotFoundException('考勤机不存在');
await this.repo.delete(id);
return { message: '已删除' };
if (device.status === AttendanceDeviceStatus.DISABLED) {
throw new BadRequestException('考勤机已停用');
}
await this.repo.update(id, { status: AttendanceDeviceStatus.DISABLED });
return { message: '已停用(绑定数据已保留)' };
}
async findActiveBySn(deviceSns: string[]) {