|
1 |
| -<?xml version="1.0" encoding="UTF-8" ?> |
2 |
| -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 |
| - |
4 |
| -<mapper namespace="com.navercorp.pinpoint.web.dao.AlarmDao"> |
5 |
| - |
6 |
| - <insert id="insertRule" parameterType="Rule" useGeneratedKeys="true" keyProperty="ruleId"> |
7 |
| - INSERT INTO alarm_rule (application_id, service_type, checker_name, threshold, user_group_id, sms_send, email_send, webhook_send, notes) |
8 |
| - VALUES |
9 |
| - (#{applicationId}, #{serviceType}, #{checkerName}, #{threshold}, #{userGroupId}, #{smsSend}, #{emailSend}, #{webhookSend}, #{notes}) |
10 |
| - </insert> |
11 |
| - |
12 |
| - <insert id="insertRuleExceptWebhookSend" parameterType="Rule" useGeneratedKeys="true" keyProperty="ruleId"> |
13 |
| - INSERT INTO alarm_rule (application_id, service_type, checker_name, threshold, user_group_id, sms_send, email_send, notes) |
14 |
| - VALUES |
15 |
| - (#{applicationId}, #{serviceType}, #{checkerName}, #{threshold}, #{userGroupId}, #{smsSend}, #{emailSend}, #{notes}) |
16 |
| - </insert> |
17 |
| - |
18 |
| - <delete id="deleteRule" parameterType="Rule"> |
19 |
| - DELETE |
20 |
| - FROM alarm_rule |
21 |
| - WHERE rule_id = #{ruleId} |
22 |
| - </delete> |
23 |
| - |
24 |
| - <select id="selectRuleByUserGroupId" resultType="Rule"> |
25 |
| - SELECT * |
26 |
| - FROM alarm_rule |
27 |
| - WHERE user_group_id = #{userGroupId} |
28 |
| - </select> |
29 |
| - |
30 |
| - <select id="selectRuleByApplicationId" resultType="Rule"> |
31 |
| - SELECT * |
32 |
| - FROM alarm_rule |
33 |
| - WHERE application_id = #{applicationId} |
34 |
| - </select> |
35 |
| - |
36 |
| - <select id="selectApplicationId" resultType="string"> |
37 |
| - SELECT DISTINCT(application_id) |
38 |
| - FROM alarm_rule |
39 |
| - </select> |
40 |
| - |
41 |
| - <update id="updateRule"> |
42 |
| - UPDATE alarm_rule |
43 |
| - SET application_id = #{applicationId}, service_type = #{serviceType}, checker_name = #{checkerName}, threshold = #{threshold}, user_group_id = #{userGroupId}, sms_send = #{smsSend}, email_send = #{emailSend}, webhook_send = #{webhookSend}, notes = #{notes} |
44 |
| - WHERE rule_id = #{ruleId} |
45 |
| - </update> |
46 |
| - |
47 |
| - |
48 |
| - <update id="updateRuleExceptWebhookSend"> |
49 |
| - UPDATE alarm_rule |
50 |
| - SET application_id = #{applicationId}, service_type = #{serviceType}, checker_name = #{checkerName}, threshold = #{threshold}, user_group_id = #{userGroupId}, sms_send = #{smsSend}, email_send = #{emailSend}, notes = #{notes} |
51 |
| - WHERE rule_id = #{ruleId} |
52 |
| - </update> |
53 |
| - |
54 |
| - <update id="updateUserGroupIdOfRule" parameterType="UserGroup"> |
55 |
| - UPDATE alarm_rule |
56 |
| - SET user_group_id = #{id} |
57 |
| - WHERE user_group_id = (SELECT id FROM user_group WHERE number = #{number}) |
58 |
| - </update> |
59 |
| - |
60 |
| - <delete id="deleteCheckerResult" parameterType="string"> |
61 |
| - DELETE |
62 |
| - FROM alarm_history |
63 |
| - WHERE rule_id = #{ruleId} |
64 |
| - </delete> |
65 |
| - |
66 |
| -</mapper> |
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | + |
| 4 | +<mapper namespace="com.navercorp.pinpoint.web.dao.AlarmDao"> |
| 5 | + |
| 6 | + <insert id="insertRule" parameterType="Rule" useGeneratedKeys="true" keyProperty="ruleId"> |
| 7 | + INSERT INTO alarm_rule (application_id, service_type, checker_name, threshold, user_group_id, sms_send, email_send, webhook_send, notes) |
| 8 | + VALUES |
| 9 | + (#{applicationId}, #{serviceType}, #{checkerName}, #{threshold}, #{userGroupId}, #{smsSend}, #{emailSend}, #{webhookSend}, #{notes}) |
| 10 | + </insert> |
| 11 | + |
| 12 | + <insert id="insertRuleExceptWebhookSend" parameterType="Rule" useGeneratedKeys="true" keyProperty="ruleId"> |
| 13 | + INSERT INTO alarm_rule (application_id, service_type, checker_name, threshold, user_group_id, sms_send, email_send, notes) |
| 14 | + VALUES |
| 15 | + (#{applicationId}, #{serviceType}, #{checkerName}, #{threshold}, #{userGroupId}, #{smsSend}, #{emailSend}, #{notes}) |
| 16 | + </insert> |
| 17 | + |
| 18 | + <delete id="deleteRule" parameterType="Rule"> |
| 19 | + DELETE |
| 20 | + FROM alarm_rule |
| 21 | + WHERE rule_id = #{ruleId} |
| 22 | + </delete> |
| 23 | + |
| 24 | + <select id="selectRuleByUserGroupId" resultType="Rule"> |
| 25 | + SELECT * |
| 26 | + FROM alarm_rule |
| 27 | + WHERE user_group_id = #{userGroupId} |
| 28 | + </select> |
| 29 | + |
| 30 | + <select id="selectRuleByApplicationId" resultType="Rule"> |
| 31 | + SELECT * |
| 32 | + FROM alarm_rule |
| 33 | + WHERE application_id = #{applicationId} |
| 34 | + </select> |
| 35 | + |
| 36 | + <select id="selectApplicationId" resultType="string"> |
| 37 | + SELECT DISTINCT(application_id) |
| 38 | + FROM alarm_rule |
| 39 | + </select> |
| 40 | + |
| 41 | + <update id="updateRule"> |
| 42 | + UPDATE alarm_rule |
| 43 | + SET application_id = #{applicationId}, service_type = #{serviceType}, checker_name = #{checkerName}, threshold = #{threshold}, user_group_id = #{userGroupId}, sms_send = #{smsSend}, email_send = #{emailSend}, webhook_send = #{webhookSend}, notes = #{notes} |
| 44 | + WHERE rule_id = #{ruleId} |
| 45 | + </update> |
| 46 | + |
| 47 | + |
| 48 | + <update id="updateRuleExceptWebhookSend"> |
| 49 | + UPDATE alarm_rule |
| 50 | + SET application_id = #{applicationId}, service_type = #{serviceType}, checker_name = #{checkerName}, threshold = #{threshold}, user_group_id = #{userGroupId}, sms_send = #{smsSend}, email_send = #{emailSend}, notes = #{notes} |
| 51 | + WHERE rule_id = #{ruleId} |
| 52 | + </update> |
| 53 | + |
| 54 | + <update id="updateUserGroupIdOfRule" parameterType="UserGroup"> |
| 55 | + UPDATE alarm_rule |
| 56 | + SET user_group_id = #{id} |
| 57 | + WHERE user_group_id = (SELECT id FROM user_group WHERE number = #{number}) |
| 58 | + </update> |
| 59 | + |
| 60 | + <delete id="deleteCheckerResult" parameterType="string"> |
| 61 | + DELETE |
| 62 | + FROM alarm_history |
| 63 | + WHERE rule_id = #{ruleId} |
| 64 | + </delete> |
| 65 | + |
| 66 | +</mapper> |
0 commit comments