parent
72cac90ab1
commit
2354e75535
|
@ -1,158 +1,158 @@
|
|||
<?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.dispose.mapper.DeviceTaskMapper">
|
||||
<resultMap id="device_task" type="com.dispose.pojo.entity.DeviceTask">
|
||||
<id column="id" property="id"/>
|
||||
<result column="taskId" property="taskId"/>
|
||||
<result column="deviceId" property="deviceId"/>
|
||||
<result column="beginTime" property="beginTime"/>
|
||||
<result column="endTime" property="endTime"/>
|
||||
<result column="taskAttackType" property="taskAttackType"/>
|
||||
<result column="execAttackTypeIn" property="execAttackTypeIn"/>
|
||||
<result column="attackTypeStatusIn" property="attackTypeStatusIn"/>
|
||||
<result column="execAttackTypeOut" property="execAttackTypeOut"/>
|
||||
<result column="attackTypeStatusOut" property="attackTypeStatusOut"/>
|
||||
<result column="externId" property="externId"/>
|
||||
<result column="errRetry" property="errRetry"/>
|
||||
<result column="devStatus" property="devStatus"/>
|
||||
<result column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAll" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
</select>
|
||||
|
||||
<insert id="addNewTaskInfoList" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DeviceTask">
|
||||
INSERT IGNORE INTO device_task(taskId, deviceId, taskAttackType, status, devStatus)
|
||||
VALUES
|
||||
<foreach collection="taskLists" item="task" separator=",">
|
||||
(#{task.taskId}, #{task.deviceId}, #{task.taskAttackType},
|
||||
${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}, -1)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="addNewTaskInfo" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DeviceTask">
|
||||
INSERT IGNORE INTO device_task(taskId, deviceId, taskAttackType, status, devStatus)
|
||||
VALUES (#{taskId}, #{deviceId}, #{taskAttackType},
|
||||
${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}, -1)
|
||||
</insert>
|
||||
|
||||
<select id="getTaskInfoById" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE id = #{id, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="getTaskInfoByTaskId" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE taskId = #{taskId, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="getNewTaskInfos" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
<choose>
|
||||
<when test="status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED">
|
||||
WHERE CURRENT_TIMESTAMP - endTime > 300
|
||||
</when>
|
||||
<otherwise>
|
||||
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getRunningTaskInfos" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
<choose>
|
||||
<when test="status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED">
|
||||
WHERE CURRENT_TIMESTAMP - endTime > 300
|
||||
</when>
|
||||
<otherwise>
|
||||
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTING.getValue()}
|
||||
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTED.getValue()}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getTaskByDetails" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE taskId = #{taskId, jdbcType=INTEGER}
|
||||
AND deviceId = #{deviceId, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<update id="changeTaskStatus">
|
||||
UPDATE device_task
|
||||
SET status = #{status}
|
||||
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_FINISHED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_CANCELED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_EXPIRED">
|
||||
, endTime = CURRENT_TIMESTAMP
|
||||
</if>
|
||||
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_STARTING">
|
||||
, beginTime = CURRENT_TIMESTAMP
|
||||
</if>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeTaskDevStatus">
|
||||
UPDATE device_task
|
||||
SET devStatus = #{devStatus}
|
||||
WHERE id = #{id}
|
||||
AND devStatus != #{devStatus}
|
||||
</update>
|
||||
|
||||
<update id="changeExecAttackTypeInValue">
|
||||
UPDATE device_task
|
||||
SET execAttackTypeIn = #{attackTypeValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeExecAttackTypeOutValue">
|
||||
UPDATE device_task
|
||||
SET execAttackTypeOut = #{attackTypeValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeAttackTypeStatusInValue">
|
||||
UPDATE device_task
|
||||
SET attackTypeStatusIn = #{attackStatsValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeAttackTypeStatusOutValue">
|
||||
UPDATE device_task
|
||||
SET attackTypeStatusOut = #{attackStatsValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeErrRetry">
|
||||
UPDATE device_task
|
||||
SET errRetry = #{errRetry}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeExternId">
|
||||
UPDATE device_task
|
||||
SET externId = #{externId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getTransitionStatusTaskInfos" resultType="com.dispose.pojo.entity.DeviceTask">
|
||||
SELECT dt.*, dd.*
|
||||
FROM device_task dt
|
||||
LEFT JOIN dispose_device dd ON dt.deviceId = dd.id
|
||||
WHERE dd.deviceType = ${@com.dispose.common.DisposeDeviceType@CMHI_PLATFORM.getValue()}
|
||||
AND dt.devStatus != ${@com.cmhi.dispose.common.CmhiDisposeTaskStatus@TASK_FINISHED_USER.getValue()}
|
||||
AND dt.devStatus != ${@com.cmhi.dispose.common.CmhiDisposeTaskStatus@TASK_FINISHED_TIME.getValue()}
|
||||
AND dt.devStatus != ${@com.cmhi.dispose.common.CmhiDisposeTaskStatus@TASK_REVIEWED_FAILED.getValue()}
|
||||
</select>
|
||||
<?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.dispose.mapper.DeviceTaskMapper">
|
||||
<resultMap id="device_task" type="com.dispose.pojo.entity.DeviceTask">
|
||||
<id column="id" property="id"/>
|
||||
<result column="taskId" property="taskId"/>
|
||||
<result column="deviceId" property="deviceId"/>
|
||||
<result column="beginTime" property="beginTime"/>
|
||||
<result column="endTime" property="endTime"/>
|
||||
<result column="taskAttackType" property="taskAttackType"/>
|
||||
<result column="execAttackTypeIn" property="execAttackTypeIn"/>
|
||||
<result column="attackTypeStatusIn" property="attackTypeStatusIn"/>
|
||||
<result column="execAttackTypeOut" property="execAttackTypeOut"/>
|
||||
<result column="attackTypeStatusOut" property="attackTypeStatusOut"/>
|
||||
<result column="externId" property="externId"/>
|
||||
<result column="errRetry" property="errRetry"/>
|
||||
<result column="devStatus" property="devStatus"/>
|
||||
<result column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAll" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
</select>
|
||||
|
||||
<insert id="addNewTaskInfoList" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DeviceTask">
|
||||
INSERT IGNORE INTO device_task(taskId, deviceId, taskAttackType, status, devStatus)
|
||||
VALUES
|
||||
<foreach collection="taskLists" item="task" separator=",">
|
||||
(#{task.taskId}, #{task.deviceId}, #{task.taskAttackType},
|
||||
${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}, -1)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="addNewTaskInfo" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DeviceTask">
|
||||
INSERT IGNORE INTO device_task(taskId, deviceId, taskAttackType, status, devStatus)
|
||||
VALUES (#{taskId}, #{deviceId}, #{taskAttackType},
|
||||
${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}, -1)
|
||||
</insert>
|
||||
|
||||
<select id="getTaskInfoById" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE id = #{id, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="getTaskInfoByTaskId" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE taskId = #{taskId, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="getNewTaskInfos" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
<choose>
|
||||
<when test="status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED">
|
||||
WHERE CURRENT_TIMESTAMP - endTime > 300
|
||||
</when>
|
||||
<otherwise>
|
||||
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getRunningTaskInfos" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
<choose>
|
||||
<when test="status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED">
|
||||
WHERE CURRENT_TIMESTAMP - endTime > 300
|
||||
</when>
|
||||
<otherwise>
|
||||
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTING.getValue()}
|
||||
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTED.getValue()}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getTaskByDetails" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE taskId = #{taskId, jdbcType=INTEGER}
|
||||
AND deviceId = #{deviceId, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<update id="changeTaskStatus">
|
||||
UPDATE device_task
|
||||
SET status = #{status}
|
||||
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_FINISHED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_CANCELED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_EXPIRED">
|
||||
, endTime = CURRENT_TIMESTAMP
|
||||
</if>
|
||||
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_STARTING">
|
||||
, beginTime = CURRENT_TIMESTAMP
|
||||
</if>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeTaskDevStatus">
|
||||
UPDATE device_task
|
||||
SET devStatus = #{devStatus}
|
||||
WHERE id = #{id}
|
||||
AND devStatus != #{devStatus}
|
||||
</update>
|
||||
|
||||
<update id="changeExecAttackTypeInValue">
|
||||
UPDATE device_task
|
||||
SET execAttackTypeIn = #{attackTypeValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeExecAttackTypeOutValue">
|
||||
UPDATE device_task
|
||||
SET execAttackTypeOut = #{attackTypeValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeAttackTypeStatusInValue">
|
||||
UPDATE device_task
|
||||
SET attackTypeStatusIn = #{attackStatsValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeAttackTypeStatusOutValue">
|
||||
UPDATE device_task
|
||||
SET attackTypeStatusOut = #{attackStatsValue}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeErrRetry">
|
||||
UPDATE device_task
|
||||
SET errRetry = #{errRetry}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="changeExternId">
|
||||
UPDATE device_task
|
||||
SET externId = #{externId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getTransitionStatusTaskInfos" resultType="com.dispose.pojo.entity.DeviceTask">
|
||||
SELECT dt.*, dd.*
|
||||
FROM device_task dt
|
||||
LEFT JOIN dispose_device dd ON dt.deviceId = dd.id
|
||||
WHERE dd.deviceType = ${@com.dispose.common.DisposeDeviceType@CMHI_PLATFORM.getValue()}
|
||||
AND dt.devStatus != ${@com.cmhi.dispose.common.CmhiDisposeTaskStatus@TASK_FINISHED_USER.getValue()}
|
||||
AND dt.devStatus != ${@com.cmhi.dispose.common.CmhiDisposeTaskStatus@TASK_FINISHED_TIME.getValue()}
|
||||
AND dt.devStatus != ${@com.cmhi.dispose.common.CmhiDisposeTaskStatus@TASK_REVIEWED_FAILED.getValue()}
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,47 +1,47 @@
|
|||
<?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.dispose.mapper.DisposeCapacityMapper">
|
||||
<resultMap id="dispose_capacity" type="com.dispose.pojo.entity.DisposeCapacity">
|
||||
<id column="id" property="id"/>
|
||||
<id column = "deviceId" property="deviceId"/>
|
||||
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>
|
||||
<result column="protectIp" property="protectIp"/>
|
||||
<result column="reserveNetflow" property="reserveNetflow"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAll" resultMap="dispose_capacity">
|
||||
SELECT *
|
||||
FROM dispose_capacity
|
||||
</select>
|
||||
|
||||
<insert id="addNewDisposeCapacity" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DisposeCapacity">
|
||||
INSERT IGNORE INTO dispose_capacity(deviceId, capacityType, objectType, ipType, protectIp, reserveNetflow)
|
||||
VALUES
|
||||
<foreach collection="devCaps" item="cap" separator=",">
|
||||
(#{cap.deviceId}, #{cap.capacityType}, #{cap.objectType}, #{cap.ipType},
|
||||
#{cap.protectIp}, #{cap.reserveNetflow})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="delDisposeCapacity">
|
||||
DELETE
|
||||
FROM dispose_capacity
|
||||
WHERE dispose_capacity.deviceId = #{deviceId}
|
||||
AND dispose_capacity.capacityType = #{capacityType}
|
||||
</delete>
|
||||
|
||||
<delete id="delDeviceDisposeCapacity">
|
||||
DELETE
|
||||
FROM dispose_capacity
|
||||
WHERE dispose_capacity.deviceId = #{deviceId}
|
||||
</delete>
|
||||
|
||||
<select id="getDeviceDisposeCapacity" resultMap="dispose_capacity">
|
||||
SELECT *
|
||||
FROM dispose_capacity
|
||||
WHERE dispose_capacity.deviceId = #{deviceId}
|
||||
</select>
|
||||
<?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.dispose.mapper.DisposeCapacityMapper">
|
||||
<resultMap id="dispose_capacity" type="com.dispose.pojo.entity.DisposeCapacity">
|
||||
<id column="id" property="id"/>
|
||||
<id column = "deviceId" property="deviceId"/>
|
||||
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>
|
||||
<result column="protectIp" property="protectIp"/>
|
||||
<result column="reserveNetflow" property="reserveNetflow"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAll" resultMap="dispose_capacity">
|
||||
SELECT *
|
||||
FROM dispose_capacity
|
||||
</select>
|
||||
|
||||
<insert id="addNewDisposeCapacity" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DisposeCapacity">
|
||||
INSERT IGNORE INTO dispose_capacity(deviceId, capacityType, objectType, ipType, protectIp, reserveNetflow)
|
||||
VALUES
|
||||
<foreach collection="devCaps" item="cap" separator=",">
|
||||
(#{cap.deviceId}, #{cap.capacityType}, #{cap.objectType}, #{cap.ipType},
|
||||
#{cap.protectIp}, #{cap.reserveNetflow})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="delDisposeCapacity">
|
||||
DELETE
|
||||
FROM dispose_capacity
|
||||
WHERE dispose_capacity.deviceId = #{deviceId}
|
||||
AND dispose_capacity.capacityType = #{capacityType}
|
||||
</delete>
|
||||
|
||||
<delete id="delDeviceDisposeCapacity">
|
||||
DELETE
|
||||
FROM dispose_capacity
|
||||
WHERE dispose_capacity.deviceId = #{deviceId}
|
||||
</delete>
|
||||
|
||||
<select id="getDeviceDisposeCapacity" resultMap="dispose_capacity">
|
||||
SELECT *
|
||||
FROM dispose_capacity
|
||||
WHERE dispose_capacity.deviceId = #{deviceId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,162 +1,162 @@
|
|||
<?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.dispose.mapper.DisposeDeviceMapper">
|
||||
<resultMap id="dispose_device" type="com.dispose.pojo.entity.DisposeDevice">
|
||||
<id column="id" property="id"/>
|
||||
<result column="ipAddr" property="ipAddr"/>
|
||||
<result column="ipPort" property="ipPort"/>
|
||||
<result column="deviceType" property="deviceType" javaType="com.dispose.common.DisposeDeviceType"/>
|
||||
<result column="areaCode" property="areaCode"/>
|
||||
<result column="deviceName" property="deviceName"/>
|
||||
<result column="manufacturer" property="manufacturer"/>
|
||||
<result column="model" property="model"/>
|
||||
<result column="version" property="version"/>
|
||||
<result column="userName" property="userName"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="urlPath" property="urlPath"/>
|
||||
<result column="urlType" property="urlType" javaType="com.dispose.common.HttpType"/>
|
||||
<result column="readme" property="readme"/>
|
||||
<result column="status" property="status" javaType="com.dispose.common.ObjectStatus"/>
|
||||
<collection property="devCapacity" ofType="com.dispose.pojo.entity.DisposeCapacity">
|
||||
<id column="c_id" property="id"/>
|
||||
<result column="deviceId" property="deviceId"/>
|
||||
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>
|
||||
<result column="protectIp" property="protectIp"/>
|
||||
<result column="reserveNetflow" property="reserveNetflow"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectPageAll" resultType="com.dispose.pojo.entity.DisposeDevice">
|
||||
SELECT *
|
||||
FROM dispose_device d
|
||||
</select>
|
||||
|
||||
<select id="selectByIdSet" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.id c_id,
|
||||
c.deviceId deviceId,
|
||||
c.capacityType capacityType,
|
||||
c.objectType objectType,
|
||||
c.ipType ipType,
|
||||
c.protectIp protectIp,
|
||||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.id IN
|
||||
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.id c_id,
|
||||
c.deviceId deviceId,
|
||||
c.capacityType capacityType,
|
||||
c.objectType objectType,
|
||||
c.ipType ipType,
|
||||
c.protectIp protectIp,
|
||||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByAddrAndType" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.*
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.ipAddr = #{ipAddr}
|
||||
AND d.ipPort = #{ipPort}
|
||||
AND d.deviceType = #{devType}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByIpAndType" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.*
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.ipAddr = #{ipAddr}
|
||||
AND d.deviceType = #{devType}
|
||||
AND d.status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceById" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.*
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DisposeDevice">
|
||||
INSERT IGNORE INTO dispose_device(ipAddr, ipPort, deviceType,
|
||||
areaCode, deviceName, manufacturer,
|
||||
model, version, userName, password, urlPath, urlType, readme, status)
|
||||
VALUES (#{ipAddr}, #{ipPort}, #{deviceType},
|
||||
#{areaCode}, #{deviceName}, #{manufacturer},
|
||||
#{model}, #{version}, #{userName}, #{password}, #{urlPath}, #{urlType}, #{readme},
|
||||
${@com.dispose.common.ObjectStatus@NORMAL.getValue()})
|
||||
</insert>
|
||||
|
||||
<update id="delDisposeDevice">
|
||||
UPDATE dispose_device
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getValue()}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="upgradeDisposeDevice" parameterType="com.dispose.pojo.entity.DisposeDevice">
|
||||
UPDATE dispose_device
|
||||
SET ipAddr = #{ipAddr},
|
||||
ipPort = #{ipPort},
|
||||
deviceType = #{deviceType},
|
||||
areaCode = #{areaCode},
|
||||
deviceName = #{deviceName},
|
||||
manufacturer = #{manufacturer},
|
||||
model = #{model},
|
||||
version = #{version},
|
||||
userName = #{userName},
|
||||
password = #{password},
|
||||
urlPath = #{urlPath},
|
||||
urlType = #{urlType},
|
||||
readme = #{readme},
|
||||
status = #{status}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="disableDisposeDevice">
|
||||
UPDATE
|
||||
dispose_device
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getValue()}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="availableDisposeDevice">
|
||||
UPDATE
|
||||
dispose_device
|
||||
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getDeviceByAreaCode" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.id c_id,
|
||||
c.deviceId deviceId,
|
||||
c.capacityType capacityType,
|
||||
c.objectType objectType,
|
||||
c.ipType ipType,
|
||||
c.protectIp protectIp,
|
||||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
<if test="areaCode != -1">
|
||||
WHERE d.areaCode = #{areaCode}
|
||||
<if test="id != -1">
|
||||
AND d.id = #{id}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
<?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.dispose.mapper.DisposeDeviceMapper">
|
||||
<resultMap id="dispose_device" type="com.dispose.pojo.entity.DisposeDevice">
|
||||
<id column="id" property="id"/>
|
||||
<result column="ipAddr" property="ipAddr"/>
|
||||
<result column="ipPort" property="ipPort"/>
|
||||
<result column="deviceType" property="deviceType" javaType="com.dispose.common.DisposeDeviceType"/>
|
||||
<result column="areaCode" property="areaCode"/>
|
||||
<result column="deviceName" property="deviceName"/>
|
||||
<result column="manufacturer" property="manufacturer"/>
|
||||
<result column="model" property="model"/>
|
||||
<result column="version" property="version"/>
|
||||
<result column="userName" property="userName"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="urlPath" property="urlPath"/>
|
||||
<result column="urlType" property="urlType" javaType="com.dispose.common.HttpType"/>
|
||||
<result column="readme" property="readme"/>
|
||||
<result column="status" property="status" javaType="com.dispose.common.ObjectStatus"/>
|
||||
<collection property="devCapacity" ofType="com.dispose.pojo.entity.DisposeCapacity">
|
||||
<id column="c_id" property="id"/>
|
||||
<result column="deviceId" property="deviceId"/>
|
||||
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>
|
||||
<result column="protectIp" property="protectIp"/>
|
||||
<result column="reserveNetflow" property="reserveNetflow"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectPageAll" resultType="com.dispose.pojo.entity.DisposeDevice">
|
||||
SELECT *
|
||||
FROM dispose_device d
|
||||
</select>
|
||||
|
||||
<select id="selectByIdSet" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.id c_id,
|
||||
c.deviceId deviceId,
|
||||
c.capacityType capacityType,
|
||||
c.objectType objectType,
|
||||
c.ipType ipType,
|
||||
c.protectIp protectIp,
|
||||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.id IN
|
||||
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.id c_id,
|
||||
c.deviceId deviceId,
|
||||
c.capacityType capacityType,
|
||||
c.objectType objectType,
|
||||
c.ipType ipType,
|
||||
c.protectIp protectIp,
|
||||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByAddrAndType" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.*
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.ipAddr = #{ipAddr}
|
||||
AND d.ipPort = #{ipPort}
|
||||
AND d.deviceType = #{devType}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByIpAndType" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.*
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.ipAddr = #{ipAddr}
|
||||
AND d.deviceType = #{devType}
|
||||
AND d.status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceById" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.*
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DisposeDevice">
|
||||
INSERT IGNORE INTO dispose_device(ipAddr, ipPort, deviceType,
|
||||
areaCode, deviceName, manufacturer,
|
||||
model, version, userName, password, urlPath, urlType, readme, status)
|
||||
VALUES (#{ipAddr}, #{ipPort}, #{deviceType},
|
||||
#{areaCode}, #{deviceName}, #{manufacturer},
|
||||
#{model}, #{version}, #{userName}, #{password}, #{urlPath}, #{urlType}, #{readme},
|
||||
${@com.dispose.common.ObjectStatus@NORMAL.getValue()})
|
||||
</insert>
|
||||
|
||||
<update id="delDisposeDevice">
|
||||
UPDATE dispose_device
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getValue()}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="upgradeDisposeDevice" parameterType="com.dispose.pojo.entity.DisposeDevice">
|
||||
UPDATE dispose_device
|
||||
SET ipAddr = #{ipAddr},
|
||||
ipPort = #{ipPort},
|
||||
deviceType = #{deviceType},
|
||||
areaCode = #{areaCode},
|
||||
deviceName = #{deviceName},
|
||||
manufacturer = #{manufacturer},
|
||||
model = #{model},
|
||||
version = #{version},
|
||||
userName = #{userName},
|
||||
password = #{password},
|
||||
urlPath = #{urlPath},
|
||||
urlType = #{urlType},
|
||||
readme = #{readme},
|
||||
status = #{status}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="disableDisposeDevice">
|
||||
UPDATE
|
||||
dispose_device
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getValue()}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="availableDisposeDevice">
|
||||
UPDATE
|
||||
dispose_device
|
||||
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getDeviceByAreaCode" resultMap="dispose_device">
|
||||
SELECT d.*,
|
||||
c.id c_id,
|
||||
c.deviceId deviceId,
|
||||
c.capacityType capacityType,
|
||||
c.objectType objectType,
|
||||
c.ipType ipType,
|
||||
c.protectIp protectIp,
|
||||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
<if test="areaCode != -1">
|
||||
WHERE d.areaCode = #{areaCode}
|
||||
<if test="id != -1">
|
||||
AND d.id = #{id}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -1,192 +1,192 @@
|
|||
<?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.dispose.mapper.DisposeTaskMapper">
|
||||
<resultMap id="dispose_task_map" type="com.dispose.pojo.entity.DisposeTask">
|
||||
<id column="id" property="id"/>
|
||||
<id column="deviceId" property="deviceId"/>
|
||||
<id column="accountId" property="accountId"/>
|
||||
<result column="areaCode" property="areaCode"/>
|
||||
<result column="disposeCapacity" property="disposeCapacity" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||
<result column="disposeObject" property="disposeObject"/>
|
||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||
<result column="createTime" property="createTime"/>
|
||||
<result column="planEndTime" property="planEndTime"/>
|
||||
<result column="endTime" property="endTime"/>
|
||||
<result column="flowDirection" property="flowDirection" javaType="com.dispose.common.NetflowDirection"/>
|
||||
<result column="attackType" property="attackType"/>
|
||||
<result column="flowBandWidth" property="flowBandWidth"/>
|
||||
<result column="currentStatus" property="currentStatus" javaType="com.dispose.common.DisposeTaskStatus"/>
|
||||
<collection property="deviceTask" ofType="com.dispose.pojo.entity.DeviceTask">
|
||||
<id column="t_id" property="id"/>
|
||||
<result column="taskId" property="taskId"/>
|
||||
<result column="t_deviceId" property="deviceId"/>
|
||||
<result column="beginTime" property="beginTime"/>
|
||||
<result column="t_endTime" property="endTime"/>
|
||||
<result column="taskAttackType" property="taskAttackType"/>
|
||||
<result column="execAttackTypeIn" property="execAttackTypeIn"/>
|
||||
<result column="attackTypeStatusIn" property="attackTypeStatusIn"/>
|
||||
<result column="execAttackTypeOut" property="execAttackTypeOut"/>
|
||||
<result column="attackTypeStatusOut" property="attackTypeStatusOut"/>
|
||||
<result column="externId" property="externId"/>
|
||||
<result column="errRetry" property="errRetry"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="devStatus" property="devStatus"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectPageAll" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task d
|
||||
</select>
|
||||
|
||||
<select id="selectPageById" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task d
|
||||
WHERE id IN
|
||||
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByIdSet" resultMap="dispose_task_map">
|
||||
SELECT dt.*,
|
||||
ti.id t_id,
|
||||
ti.taskId taskId,
|
||||
ti.deviceId t_deviceId,
|
||||
ti.beginTime beginTime,
|
||||
ti.endTime t_endTime,
|
||||
ti.taskAttackType taskAttackType,
|
||||
ti.execAttackTypeIn execAttackTypeIn,
|
||||
ti.attackTypeStatusIn attackTypeStatusIn,
|
||||
ti.execAttackTypeOut execAttackTypeOut,
|
||||
ti.attackTypeStatusOut attackTypeStatusOut,
|
||||
ti.externId externId,
|
||||
ti.errRetry errRetry,
|
||||
ti.devStatus devStatus,
|
||||
ti.status status
|
||||
FROM dispose_task dt
|
||||
LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
WHERE dt.id IN
|
||||
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="dispose_task_map">
|
||||
SELECT dt.*,
|
||||
ti.id t_id,
|
||||
ti.taskId taskId,
|
||||
ti.deviceId t_deviceId,
|
||||
ti.beginTime beginTime,
|
||||
ti.endTime t_endTime,
|
||||
ti.taskAttackType taskAttackType,
|
||||
ti.execAttackTypeIn execAttackTypeIn,
|
||||
ti.attackTypeStatusIn attackTypeStatusIn,
|
||||
ti.execAttackTypeOut execAttackTypeOut,
|
||||
ti.attackTypeStatusOut attackTypeStatusOut,
|
||||
ti.externId externId,
|
||||
ti.errRetry errRetry,
|
||||
ti.devStatus devStatus,
|
||||
ti.status status
|
||||
FROM dispose_task dt
|
||||
LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
</select>
|
||||
|
||||
<select id="getDisposeTaskById" resultMap="dispose_task_map">
|
||||
SELECT dt.*,
|
||||
ti.id t_id,
|
||||
ti.taskId taskId,
|
||||
ti.deviceId t_deviceId,
|
||||
ti.beginTime beginTime,
|
||||
ti.endTime t_endTime,
|
||||
ti.taskAttackType taskAttackType,
|
||||
ti.execAttackTypeIn execAttackTypeIn,
|
||||
ti.attackTypeStatusIn attackTypeStatusIn,
|
||||
ti.execAttackTypeOut execAttackTypeOut,
|
||||
ti.attackTypeStatusOut attackTypeStatusOut,
|
||||
ti.externId externId,
|
||||
ti.errRetry errRetry,
|
||||
ti.devStatus devStatus,
|
||||
ti.status status
|
||||
FROM dispose_task dt
|
||||
LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
WHERE dt.id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="getRunningTask" resultMap="dispose_task_map">
|
||||
SELECT dt.*, ti.*
|
||||
FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
WHERE
|
||||
dt.disposeCapacity = #{capType} AND
|
||||
dt.disposeObject = #{disposeObject} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_START_FAILED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED.getValue()} AND
|
||||
dt.planEndTime > CURRENT_TIMESTAMP()
|
||||
<if test="deviceId != -1">
|
||||
AND dt.deviceId = #{deviceId}
|
||||
</if>
|
||||
<if test="areaCode != -1">
|
||||
AND dt.areaCode = #{areaCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNewTask" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task
|
||||
WHERE currentStatus = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
</select>
|
||||
|
||||
<select id="getUnExpiredTasks" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task
|
||||
WHERE currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()}
|
||||
AND planEndTime > CURRENT_TIMESTAMP()
|
||||
</select>
|
||||
|
||||
<select id="getExpiredTasks" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task
|
||||
WHERE currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()}
|
||||
AND CURRENT_TIMESTAMP() >= planEndTime
|
||||
</select>
|
||||
|
||||
<insert id="addNewTask" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DisposeTask">
|
||||
INSERT IGNORE INTO dispose_task(deviceId, accountId, areaCode, disposeCapacity, disposeObject, objectType,
|
||||
planEndTime, flowDirection, attackType, flowBandWidth,
|
||||
currentStatus)
|
||||
VALUES (#{deviceId}, #{accountId}, #{areaCode}, #{disposeCapacity}, #{disposeObject}, #{objectType},
|
||||
date_add(now(), interval #{planEndTime} MINUTE), #{flowDirection}, #{attackType},
|
||||
#{flowBandWidth}, ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()})
|
||||
</insert>
|
||||
|
||||
<update id="changTaskStatus">
|
||||
UPDATE
|
||||
dispose_task
|
||||
SET
|
||||
currentStatus = #{status}
|
||||
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_FINISHED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_CANCELED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_EXPIRED">
|
||||
, endTime = CURRENT_TIMESTAMP
|
||||
</if>
|
||||
WHERE
|
||||
id = #{id, jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="getTaskStatus" resultType="com.dispose.common.DisposeTaskStatus">
|
||||
SELECT currentStatus
|
||||
FROM dispose_task
|
||||
WHERE id = #{taskId, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<?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.dispose.mapper.DisposeTaskMapper">
|
||||
<resultMap id="dispose_task_map" type="com.dispose.pojo.entity.DisposeTask">
|
||||
<id column="id" property="id"/>
|
||||
<id column="deviceId" property="deviceId"/>
|
||||
<id column="accountId" property="accountId"/>
|
||||
<result column="areaCode" property="areaCode"/>
|
||||
<result column="disposeCapacity" property="disposeCapacity" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||
<result column="disposeObject" property="disposeObject"/>
|
||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||
<result column="createTime" property="createTime"/>
|
||||
<result column="planEndTime" property="planEndTime"/>
|
||||
<result column="endTime" property="endTime"/>
|
||||
<result column="flowDirection" property="flowDirection" javaType="com.dispose.common.NetflowDirection"/>
|
||||
<result column="attackType" property="attackType"/>
|
||||
<result column="flowBandWidth" property="flowBandWidth"/>
|
||||
<result column="currentStatus" property="currentStatus" javaType="com.dispose.common.DisposeTaskStatus"/>
|
||||
<collection property="deviceTask" ofType="com.dispose.pojo.entity.DeviceTask">
|
||||
<id column="t_id" property="id"/>
|
||||
<result column="taskId" property="taskId"/>
|
||||
<result column="t_deviceId" property="deviceId"/>
|
||||
<result column="beginTime" property="beginTime"/>
|
||||
<result column="t_endTime" property="endTime"/>
|
||||
<result column="taskAttackType" property="taskAttackType"/>
|
||||
<result column="execAttackTypeIn" property="execAttackTypeIn"/>
|
||||
<result column="attackTypeStatusIn" property="attackTypeStatusIn"/>
|
||||
<result column="execAttackTypeOut" property="execAttackTypeOut"/>
|
||||
<result column="attackTypeStatusOut" property="attackTypeStatusOut"/>
|
||||
<result column="externId" property="externId"/>
|
||||
<result column="errRetry" property="errRetry"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="devStatus" property="devStatus"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectPageAll" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task d
|
||||
</select>
|
||||
|
||||
<select id="selectPageById" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task d
|
||||
WHERE id IN
|
||||
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByIdSet" resultMap="dispose_task_map">
|
||||
SELECT dt.*,
|
||||
ti.id t_id,
|
||||
ti.taskId taskId,
|
||||
ti.deviceId t_deviceId,
|
||||
ti.beginTime beginTime,
|
||||
ti.endTime t_endTime,
|
||||
ti.taskAttackType taskAttackType,
|
||||
ti.execAttackTypeIn execAttackTypeIn,
|
||||
ti.attackTypeStatusIn attackTypeStatusIn,
|
||||
ti.execAttackTypeOut execAttackTypeOut,
|
||||
ti.attackTypeStatusOut attackTypeStatusOut,
|
||||
ti.externId externId,
|
||||
ti.errRetry errRetry,
|
||||
ti.devStatus devStatus,
|
||||
ti.status status
|
||||
FROM dispose_task dt
|
||||
LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
WHERE dt.id IN
|
||||
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="dispose_task_map">
|
||||
SELECT dt.*,
|
||||
ti.id t_id,
|
||||
ti.taskId taskId,
|
||||
ti.deviceId t_deviceId,
|
||||
ti.beginTime beginTime,
|
||||
ti.endTime t_endTime,
|
||||
ti.taskAttackType taskAttackType,
|
||||
ti.execAttackTypeIn execAttackTypeIn,
|
||||
ti.attackTypeStatusIn attackTypeStatusIn,
|
||||
ti.execAttackTypeOut execAttackTypeOut,
|
||||
ti.attackTypeStatusOut attackTypeStatusOut,
|
||||
ti.externId externId,
|
||||
ti.errRetry errRetry,
|
||||
ti.devStatus devStatus,
|
||||
ti.status status
|
||||
FROM dispose_task dt
|
||||
LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
</select>
|
||||
|
||||
<select id="getDisposeTaskById" resultMap="dispose_task_map">
|
||||
SELECT dt.*,
|
||||
ti.id t_id,
|
||||
ti.taskId taskId,
|
||||
ti.deviceId t_deviceId,
|
||||
ti.beginTime beginTime,
|
||||
ti.endTime t_endTime,
|
||||
ti.taskAttackType taskAttackType,
|
||||
ti.execAttackTypeIn execAttackTypeIn,
|
||||
ti.attackTypeStatusIn attackTypeStatusIn,
|
||||
ti.execAttackTypeOut execAttackTypeOut,
|
||||
ti.attackTypeStatusOut attackTypeStatusOut,
|
||||
ti.externId externId,
|
||||
ti.errRetry errRetry,
|
||||
ti.devStatus devStatus,
|
||||
ti.status status
|
||||
FROM dispose_task dt
|
||||
LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
WHERE dt.id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="getRunningTask" resultMap="dispose_task_map">
|
||||
SELECT dt.*, ti.*
|
||||
FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId
|
||||
WHERE
|
||||
dt.disposeCapacity = #{capType} AND
|
||||
dt.disposeObject = #{disposeObject} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_START_FAILED.getValue()} AND
|
||||
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED.getValue()} AND
|
||||
dt.planEndTime > CURRENT_TIMESTAMP()
|
||||
<if test="deviceId != -1">
|
||||
AND dt.deviceId = #{deviceId}
|
||||
</if>
|
||||
<if test="areaCode != -1">
|
||||
AND dt.areaCode = #{areaCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNewTask" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task
|
||||
WHERE currentStatus = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
</select>
|
||||
|
||||
<select id="getUnExpiredTasks" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task
|
||||
WHERE currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()}
|
||||
AND planEndTime > CURRENT_TIMESTAMP()
|
||||
</select>
|
||||
|
||||
<select id="getExpiredTasks" resultType="com.dispose.pojo.entity.DisposeTask">
|
||||
SELECT *
|
||||
FROM dispose_task
|
||||
WHERE currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()}
|
||||
AND currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()}
|
||||
AND CURRENT_TIMESTAMP() >= planEndTime
|
||||
</select>
|
||||
|
||||
<insert id="addNewTask" useGeneratedKeys="true" keyProperty="id"
|
||||
parameterType="com.dispose.pojo.entity.DisposeTask">
|
||||
INSERT IGNORE INTO dispose_task(deviceId, accountId, areaCode, disposeCapacity, disposeObject, objectType,
|
||||
planEndTime, flowDirection, attackType, flowBandWidth,
|
||||
currentStatus)
|
||||
VALUES (#{deviceId}, #{accountId}, #{areaCode}, #{disposeCapacity}, #{disposeObject}, #{objectType},
|
||||
date_add(now(), interval #{planEndTime} MINUTE), #{flowDirection}, #{attackType},
|
||||
#{flowBandWidth}, ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()})
|
||||
</insert>
|
||||
|
||||
<update id="changTaskStatus">
|
||||
UPDATE
|
||||
dispose_task
|
||||
SET
|
||||
currentStatus = #{status}
|
||||
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_FINISHED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_CANCELED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED
|
||||
or status == @com.dispose.common.DisposeTaskStatus@TASK_EXPIRED">
|
||||
, endTime = CURRENT_TIMESTAMP
|
||||
</if>
|
||||
WHERE
|
||||
id = #{id, jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="getTaskStatus" resultType="com.dispose.common.DisposeTaskStatus">
|
||||
SELECT currentStatus
|
||||
FROM dispose_task
|
||||
WHERE id = #{taskId, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -1,117 +1,117 @@
|
|||
<?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.dispose.mapper.UserAccountMapper">
|
||||
|
||||
<resultMap id="user_account" type="com.dispose.pojo.entity.UserAccount">
|
||||
<id column="id" property="id"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="createTime" property="createTime"/>
|
||||
<result column="operators" property="operators"/>
|
||||
<result column="lastLoginTime" property="lastLoginTime"/>
|
||||
<result column="token" property="token"/>
|
||||
<result column="lastAccess" property="lastAccess"/>
|
||||
<result column="pwdErrTimes" property="pwdErrTimes"/>
|
||||
<result column="lockTime" property="lockTime"/>
|
||||
<result column="status" property="status" javaType="com.dispose.common.ObjectStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAll" resultMap="user_account">
|
||||
SELECT *
|
||||
FROM user_account
|
||||
</select>
|
||||
|
||||
<select id="addUserAccount" resultMap="user_account">
|
||||
INSERT INTO user_account(username, password, operators, status)
|
||||
SELECT #{username}, #{password}, #{operators}, ${@com.dispose.common.ObjectStatus@NORMAL.getValue()}
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS(
|
||||
SELECT username
|
||||
FROM user_account
|
||||
where username = #{username, jdbcType=VARCHAR}
|
||||
);
|
||||
|
||||
SELECT *
|
||||
FROM user_account
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="getUserByName" resultMap="user_account">
|
||||
SELECT *
|
||||
FROM user_account
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="getUserByToken" resultMap="user_account">
|
||||
SELECT *
|
||||
FROM user_account
|
||||
WHERE token = #{token}
|
||||
AND LENGTH(#{token}) > 0
|
||||
</select>
|
||||
|
||||
<update id="upgradeLastAccessTime" >
|
||||
UPDATE
|
||||
user_account
|
||||
SET lastAccess = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR};
|
||||
</update>
|
||||
|
||||
<update id="upgradeLoginTime">
|
||||
UPDATE
|
||||
user_account
|
||||
SET lastLoginTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="upgradeToken">
|
||||
UPDATE
|
||||
user_account
|
||||
SET token = #{token, jdbcType=VARCHAR}
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<select id="setPwdErrTimes" resultType="java.lang.Integer">
|
||||
UPDATE
|
||||
user_account
|
||||
SET pwdErrTimes = #{pwdErrTimes, jdbcType=INTEGER}
|
||||
WHERE username = #{username, jdbcType=VARCHAR};
|
||||
|
||||
SELECT pwdErrTimes
|
||||
FROM user_account
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<update id="delUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getValue()},
|
||||
operators = #{operators},
|
||||
lockTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="disableUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getValue()},
|
||||
operators = #{operators},
|
||||
lockTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="lockUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getValue()},
|
||||
lockTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="unlockUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()},
|
||||
lockTime = 0
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
<?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.dispose.mapper.UserAccountMapper">
|
||||
|
||||
<resultMap id="user_account" type="com.dispose.pojo.entity.UserAccount">
|
||||
<id column="id" property="id"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="createTime" property="createTime"/>
|
||||
<result column="operators" property="operators"/>
|
||||
<result column="lastLoginTime" property="lastLoginTime"/>
|
||||
<result column="token" property="token"/>
|
||||
<result column="lastAccess" property="lastAccess"/>
|
||||
<result column="pwdErrTimes" property="pwdErrTimes"/>
|
||||
<result column="lockTime" property="lockTime"/>
|
||||
<result column="status" property="status" javaType="com.dispose.common.ObjectStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAll" resultMap="user_account">
|
||||
SELECT *
|
||||
FROM user_account
|
||||
</select>
|
||||
|
||||
<select id="addUserAccount" resultMap="user_account">
|
||||
INSERT INTO user_account(username, password, operators, status)
|
||||
SELECT #{username}, #{password}, #{operators}, ${@com.dispose.common.ObjectStatus@NORMAL.getValue()}
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS(
|
||||
SELECT username
|
||||
FROM user_account
|
||||
where username = #{username, jdbcType=VARCHAR}
|
||||
);
|
||||
|
||||
SELECT *
|
||||
FROM user_account
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="getUserByName" resultMap="user_account">
|
||||
SELECT *
|
||||
FROM user_account
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="getUserByToken" resultMap="user_account">
|
||||
SELECT *
|
||||
FROM user_account
|
||||
WHERE token = #{token}
|
||||
AND LENGTH(#{token}) > 0
|
||||
</select>
|
||||
|
||||
<update id="upgradeLastAccessTime" >
|
||||
UPDATE
|
||||
user_account
|
||||
SET lastAccess = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR};
|
||||
</update>
|
||||
|
||||
<update id="upgradeLoginTime">
|
||||
UPDATE
|
||||
user_account
|
||||
SET lastLoginTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="upgradeToken">
|
||||
UPDATE
|
||||
user_account
|
||||
SET token = #{token, jdbcType=VARCHAR}
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<select id="setPwdErrTimes" resultType="java.lang.Integer">
|
||||
UPDATE
|
||||
user_account
|
||||
SET pwdErrTimes = #{pwdErrTimes, jdbcType=INTEGER}
|
||||
WHERE username = #{username, jdbcType=VARCHAR};
|
||||
|
||||
SELECT pwdErrTimes
|
||||
FROM user_account
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<update id="delUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getValue()},
|
||||
operators = #{operators},
|
||||
lockTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="disableUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getValue()},
|
||||
operators = #{operators},
|
||||
lockTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="lockUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getValue()},
|
||||
lockTime = CURRENT_TIMESTAMP
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="unlockUserAccount">
|
||||
UPDATE
|
||||
user_account
|
||||
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getValue()},
|
||||
lockTime = 0
|
||||
WHERE username = #{username, jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue