Blame view

monitor-service-mysql/src/main/resources/META-INF/mybatis/TaskSheduleMapper.xml 6.41 KB
zhengyouwei authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?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.monitor.mysql.mapper.TaskSheduleMapper">
    <resultMap id="BaseResultMap" type="com.model.TaskModel">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="alarm_interval" property="interval" jdbcType="INTEGER"/>
        <result column="relax_start_time" property="relaxStartTime" jdbcType="INTEGER"/>
        <result column="relax_end_time" property="relaxEndTime" jdbcType="INTEGER"/>
        <result column="time_flag" property="timeFlag" jdbcType="INTEGER"/>
        <result column="alarm_type" property="alarmType" jdbcType="INTEGER"/>
        <result column="alarm_num_flag" property="alarmNumFlag" jdbcType="INTEGER"/>
        <result column="is_run" property="isRun" jdbcType="INTEGER"/>
        <result column="is_on" property="isOn" jdbcType="INTEGER"/>
        <result column="continuous_alarm_times" property="alarmTimes" jdbcType="INTEGER"/>
        <result column="fields" property="fields" jdbcType="VARCHAR"/>
        <result column="tags" property="tags" jdbcType="VARCHAR"/>
        <result column="influxdbs" property="influxdbs" jdbcType="VARCHAR"/>
        <result column="influx_sql" property="influxSql" jdbcType="VARCHAR"/>
        <result column="mobile" property="mobile" jdbcType="VARCHAR"/>
        <result column="sms" property="sms" jdbcType="VARCHAR"/>
        <result column="type" property="type" jdbcType="VARCHAR"/>
        <result column="inf_database" property="database" jdbcType="VARCHAR"/>
        <result column="description" property="description" jdbcType="VARCHAR"/>
        <result column="last_time" property="lastTime"/>
Xu authored
25
        <result column="alarm_group_id" property="alarmGroupId" jdbcType="INTEGER"/>
qinchao authored
26 27
        <result column="addsource" property="addSource" jdbcType="INTEGER"/>
        <result column="influx_sql_snd" property="influxSqlSnd" jdbcType="VARCHAR"/>
28
        <result column="eventname" property="eventName" jdbcType="VARCHAR"/>
29 30
        <result column="operation" property="operation" jdbcType="INTEGER"/>
        <result column="data_interval_times" property="dataIntervalTimes" jdbcType="INTEGER"/>
zhengyouwei authored
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    </resultMap>

    <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    select
      *
    from task_shedule
    where id = #{id,jdbcType=INTEGER}
  </select>

    <select id="selectAll" resultMap="BaseResultMap">
    select
      *
    from task_shedule
  </select>
qinchao authored
46
    <select id="selectByPageWithSourceTask" resultMap="BaseResultMap">
zhengyouwei authored
47 48 49
    select
    *
    from task_shedule
