`
r.ID = #{id}
AND r.IS_LOCK = #{isLock}
AND r.CHECK_POINT = #{checkPoint}
AND r.RISK_EVENT_TYPE = #{riskEventType}
AND r.RULE_TYPE in
#{item}
AND r.RULE_TYPE = #{ruleType}
AND r.RULE_TYPE != '30' AND r.RULE_TYPE != '20'
AND r.RULE_RUN_TYPE = #{ruleRunType}
AND r.RULE_NAME like '%'||#{ruleName}||'%'
AND r.RULE_DESC = #{ruleDesc}
AND r.TRANS_TYPE = #{transType}
AND r.RULE_CLASSIFY = #{ruleClassify}
AND r.CREATE_OPER = #{createOper}
AND r.UPDATE_OPER = #{updateOper}
AND r.INUSE_BEG_TIME = to_date(#{inuseBegTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')
AND r.INUSE_END_TIME = to_date(#{inuseEndTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')
AND r.MIN_AMOUNT = #{minAmount}
AND r.CHECK_CUSTOMER_ID = #{checkCustomerId}
AND r.CHECK_CARD_ID = #{checkCardId}
AND r.RULE_CONTENT = #{ruleContent}
AND r.RUN_MODE = #{runMode}
AND r.CREATE_TIME = to_date(#{createTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')
AND r.UPDATE_TIME = to_date(#{updateTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')
AND r.PAY_TYPE = #{payType}
AND r.GRADE = #{grade}
AND r.RISKRULEID = #{riskRuleId}
AND r.IS_IN_USE = #{isInUse}
AND r.INUSE_END_TIME > sysdate
AND r.RULE_RESULT = #{ruleResult}
AND r.SAFETY_FLAG = #{safetyFlag}
AND (r.AUTHORITY = #{authority} OR r.AUTHORITY = '' OR r.AUTHORITY IS NULL)
r.ID id,r.IS_LOCK isLock,
r.CHECK_POINT checkPoint,
r.RISK_EVENT_TYPE riskEventType,
r.RULE_TYPE ruleType,
r.RULE_RUN_TYPE ruleRunType,
r.RULE_NAME ruleName,
r.RULE_DESC ruleDesc,
r.TRANS_TYPE transType,
r.RULE_CLASSIFY ruleClassify,
r.CREATE_OPER createOper,
r.CREATE_TIME createTime,
r.UPDATE_OPER updateOper,
to_char(r.UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') updateTime,
r.INUSE_BEG_TIME inuseBegTime,
r.INUSE_END_TIME inuseEndTime,
r.MIN_AMOUNT minAmount,
r.CHECK_CUSTOMER_ID checkCustomerId,
r.CHECK_CARD_ID checkCardId,
r.RULE_CONTENT ruleContent,
r.RUN_MODE runMode,
r.PAY_TYPE payType,
r.GRADE grade,
r.RISKRULEID riskRuleId,
r.RULE_RESULT ruleResult,
r.RULE_ACTION ruleAction,
r.ICE_TYPE iceType,
r.RULE_CONTENT_DESC ruleContentDesc,
r.RISK_EXTRA_MSG riskExtraMsg,
r.IS_IN_USE isInUse,
r.SELECTOR_ITEMS selectorItems,
r.final_rule_content finalRuleContent,
r.RULE_REAL_NAME ruleRealName,
r.SAFETY_FLAG safetyFlag,
r.AUTHORITY authority
WHERE RULE_NAME like '%'||#{ruleName}||'%'
order by inuseBegTime desc
WHERE Id=#{id}
order by updateTime desc
WHERE RISKRULEID=#{riskRuleId}
INSERT INTO TC_RC_REGULATIONS
(ID, IS_LOCK, CHECK_POINT, RISK_EVENT_TYPE, RULE_TYPE, RULE_RUN_TYPE, RULE_NAME, RULE_DESC, TRANS_TYPE, RULE_CLASSIFY, CREATE_OPER, CREATE_TIME,
UPDATE_OPER, UPDATE_TIME, INUSE_BEG_TIME , INUSE_END_TIME, RULE_CONTENT, RUN_MODE, PAY_TYPE, GRADE,RISKRULEID,
RULE_RESULT,RULE_ACTION,ICE_TYPE, RULE_CONTENT_DESC,CHECK_CUSTOMER_ID,CHECK_CARD_ID,RISK_EXTRA_MSG,IS_IN_USE,SELECTOR_ITEMS,RULE_REAL_NAME,SAFETY_FLAG,AUTHORITY)
VALUES
(#{id,jdbcType=VARCHAR},'0',#{checkPoint,jdbcType=VARCHAR},#{riskEventType,jdbcType=VARCHAR},#{ruleType,jdbcType=VARCHAR},
#{ruleRunType,jdbcType=VARCHAR},#{ruleName,jdbcType=VARCHAR},#{ruleDesc,jdbcType=VARCHAR},
#{transType,jdbcType=VARCHAR},#{ruleClassify,jdbcType=VARCHAR},#{createOper,jdbcType=VARCHAR},sysdate,#{updateOper,jdbcType=VARCHAR},
sysdate,to_date(#{inuseBegTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss'),
to_date(#{inuseEndTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss'),#{ruleContent,jdbcType=VARCHAR},
#{runMode,jdbcType=VARCHAR},#{payType,jdbcType=VARCHAR},#{grade,jdbcType=VARCHAR},
SEQ_RISK_RULE_ID.NEXTVAL,#{ruleResult,jdbcType=VARCHAR},#{ruleAction,jdbcType=VARCHAR},
#{iceType,jdbcType=VARCHAR},#{ruleContentDesc,jdbcType=VARCHAR},#{checkCustomerId,jdbcType=VARCHAR},#{checkCardId,jdbcType=VARCHAR},#{riskExtraMsg,jdbcType=VARCHAR},#{isInUse,jdbcType=CHAR},#{selectorItems,jdbcType=CHAR},
#{ruleRealName,jdbcType=VARCHAR},#{safetyFlag,jdbcType=VARCHAR},#{authority,jdbcType=VARCHAR})
]]>
FROM TC_RC_REGULATIONS r left join TC_RC_REGULATION_APPROVE ra
on r.id = ra.regulation_id AND ra.APPROVE_STATUS='0'
order by r.UPDATE_TIME desc
update TC_RC_REGULATIONS
IS_LOCK = #{isLock},
CHECK_POINT = #{checkPoint},
RISK_EVENT_TYPE = #{riskEventType},
RULE_TYPE = #{ruleType},
RULE_RUN_TYPE = #{ruleRunType},
RULE_NAME = #{ruleName},
TRANS_TYPE = #{transType},
RULE_CLASSIFY = #{ruleClassify},
UPDATE_OPER = #{updateOper},
UPDATE_TIME = sysdate,
INUSE_BEG_TIME = to_date(#{inuseBegTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss'),
INUSE_END_TIME = null,
INUSE_END_TIME = to_date(#{inuseEndTime,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss'),
RULE_CONTENT = #{ruleContent},
RULE_CONTENT_DESC = #{ruleContentDesc},
RULE_RESULT = #{ruleResult},
RULE_ACTION = #{ruleAction},
ICE_TYPE = #{iceType},
RISK_EXTRA_MSG = #{riskExtraMsg},
IS_IN_USE = #{isInUse},
SELECTOR_ITEMS = #{selectorItems},
RULE_DESC = #{ruleDesc,jdbcType=VARCHAR},
MIN_AMOUNT = #{minAmount,jdbcType=VARCHAR},
CHECK_CUSTOMER_ID = #{checkCustomerId,jdbcType=VARCHAR},
CHECK_CARD_ID = #{checkCardId,jdbcType=VARCHAR},
RUN_MODE = #{runMode,jdbcType=VARCHAR},
PAY_TYPE = #{payType,jdbcType=VARCHAR},
GRADE = #{grade,jdbcType=VARCHAR},
final_rule_content = #{finalRuleContent,jdbcType=VARCHAR},
RULE_REAL_NAME = #{ruleRealName},
SAFETY_FLAG = #{safetyFlag},
AUTHORITY = #{authority},
where ID =#{id,jdbcType=VARCHAR}
update TC_RC_REGULATIONS T set T.push_code = #{pushCode,jdbcType=VARCHAR},T.riskRuleId = #{grade,jdbcType=VARCHAR}
where ID =#{id,jdbcType=VARCHAR}
update TC_RC_REGULATIONS T set T.IS_LOCK = '1'
, AUTHORITY = #{authority,jdbcType=VARCHAR}
where ID =#{id,jdbcType=VARCHAR}
r.RULE_ACTION ruleAction
from tc_rc_regulations r
left join t_rule_module_relation a
on a.rule_id = r.riskruleid
and a.type = #{type,jdbcType=VARCHAR}
a.module_id = #{moduleId,jdbcType=VARCHAR}
update TC_RC_REGULATIONS T
set T.IS_IN_USE = '0',
T.IS_LOCK = '0',
T.UPDATE_OPER = #{updateOper, jdbcType=VARCHAR},
T.UPDATE_TIME = sysdate
where riskRuleId = #{riskRuleId,jdbcType=VARCHAR}
`