INSERT INTO hrm_users (username, password_hash, display_name, email, role, active) VALUES (#{username}, #{passwordHash}, #{displayName}, #{email}, #{role}, #{active}) UPDATE hrm_users SET display_name=#{displayName}, email=#{email}, role=#{role} , password_hash=#{passwordHash} WHERE id=#{id} UPDATE hrm_users SET active=#{active} WHERE id=#{id} INSERT INTO hrm_audit_log (actor, action, target_type, target_id, detail, ip_addr) VALUES (#{actor}, #{action}, #{targetType}, #{targetId}, #{detail}, #{ipAddr}) INSERT INTO hrm_settings (key, value, updated_by) VALUES (#{key}, #{value}, #{updatedBy}) ON CONFLICT (key) DO UPDATE SET value=#{value}, updated_by=#{updatedBy}, updated_at=NOW()