feat: 初始化智能物联网设备管理系统前后端基础项目

完成项目整体结构搭建,包含:
1. 前端Vue3+TS+Vite+Antd项目基础配置与核心依赖
2. 后端MidwayJS+TypeORM+JWT权限认证框架
3. 完整的用户、角色、权限、日志数据库表结构
4. 核心业务模块API与基础服务实现
5. 全局样式、路由、状态管理配置
This commit is contained in:
andyesfly committed 2026-05-28 16:23:15 +08:00
commit 3d7eb12103
89 files changed
+16085

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
import { Controller, Get, Inject, Query, Param, All } from "@midwayjs/core";
import { Context } from "@midwayjs/koa";
import { LogService } from "../service/log.service";
const Delete = (path?: string) => {
return (target: any, key: string, descriptor: PropertyDescriptor) => {
return descriptor;
};
};
@Controller("/api/logs")
export class LogController {
@Inject()
ctx!: Context;
@Inject()
logService!: LogService;
@Get("/")
async list(@Query() query: { page?: number; pageSize?: number; moduleName?: string; actionType?: string; startDate?: string; endDate?: string; operator?: string }) {
const result = await this.logService.list(query);
return result;
}
@Get("/:id")
async detail(@Param("id") id: string) {
const result = await this.logService.detail(id);
return result;
}
@All("/export")
async export(@Query() query: any) {
try {
const csvContent = await this.logService.exportLogs(query);
this.ctx.set("Content-Type", "text/csv;charset=utf-8");
this.ctx.set("Content-Disposition", `attachment; filename=operation_logs_${Date.now()}.csv`);
this.ctx.body = csvContent;
return;
} catch (error: any) {
return {
code: 500,
message: error?.message || "导出失败"
};
}
}
@Delete("/clear")
async clear() {
const result = await this.logService.cleanExpiredLogs(0);
return {
code: 200,
message: `成功清理 ${result} 条日志`,
data: { deletedCount: result }
};
}
}