feat(safety): support full CRUD for approved commercial places and dynamic sync to uniapp
这个提交包含在:
@@ -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
|
||||
|
||||
在新工单中引用
屏蔽一个用户