feat(safety): support full CRUD for approved commercial places and dynamic sync to uniapp

这个提交包含在:
xcbyy
2026-10-10 09:52:42 +08:00
父节点 dc19189bc6
当前提交 e36e80c399
共有 6 个文件被更改,包括 266 次插入 和 6 次删除

查看文件

@@ -1439,6 +1439,40 @@ export class MysqlRepository {
return { id, ...data };
}
async updateSafetyPlace(id: string, data: Partial<{ name: string; area: string; category: string; status: string }>): Promise<any> {
const fields: string[] = [];
const values: any[] = [];
if (data.name !== undefined) {
fields.push('name = ?');
values.push(data.name);
}
if (data.area !== undefined) {
fields.push('area = ?');
values.push(data.area);
}
if (data.category !== undefined) {
fields.push('category = ?');
values.push(data.category);
}
if (data.status !== undefined) {
fields.push('status = ?');
values.push(data.status);
}
if (fields.length > 0) {
values.push(id);
await pool.query(`UPDATE safety_places SET ${fields.join(', ')} WHERE id = ?`, values);
}
const [rows]: any = await pool.query('SELECT * FROM safety_places WHERE id = ?', [id]);
return rows[0] || null;
}
async deleteSafetyPlace(id: string): Promise<boolean> {
const [res]: any = await pool.query('DELETE FROM safety_places WHERE id = ?', [id]);
return res.affectedRows > 0;
}
async getSafetyAuditLogs(): Promise<any[]> {
const [rows]: any = await pool.query(`
SELECT