INSERT INTO sys_scene_exception_rule (site, bu_no, rule_code, rule_name, apply_page, apply_button, enable_flag, create_by, create_date, update_by, update_date) VALUES (#{site}, #{buNo}, #{ruleCode}, #{ruleName}, #{applyPage}, #{applyButton}, #{enableFlag}, #{createBy}, GETDATE(), #{updateBy}, GETDATE()) UPDATE sys_scene_exception_rule SET rule_name = #{ruleName}, apply_page = #{applyPage}, apply_button = #{applyButton}, enable_flag = #{enableFlag}, update_by = #{updateBy}, update_date = GETDATE() WHERE site = #{site} AND bu_no = #{buNo} AND rule_code = #{ruleCode} DELETE FROM sys_scene_exception_rule WHERE site = #{site} AND bu_no = #{buNo} AND rule_code = #{ruleCode} DELETE FROM sys_scene_exception_rule_condition WHERE site = #{site} AND bu_no = #{buNo} AND rule_code = #{ruleCode} INSERT INTO sys_scene_exception_rule_condition (site, bu_no, rule_code, condition_no, parent_condition_no, relation_field, compare_symbol, condition_param, force_type, warning_level, animation_effect, responsibility_dept, trigger_event, create_by, create_date, update_by, update_date) VALUES (#{site}, #{buNo}, #{ruleCode}, #{conditionNo}, #{parentConditionNo}, #{relationField}, #{compareSymbol}, #{conditionParam}, #{forceType}, #{warningLevel}, #{animationEffect}, #{responsibilityDept}, #{triggerEvent}, #{createBy}, GETDATE(), #{updateBy}, GETDATE()) UPDATE sys_scene_exception_rule_condition SET parent_condition_no = #{parentConditionNo}, relation_field = #{relationField}, compare_symbol = #{compareSymbol}, condition_param = #{conditionParam}, force_type = #{forceType}, warning_level = #{warningLevel}, animation_effect = #{animationEffect}, responsibility_dept = #{responsibilityDept}, trigger_event = #{triggerEvent}, update_by = #{updateBy}, update_date = GETDATE() WHERE site = #{site} AND bu_no = #{buNo} AND rule_code = #{ruleCode} AND condition_no = #{conditionNo} DELETE FROM sys_scene_exception_rule_condition WHERE site = #{site} AND bu_no = #{buNo} AND rule_code = #{ruleCode} AND condition_no = #{conditionNo} DELETE FROM sys_scene_exception_rule_condition WHERE site = #{site} AND bu_no = #{buNo} AND rule_code = #{ruleCode} AND (condition_no = #{conditionNo} OR parent_condition_no = #{conditionNo})