新增教师资料更新功能,包括个人信息修改和密码更新 添加操作日志记录系统,记录用户关键操作 实现系统设置模块,支持动态配置系统参数 重构数据库模型,新增教师表和系统设置表 优化成绩录入逻辑,支持平时分、期中和期末成绩计算 添加数据导出功能,支持学生、教师和成绩数据导出 完善管理员后台,增加统计图表和操作日志查看
29 lines
902 B
JavaScript
29 lines
902 B
JavaScript
const db = require('../config/database');
|
|
|
|
class OperationLog {
|
|
static async add(logData) {
|
|
const { user_id, type, target, description, ip } = logData;
|
|
const sql = `
|
|
INSERT INTO operation_logs (user_id, operation_type, operation_target, description, ip_address)
|
|
VALUES (?, ?, ?, ?, ?)
|
|
`;
|
|
return await db.query(sql, [user_id, type, target, description, ip]);
|
|
}
|
|
|
|
static async findAll(params = {}) {
|
|
const limit = parseInt(params.limit) || 50;
|
|
const offset = parseInt(params.offset) || 0;
|
|
|
|
const sql = `
|
|
SELECT l.*, u.name as user_name
|
|
FROM operation_logs l
|
|
LEFT JOIN users u ON l.user_id = u.id
|
|
ORDER BY l.created_at DESC
|
|
LIMIT ? OFFSET ?
|
|
`;
|
|
return await db.query(sql, [limit, offset]);
|
|
}
|
|
}
|
|
|
|
module.exports = OperationLog;
|