<?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.wgcloud.mapper.HeathMonitorMapper">
|
<resultMap id="resultMap" type="com.wgcloud.entity.HeathMonitor">
|
<id column="ID" property="id" jdbcType="CHAR" />
|
<result column="APP_NAME" property="appName" jdbcType="CHAR" />
|
<result column="HEATH_URL" property="heathUrl" jdbcType="CHAR" />
|
<result column="HEATH_STATUS" property="heathStatus" jdbcType="CHAR" />
|
<result column="RES_TIMES" property="resTimes" jdbcType="INTEGER" />
|
<result column="ACTIVE" property="active" jdbcType="CHAR" />
|
<result column="RES_KEYWORD" property="resKeyword" jdbcType="CHAR" />
|
<result column="RES_NO_KEYWORD" property="resNoKeyword" jdbcType="CHAR" />
|
<result column="METHOD" property="method" jdbcType="CHAR" />
|
<result column="POST_STR" property="postStr" jdbcType="CHAR" />
|
<result column="HEADER_JSON" property="headerJson" jdbcType="CHAR" />
|
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="ACCOUNT" property="account" jdbcType="CHAR" />
|
</resultMap>
|
|
<sql id="tableColumnList">
|
ID,APP_NAME, HEATH_URL,HEATH_STATUS,CREATE_TIME,RES_TIMES,ACTIVE,RES_KEYWORD,RES_NO_KEYWORD,METHOD,POST_STR,HEADER_JSON,ACCOUNT
|
</sql>
|
|
<sql id="queryByParams">
|
<if test="appName != null">
|
<choose>
|
<when test="_databaseId == 'oracle'">
|
<![CDATA[ AND APP_NAME LIKE CONCAT(CONCAT('%',#{appName}),'%') ]]>
|
</when>
|
<otherwise>
|
<![CDATA[ AND APP_NAME LIKE CONCAT('%',#{appName},'%') ]]>
|
</otherwise>
|
</choose>
|
</if>
|
<if test="heathStatus != null">
|
<![CDATA[ AND HEATH_STATUS = #{heathStatus} ]]>
|
</if>
|
<if test="startTime != null and endTime !=null and startTime !='' and endTime != '' ">
|
<if test="_databaseId == 'mysql'">
|
<![CDATA[ AND CREATE_TIME >= #{startTime} and CREATE_TIME <=#{endTime}]]>
|
</if>
|
<if test="_databaseId == 'postgresql'">
|
<![CDATA[ AND CREATE_TIME >= cast(#{startTime} as timestamp) and CREATE_TIME <= cast(#{endTime} as timestamp)]]>
|
</if>
|
<if test="_databaseId == 'oracle'">
|
<![CDATA[ AND CREATE_TIME >= to_date(#{startTime},'yyyy-MM-dd hh24:mi:ss') and CREATE_TIME <= to_date(#{endTime},'yyyy-MM-dd hh24:mi:ss')]]>
|
</if>
|
</if>
|
<if test="active != null">
|
<![CDATA[ AND ACTIVE = #{active} ]]>
|
</if>
|
<if test="account != null">
|
<![CDATA[ AND ACCOUNT = #{account} ]]>
|
</if>
|
<if test="heathNames != null">
|
<![CDATA[ AND APP_NAME IN ]]>
|
<foreach item="item" index="index" collection="heathNames" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</sql>
|
|
<select id="selectById" resultMap="resultMap" parameterType="java.lang.String">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM HEATH_MONITOR
|
WHERE ID=#{id}
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
DELETE FROM HEATH_MONITOR
|
WHERE ID = #{id}
|
</delete>
|
|
|
<delete id="deleteById" parameterType="java.lang.String">
|
DELETE FROM
|
HEATH_MONITOR
|
WHERE ID IN
|
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<insert id="save" parameterType="com.wgcloud.entity.HeathMonitor">
|
INSERT INTO HEATH_MONITOR
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null" >ID,</if>
|
<if test="appName != null">APP_NAME,</if>
|
<if test="heathUrl != null">HEATH_URL,</if>
|
<if test="heathStatus != null">HEATH_STATUS,</if>
|
<if test="resTimes != null">RES_TIMES,</if>
|
<if test="active != null">ACTIVE,</if>
|
<if test="resKeyword != null">RES_KEYWORD,</if>
|
<if test="resNoKeyword != null">RES_NO_KEYWORD,</if>
|
<if test="method != null">METHOD,</if>
|
<if test="postStr != null">POST_STR,</if>
|
<if test="headerJson != null">HEADER_JSON,</if>
|
<if test="account != null">ACCOUNT,</if>
|
<if test="createTime != null" >CREATE_TIME</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null" >#{id},</if>
|
<if test="appName != null" >#{appName},</if>
|
<if test="heathUrl != null" >#{heathUrl},</if>
|
<if test="heathStatus != null" >#{heathStatus},</if>
|
<if test="resTimes != null" >#{resTimes},</if>
|
<if test="active != null" >#{active},</if>
|
<if test="resKeyword != null" >#{resKeyword},</if>
|
<if test="resNoKeyword != null" >#{resNoKeyword},</if>
|
<if test="method != null" >#{method},</if>
|
<if test="postStr != null" >#{postStr},</if>
|
<if test="headerJson != null" >#{headerJson},</if>
|
<if test="account != null" >#{account},</if>
|
<if test="createTime != null" >#{createTime}</if>
|
</trim>
|
</insert>
|
|
<insert id="insertList" parameterType="java.util.List" >
|
<choose>
|
<when test="_databaseId == 'oracle'">
|
begin
|
<foreach collection="list" item="item" index="index">
|
INSERT INTO HEATH_MONITOR (ID,APP_NAME,HEATH_URL,HEATH_STATUS,CREATE_TIME,RES_TIMES,ACTIVE,RES_KEYWORD,RES_NO_KEYWORD,METHOD,POST_STR,HEADER_JSON,ACCOUNT) VALUES
|
(#{item.id},#{item.appName},#{item.heathUrl},#{item.heathStatus},#{item.createTime},#{item.resTimes},#{item.active},#{item.resKeyword},#{resNoKeyword},#{item.method},#{item.postStr},#{item.headerJson},#{item.account});
|
</foreach>
|
end;
|
</when>
|
<otherwise>
|
INSERT INTO HEATH_MONITOR (ID,APP_NAME,HEATH_URL,HEATH_STATUS,CREATE_TIME,RES_TIMES,ACTIVE,RES_KEYWORD,RES_NO_KEYWORD,METHOD,POST_STR,HEADER_JSON,ACCOUNT) VALUES
|
<foreach collection="list" item="item" index="index" separator="," >
|
(#{item.id},#{item.appName},#{item.heathUrl},#{item.heathStatus},#{item.createTime},#{item.resTimes},#{item.active},#{item.resKeyword},#{resNoKeyword},#{item.method},#{item.postStr},#{item.headerJson},#{item.account})
|
</foreach>
|
</otherwise>
|
</choose>
|
</insert>
|
|
|
<update id="updateList" parameterType="java.util.List" >
|
<if test="_databaseId == 'oracle'">
|
begin
|
</if>
|
<foreach collection="list" item="item" index="index">
|
UPDATE HEATH_MONITOR
|
<set>
|
<if test="item.appName != null">
|
APP_NAME = #{item.appName},
|
</if>
|
<if test="item.heathUrl != null">
|
HEATH_URL= #{item.heathUrl},
|
</if>
|
<if test="item.heathStatus != null" >
|
HEATH_STATUS= #{item.heathStatus},
|
</if>
|
<if test="item.resTimes != null" >
|
RES_TIMES= #{item.resTimes},
|
</if>
|
<if test="item.active != null" >
|
ACTIVE= #{item.active},
|
</if>
|
<if test="item.resKeyword != null" >
|
RES_KEYWORD= #{item.resKeyword},
|
</if>
|
<if test="item.resNoKeyword != null" >
|
RES_NO_KEYWORD= #{item.resNoKeyword},
|
</if>
|
<if test="item.method != null" >
|
METHOD= #{item.method},
|
</if>
|
<if test="item.postStr != null" >
|
POST_STR= #{item.postStr},
|
</if>
|
<if test="item.headerJson != null" >
|
HEADER_JSON= #{item.headerJson},
|
</if>
|
<if test="item.createTime != null" >
|
CREATE_TIME= #{item.createTime},
|
</if>
|
</set>
|
WHERE ID = #{item.id};
|
</foreach>
|
<if test="_databaseId == 'oracle'">
|
end;
|
</if>
|
</update>
|
|
|
<update id="updateById" parameterType="com.wgcloud.entity.HeathMonitor">
|
UPDATE HEATH_MONITOR
|
<set>
|
<if test="appName != null">
|
APP_NAME = #{appName},
|
</if>
|
<if test="heathUrl != null">
|
HEATH_URL = #{heathUrl},
|
</if>
|
<if test="heathStatus != null">
|
HEATH_STATUS = #{heathStatus},
|
</if>
|
<if test="resTimes != null">
|
RES_TIMES = #{resTimes},
|
</if>
|
<if test="active != null">
|
ACTIVE = #{active},
|
</if>
|
<if test="resKeyword != null">
|
RES_KEYWORD = #{resKeyword},
|
</if>
|
<if test="resNoKeyword != null">
|
RES_NO_KEYWORD = #{resNoKeyword},
|
</if>
|
<if test="method != null">
|
METHOD = #{method},
|
</if>
|
<if test="postStr != null">
|
POST_STR = #{postStr},
|
</if>
|
<if test="headerJson != null">
|
HEADER_JSON = #{headerJson},
|
</if>
|
<if test="createTime != null">
|
CREATE_TIME = #{createTime}
|
</if>
|
</set>
|
WHERE ID = #{id}
|
</update>
|
|
<select id="countByParams" parameterType="map" resultType="java.lang.Integer">
|
SELECT count(*) FROM HEATH_MONITOR t
|
<where>
|
<include refid="queryByParams" />
|
</where>
|
</select>
|
|
|
<select id="selectAllByParams" parameterType="map" resultMap="resultMap">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM HEATH_MONITOR t
|
<where>
|
<include refid="queryByParams" />
|
</where>
|
ORDER BY ID DESC
|
</select>
|
|
<select id="selectByParams" parameterType="map" resultMap="resultMap">
|
SELECT
|
<include refid="tableColumnList" />
|
FROM HEATH_MONITOR
|
<where>
|
<include refid="queryByParams" />
|
</where>
|
<choose>
|
<when test="orderBy !=null and orderBy != ''">
|
<![CDATA[ ORDER BY ${orderBy} ${orderType}]]>
|
</when>
|
<otherwise>
|
ORDER BY ID DESC
|
</otherwise>
|
</choose>
|
</select>
|
|
|
</mapper>
|