交换机流量数据表改为分表
This commit is contained in:
+193
-1
@@ -41,6 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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>
|
||||
<sql id="selectInitialSwitchInfoDetailsVoSharding">
|
||||
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 ${tableName}
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
|
||||
<include refid="selectInitialSwitchInfoDetailsVo"/>
|
||||
@@ -311,6 +314,90 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="saveBatchSwitchTrafficSharding" parameterType="InitialSwitchInfoDetails">
|
||||
INSERT IGNORE INTO ${tableName}
|
||||
(
|
||||
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>
|
||||
@@ -343,7 +430,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
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
|
||||
create_time createTime from ${tableName}
|
||||
<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>
|
||||
@@ -392,4 +479,109 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 查询交换机信息-->
|
||||
<select id="getAllSwitchInfoMsgSharding" 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
|
||||
${tableName}
|
||||
<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>
|
||||
<select id="getSwitchDetailListSharding" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
|
||||
select switch_name switchName,client_id clientId, name, in_speed inSpeed, out_speed outSpeed, create_time createTime from ${tableName}
|
||||
<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>
|
||||
<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>
|
||||
</select>
|
||||
<select id="selectInitialSwitchInfoDetailsListSharding" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
|
||||
<include refid="selectInitialSwitchInfoDetailsVoSharding"/>
|
||||
<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>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user