RuleMapper.xml
4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?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="cn.com.glsx.dj.mindworkplate.mapper.warning.RuleMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.warning.Rule" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="monitor_type" property="monitorType" jdbcType="BIT" />
<result column="business_type" property="businessType" jdbcType="BIT" />
<result column="data_statistics_type" property="dataStatisticsType" jdbcType="BIT" />
<result column="priority_level" property="priorityLevel" jdbcType="TINYINT" />
<result column="stage" property="stage" jdbcType="INTEGER" />
<result column="rule_type" property="ruleType" jdbcType="VARCHAR" />
<result column="rule" property="rule" jdbcType="VARCHAR" />
<result column="rule_sql" property="ruleSql" jdbcType="LONGVARCHAR" />
<result column="rule_describe" property="ruleDescribe" jdbcType="LONGVARCHAR" />
<result column="count_days" property="countDays" jdbcType="INTEGER" />
<result column="send_cycle" property="sendCycle" jdbcType="BIT" />
<result column="morrow" property="morrow" jdbcType="BIT" />
<result column="send_time" property="sendTime" jdbcType="TIMESTAMP" />
<result column="send_last_time" property="sendLastTime" jdbcType="TIMESTAMP" />
<result column="initial_state_type" property="initialStateType" jdbcType="BIT" />
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="field_name" property="fieldName" jdbcType="VARCHAR" />
<result column="sortOrder" property="sortOrder" jdbcType="INTEGER" />
<result column="sort_id" property="sortId" jdbcType="INTEGER" />
<result column="staff_field_name" property="staffFieldName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="MsgResultMap" type="cn.com.glsx.dj.mindworkplate.model.warning.WarningMsg" >
<result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="merchant_id4s" property="merchantId4s" jdbcType="INTEGER" />
<result column="merchant_name4s" property="merchantName4s" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="MsgModelResultMap" type="cn.com.glsx.dj.mindworkplate.model.WarningMsgRuleModel" >
<result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="merchant_id4s" property="merchantId4s" jdbcType="INTEGER" />
<result column="merchant_name4s" property="merchantName4s" jdbcType="VARCHAR" />
<result column="config_value" property="configValue" jdbcType="VARCHAR" />
<result column="configValueOld" property="configValueOld" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, monitor_type, business_type, data_statistics_type, priority_level, stage, rule_type,
rule,rule_sql, rule_describe, count_days, send_cycle, morrow, send_time, send_last_time, initial_state_type,
created_time, created_by, updated_time, updated_by, deleted_flag
</sql>
<select id="executeSql" resultMap="MsgResultMap">
${ruleSql}
</select>
<select id="findAllRuleType" resultType="java.lang.String">
select distinct rule_type from early_warning_rule
</select>
<select id="findAllRule" resultType="java.lang.String">
select distinct rule from early_warning_rule
</select>
<select id="selectByType" resultMap="BaseResultMap">
SELECT * FROM early_warning_rule WHERE monitor_type=#{type}
</select>
<select id="executePrefixSql" resultMap="MsgModelResultMap">
${ruleSql}
</select>
<select id="selectByTypeAndMetricType"
resultMap="BaseResultMap">
SELECT t1.*,t2.field_name,t2.staff_field_name,t3.sort_order as sortOrder FROM early_warning_rule t1
LEFT JOIN early_warning_rule_condition t2 ON t1.id=t2.rule_id
left join monitor_type_dict t3 on t1.monitor_type_dict_id=t3.type_code
where strategy_flag=1 and t1.deleted_flag='N'
<if test="monitorType!=null">
and monitor_type_dict_id=#{monitorType}
</if>
<if test="metricTypeId!=null">
AND t1.id=#{metricTypeId}
</if>
group by t1.id
</select>
</mapper>