离职联动禁用账号
This commit is contained in:
@@ -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])
|
const [rows] = await pool.query('SELECT * FROM employees WHERE id = ?', [id])
|
||||||
res.json({ code: 0, message: 'ok', data: rows[0] })
|
res.json({ code: 0, message: 'ok', data: rows[0] })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user