50 51 52
    where addsource = #{params.addSource,jdbcType=INTEGER}
     <if test="params.eventName != null &amp;&amp; params.eventName != ''" >
            and  eventname like CONCAT('%',#{params.eventName,jdbcType=VARCHAR},'%' )
53 54
     </if>
        order by id
55
        limit #{startIndex},#{pageSize}
zhengyouwei authored
56 57
  </select>
58
    <!--<select id="selectByPageWithSourceGateway" resultMap="BaseResultMap">
qinchao authored
59 60 61 62
        select
        *
        from task_shedule
        where addsource = 1
63 64 65
        <if test="page.params.eventName != null &amp;&amp; page.params.eventName != ''" >
            and  eventname like CONCAT('%',#{page.params.eventName,jdbcType=VARCHAR},'%' )
        </if>
qinchao authored
66
        order by id
67 68
        limit #{page.startIndex},#{page.pageSize}
    </select>-->
qinchao authored
69
zhengyouwei authored
70 71 72 73
    <select id="selectCount" resultType="java.lang.Integer">
    select
    count(1)
    from task_shedule
74 75 76
    where addsource = #{params.addSource,jdbcType=INTEGER}
    <if test="params.eventName != null &amp;&amp; params.eventName != ''" >
        and eventname like  CONCAT('%',#{params.eventName,jdbcType=VARCHAR},'%' )
77
   </if>
zhengyouwei authored
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  </select>

    <delete id="deleteById" parameterType="java.lang.Integer">
    delete from task_shedule
    where id = #{id,jdbcType=INTEGER}
  </delete>

    <update id="updateByid" parameterType="com.model.TaskModel">
    update task_shedule
    set alarm_interval = #{interval,jdbcType=INTEGER},
    relax_start_time = #{relaxStartTime,jdbcType=INTEGER},
    time_flag = #{timeFlag,jdbcType=INTEGER},
    relax_end_time = #{relaxEndTime,jdbcType=INTEGER},
    alarm_type = #{alarmType,jdbcType=INTEGER},
    alarm_num_flag = #{alarmNumFlag,jdbcType=INTEGER},
    is_on = #{isOn,jdbcType=INTEGER},
    fields = #{fields,jdbcType=VARCHAR},
    tags = #{tags,jdbcType=VARCHAR},
    influxdbs = #{influxdbs,jdbcType=VARCHAR},
    influx_sql = #{influxSql,jdbcType=VARCHAR},
qinchao authored
98
    influx_sql_snd = #{influxSqlSnd,jdbcType=VARCHAR},
zhengyouwei authored
99 100 101 102
    mobile = #{mobile,jdbcType=VARCHAR},
    sms = #{sms,jdbcType=VARCHAR},
    type = #{type,jdbcType=VARCHAR},
    description = #{description,jdbcType=VARCHAR},
Xu authored
103
    inf_database = #{database,jdbcType=VARCHAR},
104
    alarm_group_id = #{alarmGroupId,jdbcType=INTEGER},
105
    eventname = #{eventName,jdbcType=INTEGER},
106 107
    operation = #{operation,jdbcType=INTEGER},
    data_interval_times = #{dataIntervalTimes,jdbcType=INTEGER}
zhengyouwei authored
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
    where id = #{id,jdbcType=INTEGER}
  </update>

    <insert id="insert" parameterType="com.model.TaskModel">
    insert into task_shedule
    (alarm_interval,
      relax_start_time,
      time_flag,
      relax_end_time,
      alarm_num_flag,
      alarm_type,
      is_on,
      fields,
      tags,
      influxdbs,
      influx_sql,
      mobile,
      sms,
      type ,
      inf_database,
Xu authored
128
      description,
qinchao authored
129 130
      alarm_group_id,
      addsource,
mlge authored
131
      influx_sql_snd,
132
      eventname,
133 134
      operation,
      data_interval_times)
zhengyouwei authored
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    values
    (#{interval,jdbcType=INTEGER},
     #{relaxStartTime,jdbcType=INTEGER},
     #{timeFlag,jdbcType=INTEGER},
     #{relaxEndTime,jdbcType=INTEGER},
     #{alarmNumFlag,jdbcType=INTEGER},
     #{alarmType,jdbcType=INTEGER},
     #{isOn,jdbcType=INTEGER},
     #{fields,jdbcType=VARCHAR},
     #{tags,jdbcType=VARCHAR},
     #{influxdbs,jdbcType=VARCHAR},
     #{influxSql,jdbcType=VARCHAR},
     #{mobile,jdbcType=VARCHAR},
     #{sms,jdbcType=VARCHAR},
     #{type,jdbcType=VARCHAR},
     #{database,jdbcType=VARCHAR},
Xu authored
151
     #{description,jdbcType=VARCHAR},
qinchao authored
152 153
     #{alarmGroupId,jdbcType=INTEGER},
     #{addSource,jdbcType=INTEGER},
mlge authored
154
     #{influxSqlSnd,jdbcType=VARCHAR},
155 156 157
     #{eventName,jdbcType=VARCHAR},
     #{operation,jdbcType=INTEGER},
     #{dataIntervalTimes,jdbcType=INTEGER}
zhengyouwei authored
158 159 160 161 162 163 164 165 166
      )
  </insert>

    <update id="updateLastTime" parameterType="java.lang.Integer">
        update task_shedule
        set last_time = now()
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>