You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
7.2 KiB
206 lines
7.2 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.gaotao.modules.sys.mapper.SysSceneExceptionRuleMapper">
|
|
|
|
<select id="searchRule" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleEntity">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
rule_code,
|
|
rule_name,
|
|
apply_page,
|
|
apply_button,
|
|
enable_flag,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date
|
|
FROM sys_scene_exception_rule
|
|
<where>
|
|
1 = 1
|
|
<if test="query.userName != null and query.userName != ''">
|
|
AND site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName})
|
|
AND bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName})
|
|
</if>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.ruleCode != null and query.ruleCode != ''">
|
|
AND rule_code LIKE '%' + #{query.ruleCode} + '%'
|
|
</if>
|
|
<if test="query.ruleName != null and query.ruleName != ''">
|
|
AND rule_name LIKE '%' + #{query.ruleName} + '%'
|
|
</if>
|
|
</where>
|
|
ORDER BY ISNULL(update_date, create_date) DESC, rule_code DESC
|
|
</select>
|
|
|
|
<select id="getEnabledRuleListByApply" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleEntity">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
rule_code,
|
|
rule_name,
|
|
apply_page,
|
|
apply_button,
|
|
enable_flag,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date
|
|
FROM sys_scene_exception_rule
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND enable_flag = 'Y'
|
|
AND apply_page = #{applyPage}
|
|
AND apply_button = #{applyButton}
|
|
ORDER BY rule_code
|
|
</select>
|
|
|
|
<insert id="saveRule">
|
|
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())
|
|
</insert>
|
|
|
|
<update id="updateRule">
|
|
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}
|
|
</update>
|
|
|
|
<delete id="deleteRule">
|
|
DELETE FROM sys_scene_exception_rule
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND rule_code = #{ruleCode}
|
|
</delete>
|
|
|
|
<delete id="deleteConditionByRule">
|
|
DELETE FROM sys_scene_exception_rule_condition
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND rule_code = #{ruleCode}
|
|
</delete>
|
|
|
|
<select id="getConditionList" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleConditionEntity">
|
|
SELECT
|
|
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
|
|
FROM sys_scene_exception_rule_condition
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND rule_code = #{ruleCode}
|
|
ORDER BY
|
|
CASE WHEN ISNULL(parent_condition_no, '') = '' THEN condition_no ELSE parent_condition_no END,
|
|
CASE WHEN ISNULL(parent_condition_no, '') = '' THEN 0 ELSE 1 END,
|
|
condition_no
|
|
</select>
|
|
|
|
<select id="getCondition" resultType="com.gaotao.modules.sys.entity.SysSceneExceptionRuleConditionEntity">
|
|
SELECT
|
|
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
|
|
FROM sys_scene_exception_rule_condition
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND rule_code = #{ruleCode}
|
|
AND condition_no = #{conditionNo}
|
|
</select>
|
|
|
|
<select id="countConditionNo" resultType="java.lang.Integer">
|
|
SELECT COUNT(1)
|
|
FROM sys_scene_exception_rule_condition
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND rule_code = #{ruleCode}
|
|
AND condition_no = #{conditionNo}
|
|
</select>
|
|
|
|
<insert id="saveCondition">
|
|
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())
|
|
</insert>
|
|
|
|
<update id="updateCondition">
|
|
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}
|
|
</update>
|
|
|
|
<delete id="deleteCondition">
|
|
DELETE FROM sys_scene_exception_rule_condition
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND rule_code = #{ruleCode}
|
|
AND condition_no = #{conditionNo}
|
|
</delete>
|
|
|
|
<delete id="deleteConditionWithChildren">
|
|
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})
|
|
</delete>
|
|
</mapper>
|