372 lines
19 KiB
XML
372 lines
19 KiB
XML
<?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.ruoyi.system.mapper.InitialSwitchInfoDetailsMapper">
|
|
|
|
<resultMap type="InitialSwitchInfoDetails" id="InitialSwitchInfoDetailsResult">
|
|
<result property="id" column="id" />
|
|
<result property="clientId" column="client_id" />
|
|
<result property="name" column="name" />
|
|
<result property="inBytes" column="in_bytes" />
|
|
<result property="outBytes" column="out_bytes" />
|
|
<result property="status" column="status" />
|
|
<result property="type" column="type" />
|
|
<result property="inSpeed" column="in_speed" />
|
|
<result property="outSpeed" column="out_speed" />
|
|
<result property="switchIp" column="switch_ip" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="switchName" column="switch_name" />
|
|
<result property="interfaceDeviceType" column="interface_device_type" />
|
|
<result property="serverName" column="server_name" />
|
|
<result property="serverPort" column="server_port" />
|
|
<result property="serverSn" column="server_sn" />
|
|
<result property="switchSn" column="switch_sn" />
|
|
<result property="businessCode" column="business_code" />
|
|
<result property="businessName" column="business_name" />
|
|
<result property="ifSpeed" column="if_speed" />
|
|
<result property="ifInDiscards" column="if_in_discards" />
|
|
<result property="ifOutDiscards" column="if_out_discards" />
|
|
<result property="ifInErrors" column="if_in_errors" />
|
|
<result property="ifOutErrors" column="if_out_errors" />
|
|
<result property="ifIndex" column="if_index" />
|
|
<result property="maxSpeed" column="max_speed" />
|
|
<result property="interfaceNameRemark" column="interface_name_remark" />
|
|
<result property="serverClientId" column="server_client_id" />
|
|
</resultMap>
|
|
|
|
<sql id="selectInitialSwitchInfoDetailsVo">
|
|
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name, if_speed, if_in_discards, if_out_discards, if_in_errors, if_out_errors, if_index, max_speed, interface_name_remark, server_client_id from initial_switch_info_details
|
|
</sql>
|
|
|
|
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
|
|
<include refid="selectInitialSwitchInfoDetailsVo"/>
|
|
<where>
|
|
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
<if test="name != null and name != ''"> and name = #{name}</if>
|
|
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
|
|
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
|
|
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
|
|
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
|
|
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
|
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
|
|
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
|
|
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
|
|
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
|
|
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
|
|
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
|
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
|
<if test="interfaceNameRemark != null and interfaceNameRemark != ''"> and interface_name_remark = #{interfaceNameRemark}</if>
|
|
<if test="serverClientId != null and serverClientId != ''"> and server_client_id = #{serverClientId}</if>
|
|
<if test="startTime != null">
|
|
and create_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and create_time <= #{endTime}
|
|
</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="selectInitialSwitchInfoDetailsById" parameterType="Long" resultMap="InitialSwitchInfoDetailsResult">
|
|
<include refid="selectInitialSwitchInfoDetailsVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertInitialSwitchInfoDetails" parameterType="InitialSwitchInfoDetails" useGeneratedKeys="true" keyProperty="id">
|
|
insert into initial_switch_info_details
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="clientId != null and clientId != ''">client_id,</if>
|
|
<if test="name != null and name != ''">name,</if>
|
|
<if test="inBytes != null">in_bytes,</if>
|
|
<if test="outBytes != null">out_bytes,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="inSpeed != null">in_speed,</if>
|
|
<if test="outSpeed != null">out_speed,</if>
|
|
<if test="switchIp != null">switch_ip,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="switchName != null">switch_name,</if>
|
|
<if test="interfaceDeviceType != null">interface_device_type,</if>
|
|
<if test="serverName != null">server_name,</if>
|
|
<if test="serverPort != null">server_port,</if>
|
|
<if test="serverSn != null">server_sn,</if>
|
|
<if test="switchSn != null">switch_sn,</if>
|
|
<if test="businessCode != null">business_code,</if>
|
|
<if test="businessName != null">business_name,</if>
|
|
<if test="ifSpeed != null">if_speed,</if>
|
|
<if test="ifInDiscards != null">if_in_discards,</if>
|
|
<if test="ifOutDiscards != null">if_out_discards,</if>
|
|
<if test="ifInErrors != null">if_in_errors,</if>
|
|
<if test="ifOutErrors != null">if_out_errors,</if>
|
|
<if test="ifIndex != null">if_index,</if>
|
|
<if test="maxSpeed != null">max_speed,</if>
|
|
<if test="interfaceNameRemark != null">interface_name_remark,</if>
|
|
<if test="serverClientId != null">server_client_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
<if test="inBytes != null">#{inBytes},</if>
|
|
<if test="outBytes != null">#{outBytes},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="inSpeed != null">#{inSpeed},</if>
|
|
<if test="outSpeed != null">#{outSpeed},</if>
|
|
<if test="switchIp != null">#{switchIp},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="switchName != null">#{switchName},</if>
|
|
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
|
|
<if test="serverName != null">#{serverName},</if>
|
|
<if test="serverPort != null">#{serverPort},</if>
|
|
<if test="serverSn != null">#{serverSn},</if>
|
|
<if test="switchSn != null">#{switchSn},</if>
|
|
<if test="businessCode != null">#{businessCode},</if>
|
|
<if test="businessName != null">#{businessName},</if>
|
|
<if test="ifSpeed != null">#{ifSpeed},</if>
|
|
<if test="ifInDiscards != null">#{ifInDiscards},</if>
|
|
<if test="ifOutDiscards != null">#{ifOutDiscards},</if>
|
|
<if test="ifInErrors != null">#{ifInErrors},</if>
|
|
<if test="ifOutErrors != null">#{ifOutErrors},</if>
|
|
<if test="ifIndex != null">#{ifIndex},</if>
|
|
<if test="maxSpeed != null">#{maxSpeed},</if>
|
|
<if test="interfaceNameRemark != null">#{interfaceNameRemark},</if>
|
|
<if test="serverClientId != null">#{serverClientId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateInitialSwitchInfoDetails" parameterType="InitialSwitchInfoDetails">
|
|
update initial_switch_info_details
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
|
<if test="name != null and name != ''">name = #{name},</if>
|
|
<if test="inBytes != null">in_bytes = #{inBytes},</if>
|
|
<if test="outBytes != null">out_bytes = #{outBytes},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
|
|
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
|
|
<if test="switchIp != null">switch_ip = #{switchIp},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="switchName != null">switch_name = #{switchName},</if>
|
|
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
|
|
<if test="serverName != null">server_name = #{serverName},</if>
|
|
<if test="serverPort != null">server_port = #{serverPort},</if>
|
|
<if test="serverSn != null">server_sn = #{serverSn},</if>
|
|
<if test="switchSn != null">switch_sn = #{switchSn},</if>
|
|
<if test="businessCode != null">business_code = #{businessCode},</if>
|
|
<if test="businessName != null">business_name = #{businessName},</if>
|
|
<if test="ifSpeed != null">if_speed = #{ifSpeed},</if>
|
|
<if test="ifInDiscards != null">if_in_discards = #{ifInDiscards},</if>
|
|
<if test="ifOutDiscards != null">if_out_discards = #{ifOutDiscards},</if>
|
|
<if test="ifInErrors != null">if_in_errors = #{ifInErrors},</if>
|
|
<if test="ifOutErrors != null">if_out_errors = #{ifOutErrors},</if>
|
|
<if test="ifIndex != null">if_index = #{ifIndex},</if>
|
|
<if test="maxSpeed != null">max_speed = #{maxSpeed},</if>
|
|
<if test="interfaceNameRemark != null">interface_name_remark = #{interfaceNameRemark},</if>
|
|
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteInitialSwitchInfoDetailsById" parameterType="Long">
|
|
delete from initial_switch_info_details where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteInitialSwitchInfoDetailsByIds" parameterType="String">
|
|
delete from initial_switch_info_details where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
<!-- 查询交换机信息-->
|
|
<select id="getAllSwitchInfoMsg" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
|
|
SELECT
|
|
id,
|
|
client_id AS clientId,
|
|
`name`,
|
|
in_bytes AS inBytes,
|
|
out_bytes AS outBytes,
|
|
status,
|
|
`type`,
|
|
in_speed AS inSpeed,
|
|
out_speed AS outSpeed,
|
|
switch_ip AS switchIp,
|
|
if_index AS ifIndex,
|
|
if_speed AS ifSpeed,
|
|
if_in_discards AS ifInDiscards,
|
|
if_out_discards AS ifOutDiscards,
|
|
if_in_errors AS ifInErrors,
|
|
if_out_errors AS ifOutErrors,
|
|
create_by AS createBy,
|
|
update_by AS updateBy,
|
|
create_time AS createTime,
|
|
update_time AS updateTime
|
|
FROM
|
|
initial_switch_info
|
|
<where>
|
|
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
|
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
|
</where>
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
|
|
<insert id="saveBatchSwitchTraffic" parameterType="InitialSwitchInfoDetails">
|
|
INSERT IGNORE INTO initial_switch_info_details
|
|
(
|
|
client_id,
|
|
`name`,
|
|
in_bytes,
|
|
out_bytes,
|
|
status,
|
|
`type`,
|
|
in_speed,
|
|
out_speed,
|
|
max_speed,
|
|
switch_ip,
|
|
if_index,
|
|
if_speed,
|
|
if_in_discards,
|
|
if_out_discards,
|
|
if_in_errors,
|
|
if_out_errors,
|
|
switch_name,
|
|
interface_device_type,
|
|
`server_name`,
|
|
server_port,
|
|
server_sn,
|
|
switch_sn,
|
|
business_code,
|
|
business_name,
|
|
create_by,
|
|
update_by,
|
|
create_time,
|
|
update_time,
|
|
interface_name_remark,
|
|
server_client_id
|
|
)
|
|
VALUES
|
|
<foreach collection="dataList" item="item" separator=",">
|
|
(
|
|
#{item.clientId},
|
|
#{item.name},
|
|
#{item.inBytes},
|
|
#{item.outBytes},
|
|
#{item.status},
|
|
#{item.type},
|
|
#{item.inSpeed},
|
|
#{item.outSpeed},
|
|
#{item.maxSpeed},
|
|
#{item.switchIp},
|
|
#{item.ifIndex},
|
|
#{item.ifSpeed},
|
|
#{item.ifInDiscards},
|
|
#{item.ifOutDiscards},
|
|
#{item.ifInErrors},
|
|
#{item.ifOutErrors},
|
|
#{item.switchName},
|
|
#{item.interfaceDeviceType},
|
|
#{item.serverName},
|
|
#{item.serverPort},
|
|
#{item.serverSn},
|
|
#{item.switchSn},
|
|
#{item.businessCode},
|
|
#{item.businessName},
|
|
#{item.createBy},
|
|
#{item.updateBy},
|
|
<choose>
|
|
<when test="item.createTime != null">
|
|
#{item.createTime}
|
|
</when>
|
|
<otherwise>
|
|
NOW()
|
|
</otherwise>
|
|
</choose>,
|
|
<choose>
|
|
<when test="item.updateTime != null">
|
|
#{item.updateTime}
|
|
</when>
|
|
<otherwise>
|
|
NOW()
|
|
</otherwise>
|
|
</choose>,
|
|
#{item.interfaceNameRemark},
|
|
#{item.serverClientId}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<select id="getswitchDetailList" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
|
|
select in_speed inSpeed, out_speed outSpeed, create_time createTime from initial_switch_info_details
|
|
<where>
|
|
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
<if test="name != null and name != ''"> and name = #{name}</if>
|
|
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
|
|
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
|
|
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
|
|
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
|
|
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
|
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
|
|
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
|
|
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
|
|
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
|
|
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
|
|
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
|
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
|
<if test="startTime != null">
|
|
and create_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and create_time <= #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="sumSwitchTrafficByclientIds" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
|
|
select sum(ifnull(in_speed,0)) AS inSpeed,
|
|
sum(ifnull(out_speed,0)) AS outSpeed,
|
|
sum(ifnull(max_speed,0)) AS maxSpeed,
|
|
create_time createTime from initial_switch_info_details
|
|
<where>
|
|
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
|
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
|
<if test="startTime != null">
|
|
and create_time >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and create_time <= #{endTime}
|
|
</if>
|
|
<if test="clientIds != '' and clientIds != null">
|
|
and client_id in
|
|
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
|
|
#{clientId}
|
|
</foreach>
|
|
</if>
|
|
<if test="interfaceNames != null and interfaceNames != ''">
|
|
and name in
|
|
<foreach collection="interfaceNames.split(',')" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
group by create_time
|
|
ORDER BY max_speed desc
|
|
</select>
|
|
</mapper> |