From ccb4c32614b63bae0f4c868530bf8df60e7b4e7e Mon Sep 17 00:00:00 2001 From: Kyaru Date: Mon, 29 Jun 2026 14:49:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=BB=E8=81=8C=E8=81=94=E5=8A=A8=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/employees.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routes/employees.js b/routes/employees.js index 3ebb39a..94e716d 100644 --- a/routes/employees.js +++ b/routes/employees.js @@ -206,6 +206,12 @@ async function update(req, res) { } } + // 状态联动:员工离职时同步禁用关联用户,复职时同步启用 + if (req.body.status !== undefined) { + const isActive = req.body.status === 1 ? 1 : 0 + await pool.query('UPDATE users SET is_active = ? WHERE employee_id = ?', [isActive, id]) + } + const [rows] = await pool.query('SELECT * FROM employees WHERE id = ?', [id]) res.json({ code: 0, message: 'ok', data: rows[0] }) } catch (e) {