初始化v1.2

This commit is contained in:
gaoyutao
2025-11-24 16:19:09 +08:00
parent c0f51ef007
commit de49404116
918 changed files with 4236 additions and 4239 deletions
@@ -0,0 +1,238 @@
<?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.tongran.system.mapper.AllInterfaceNameMapper">
<resultMap type="AllInterfaceName" id="AllInterfaceNameResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
<result property="interfaceName" column="interface_name" />
<result property="deviceSn" column="device_sn" />
<result property="nodeName" column="node_name" />
<result property="businessCode" column="business_code" />
<result property="businessName" column="business_name" />
<result property="resourceType" column="resource_type" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="switchName" column="switch_name" />
<result property="interfaceDeviceType" column="interface_device_type" />
<result property="serverPort" column="server_port" />
<result property="switchSn" column="switch_sn" />
<result property="switchIp" column="switch_ip" />
<result property="serverIp" column="server_ip" />
</resultMap>
<sql id="selectAllInterfaceNameVo">
select id, client_id, interface_name, device_sn, node_name, business_code, business_name, resource_type, create_time, update_time, create_by, update_by, switch_name, interface_device_type, server_port, switch_sn, switch_ip, server_ip from all_interface_name
</sql>
<select id="selectAllInterfaceNameList" parameterType="AllInterfaceName" resultMap="AllInterfaceNameResult">
<include refid="selectAllInterfaceNameVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</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="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</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="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where>
</select>
<select id="selectAllInterfaceNameById" parameterType="Long" resultMap="AllInterfaceNameResult">
<include refid="selectAllInterfaceNameVo"/>
where id = #{id}
</select>
<insert id="insertAllInterfaceName" parameterType="AllInterfaceName" useGeneratedKeys="true" keyProperty="id">
insert IGNORE into all_interface_name
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="interfaceName != null and interfaceName != ''">interface_name,</if>
<if test="deviceSn != null and deviceSn != ''">device_sn,</if>
<if test="nodeName != null">node_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="businessName != null">business_name,</if>
<if test="resourceType != null">resource_type,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="switchName != null">switch_name,</if>
<if test="interfaceDeviceType != null">interface_device_type,</if>
<if test="serverPort != null">server_port,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="serverIp != null">server_ip,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="interfaceName != null and interfaceName != ''">#{interfaceName},</if>
<if test="deviceSn != null and deviceSn != ''">#{deviceSn},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null">#{businessName},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="switchName != null">#{switchName},</if>
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="serverIp != null">#{serverIp},</if>
</trim>
</insert>
<update id="updateAllInterfaceName" parameterType="AllInterfaceName">
update all_interface_name
<trim prefix="SET" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="interfaceName != null and interfaceName != ''">interface_name = #{interfaceName},</if>
<if test="deviceSn != null and deviceSn != ''">device_sn = #{deviceSn},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="serverIp != null">server_ip = #{serverIp},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAllInterfaceNameById" parameterType="Long">
delete from all_interface_name where id = #{id}
</delete>
<delete id="deleteAllInterfaceNameByIds" parameterType="String">
delete from all_interface_name where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据接口名称批量查询 -->
<select id="selectByNames" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT
id,
interface_name AS interfaceName,
client_id AS clientId,
resource_type AS resourceType,
device_sn AS deviceSn,
node_name AS nodeName,
business_code AS businessCode,
business_name AS businessName,
switch_name AS switchName,
interface_device_type AS interfaceDeviceType,
server_port AS serverPort,
switch_sn AS switchSn,
switch_ip AS switchIp,
server_ip AS serverIp
FROM
all_interface_name
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name = #{interfaceName}</if>
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
<if test="nodeName != null and nodeName != ''"> and node_name = #{nodeName}</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="switchName != null and switchName != ''"> and switch_name = #{switchName}</if>
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where>
</select>
<!-- 批量插入接口名称 -->
<insert id="batchInsert" parameterType="java.util.List">
INSERT IGNORE INTO all_interface_name
(
interface_name,
client_id,
resource_type,
device_sn,
node_name,
business_code,
business_name,
switch_name, interface_device_type, server_port, switch_sn, switch_ip, server_ip,
create_time,
update_time
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.interfaceName},
#{item.clientId},
#{item.resourceType},
#{item.deviceSn},
#{item.nodeName},
#{item.businessCode},
#{item.businessName},
#{item.switchName}, #{item.interfaceDeviceType}, #{item.serverPort}, #{item.switchSn}, #{item.switchIp}, #{item.serverIp},
NOW(),
NOW()
)
</foreach>
</insert>
<select id="getAllDeviceSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT
client_id AS clientId
FROM
all_interface_name
<where>
and resource_type = '1' and client_id != ''
</where>
group by client_id
</select>
<select id="getAllSwitchSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT
client_id AS clientId, switch_ip switchIp
FROM
all_interface_name
<where>
and resource_type = '2' and client_id != ''
</where>
group by client_id
</select>
<update id="batchUpdate" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="" separator=";" close="">
UPDATE all_interface_name
SET
business_code = #{item.businessCode},
business_name = #{item.businessName},
update_time = NOW(),
client_id = #{item.clientId},
device_sn = #{item.deviceSn},
node_name = #{item.nodeName},
server_port = #{item.serverPort},
interface_device_type = #{item.interfaceDeviceType},
switch_name = #{item.switchName},
switch_sn = #{item.switchSn},
switch_ip = #{item.switchIp},
server_ip = #{item.serverIp}
WHERE id = #{item.id}
</foreach>
</update>
</mapper>
@@ -0,0 +1,130 @@
<?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.tongran.system.mapper.EpsBusinessDeployMapper">
<resultMap type="EpsBusinessDeploy" id="EpsBusinessDeployResult">
<result property="id" column="id" />
<result property="taskName" column="task_name" />
<result property="businessCode" column="business_code" />
<result property="businessName" column="business_name" />
<result property="scriptName" column="script_name" />
<result property="scriptPath" column="script_path" />
<result property="scriptParams" column="script_params" />
<result property="deployDevice" column="deploy_device" />
<result property="submitBy" column="submit_by" />
<result property="reviewBy" column="review_by" />
<result property="reviewStatus" column="review_status" />
<result property="reviewTime" column="review_time" />
<result property="reviewComment" column="review_comment" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEpsBusinessDeployVo">
select id, task_name, business_code, business_name, script_name, script_path, script_params, deploy_device, submit_by, review_by, review_status, review_time, review_comment, create_time, update_time, create_by, update_by from eps_business_deploy
</sql>
<select id="selectEpsBusinessDeployList" parameterType="EpsBusinessDeploy" resultMap="EpsBusinessDeployResult">
<include refid="selectEpsBusinessDeployVo"/>
<where>
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</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="scriptName != null and scriptName != ''"> and script_name like concat('%', #{scriptName}, '%')</if>
<if test="scriptPath != null and scriptPath != ''"> and script_path = #{scriptPath}</if>
<if test="scriptParams != null and scriptParams != ''"> and script_params = #{scriptParams}</if>
<if test="deployDevice != null and deployDevice != ''"> and deploy_device = #{deployDevice}</if>
<if test="submitBy != null and submitBy != ''"> and submit_by = #{submitBy}</if>
<if test="reviewBy != null and reviewBy != ''"> and review_by = #{reviewBy}</if>
<if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</if>
<if test="reviewTime != null "> and review_time = #{reviewTime}</if>
<if test="reviewComment != null and reviewComment != ''"> and review_comment = #{reviewComment}</if>
<if test="clientId != null and clientId != ''">
and FIND_IN_SET(#{clientId}, REPLACE(deploy_device, '\n', ',')) > 0
</if>
</where>
</select>
<select id="selectEpsBusinessDeployById" parameterType="Long" resultMap="EpsBusinessDeployResult">
<include refid="selectEpsBusinessDeployVo"/>
where id = #{id}
</select>
<insert id="insertEpsBusinessDeploy" parameterType="EpsBusinessDeploy" useGeneratedKeys="true" keyProperty="id">
insert into eps_business_deploy
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskName != null">task_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="businessName != null">business_name,</if>
<if test="scriptName != null">script_name,</if>
<if test="scriptPath != null">script_path,</if>
<if test="scriptParams != null">script_params,</if>
<if test="deployDevice != null">deploy_device,</if>
<if test="submitBy != null">submit_by,</if>
<if test="reviewBy != null">review_by,</if>
<if test="reviewStatus != null">review_status,</if>
<if test="reviewTime != null">review_time,</if>
<if test="reviewComment != null">review_comment,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskName != null">#{taskName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null">#{businessName},</if>
<if test="scriptName != null">#{scriptName},</if>
<if test="scriptPath != null">#{scriptPath},</if>
<if test="scriptParams != null">#{scriptParams},</if>
<if test="deployDevice != null">#{deployDevice},</if>
<if test="submitBy != null">#{submitBy},</if>
<if test="reviewBy != null">#{reviewBy},</if>
<if test="reviewStatus != null">#{reviewStatus},</if>
<if test="reviewTime != null">#{reviewTime},</if>
<if test="reviewComment != null">#{reviewComment},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateEpsBusinessDeploy" parameterType="EpsBusinessDeploy">
update eps_business_deploy
<trim prefix="SET" suffixOverrides=",">
<if test="taskName != null">task_name = #{taskName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="scriptName != null">script_name = #{scriptName},</if>
<if test="scriptPath != null">script_path = #{scriptPath},</if>
<if test="scriptParams != null">script_params = #{scriptParams},</if>
<if test="deployDevice != null">deploy_device = #{deployDevice},</if>
<if test="submitBy != null">submit_by = #{submitBy},</if>
<if test="reviewBy != null">review_by = #{reviewBy},</if>
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
<if test="reviewTime != null">review_time = #{reviewTime},</if>
<if test="reviewComment != null">review_comment = #{reviewComment},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsBusinessDeployById" parameterType="Long">
delete from eps_business_deploy where id = #{id}
</delete>
<delete id="deleteEpsBusinessDeployByIds" parameterType="String">
delete from eps_business_deploy where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,93 @@
<?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.tongran.system.mapper.EpsBusinessMapper">
<resultMap type="EpsBusiness" id="EpsBusinessResult">
<result property="id" column="id" />
<result property="businessName" column="business_name" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="description" column="description" />
</resultMap>
<sql id="selectEpsBusinessVo">
select id, business_name, create_time, update_time, create_by, update_by, description from eps_business
</sql>
<select id="selectEpsBusinessList" parameterType="EpsBusiness" resultMap="EpsBusinessResult">
<include refid="selectEpsBusinessVo"/>
<where>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
</where>
</select>
<select id="selectEpsBusinessById" parameterType="String" resultMap="EpsBusinessResult">
<include refid="selectEpsBusinessVo"/>
where id = #{id}
</select>
<select id="selectEpsBusinessByName" parameterType="String" resultMap="EpsBusinessResult">
<include refid="selectEpsBusinessVo"/>
where business_name = #{businessName}
limit 1
</select>
<insert id="insertEpsBusiness" parameterType="EpsBusiness">
insert into eps_business
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="businessName != null and businessName != ''">business_name,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="description != null">description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="businessName != null and businessName != ''">#{businessName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="description != null">#{description},</if>
</trim>
</insert>
<update id="updateEpsBusiness" parameterType="EpsBusiness">
update eps_business
<trim prefix="SET" suffixOverrides=",">
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="description != null">description = #{description},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsBusinessById" parameterType="String">
delete from eps_business where id = #{id}
</delete>
<delete id="deleteEpsBusinessByIds" parameterType="String">
delete from eps_business where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="countByBusinessName" parameterType="EpsBusiness" resultType="java.lang.Integer">
select count(1) from eps_business
<where>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
</where>
</select>
</mapper>
@@ -0,0 +1,87 @@
<?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.tongran.system.mapper.EpsBusinessScriptMapper">
<resultMap type="EpsBusinessScript" id="EpsBusinessScriptResult">
<result property="id" column="id" />
<result property="scriptName" column="script_name" />
<result property="scriptPath" column="script_path" />
<result property="defaultParams" column="default_params" />
<result property="failedKeywords" column="failed_keywords" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEpsBusinessScriptVo">
select id, script_name, script_path, default_params, failed_keywords, create_time, update_time, create_by, update_by from eps_business_script
</sql>
<select id="selectEpsBusinessScriptList" parameterType="EpsBusinessScript" resultMap="EpsBusinessScriptResult">
<include refid="selectEpsBusinessScriptVo"/>
<where>
<if test="scriptName != null and scriptName != ''"> and script_name like concat('%', #{scriptName}, '%')</if>
<if test="scriptPath != null and scriptPath != ''"> and script_path = #{scriptPath}</if>
<if test="defaultParams != null and defaultParams != ''"> and default_params = #{defaultParams}</if>
<if test="failedKeywords != null and failedKeywords != ''"> and failed_keywords = #{failedKeywords}</if>
</where>
</select>
<select id="selectEpsBusinessScriptById" parameterType="Long" resultMap="EpsBusinessScriptResult">
<include refid="selectEpsBusinessScriptVo"/>
where id = #{id}
</select>
<insert id="insertEpsBusinessScript" parameterType="EpsBusinessScript" useGeneratedKeys="true" keyProperty="id">
insert into eps_business_script
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="scriptName != null">script_name,</if>
<if test="scriptPath != null">script_path,</if>
<if test="defaultParams != null">default_params,</if>
<if test="failedKeywords != null">failed_keywords,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="scriptName != null">#{scriptName},</if>
<if test="scriptPath != null">#{scriptPath},</if>
<if test="defaultParams != null">#{defaultParams},</if>
<if test="failedKeywords != null">#{failedKeywords},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateEpsBusinessScript" parameterType="EpsBusinessScript">
update eps_business_script
<trim prefix="SET" suffixOverrides=",">
<if test="scriptName != null">script_name = #{scriptName},</if>
<if test="scriptPath != null">script_path = #{scriptPath},</if>
default_params = #{defaultParams},
failed_keywords = #{failedKeywords},
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsBusinessScriptById" parameterType="Long">
delete from eps_business_script where id = #{id}
</delete>
<delete id="deleteEpsBusinessScriptByIds" parameterType="String">
delete from eps_business_script where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,386 @@
<?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.tongran.system.mapper.EpsInitialTrafficDataMapper">
<update id="createEpsTrafficTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
`name` VARCHAR(255) COMMENT '接口名称',
`mac` VARCHAR(50) COMMENT 'MAC地址',
`status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
`in_speed` varchar(50) COMMENT '接收带宽(bit)',
`out_speed` varchar(50) COMMENT '发送带宽(bit)',
`total_in_speed` varchar(50) COMMENT '总接收带宽(bit)',
`total_out_speed` varchar(50) COMMENT '总发送带宽(bit)',
`machine_flow` varchar(50) COMMENT '金山带宽(bit)',
`speed` varchar(100) COMMENT '协商速度',
`duplex` varchar(100) COMMENT '工作模式',
business_id varchar(50) COMMENT '业务代码',
business_name varchar(200) COMMENT '业务名称',
service_sn varchar(64) COMMENT '服务器SN',
node_name varchar(200) COMMENT '服务器名称',
revenue_method varchar(10) COMMENT '收益方式(1.流量,2包端)',
package_bandwidth DECIMAL(10,2) COMMENT '包端带宽值',
create_time DATETIME COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
create_by VARCHAR(50) COMMENT '创建人',
update_by VARCHAR(50) COMMENT '修改人',
client_id VARCHAR(255) COMMENT '设备唯一标识',
PRIMARY KEY (id),
UNIQUE KEY uk_client_mac_name_time (client_id, mac, name, create_time),
INDEX idx_name_time (`name`,create_time),
INDEX idx_revenue_method (revenue_method),
INDEX idx_service_sn (service_sn)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='EPS设备流量初始数据表';
</update>
<update id="createEpsInitialTrafficTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
`name` VARCHAR(255) COMMENT '接口名称',
`mac` VARCHAR(20) COMMENT 'MAC地址',
`status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
`in_speed` VARCHAR(50) COMMENT '接收带宽(Mbps)',
`out_speed` VARCHAR(50) COMMENT '发送带宽(Mbps)',
`total_in_speed` VARCHAR(50) COMMENT '总接收带宽(Mbps)',
`total_out_speed` VARCHAR(50) COMMENT '总发送带宽(Mbps)',
`speed` varchar(100) COMMENT '协商速度',
`duplex` varchar(100) COMMENT '工作模式',
create_time DATETIME COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
create_by VARCHAR(50) COMMENT '创建人',
update_by VARCHAR(50) COMMENT '修改人',
client_id VARCHAR(255) COMMENT '设备唯一标识',
PRIMARY KEY (id),
UNIQUE KEY uk_client_mac_name_time (client_id, mac, name, create_time),
INDEX idx_name_time (`name`,create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='初始带宽流量表';
</update>
<update id="createMtrProbeResultTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
mtr_client_id VARCHAR(200) COMMENT 'MTR客户端ID',
client_id VARCHAR(200) COMMENT '客户端ID',
public_ip VARCHAR(45) COMMENT '公网IP地址',
packet_loss_rate DECIMAL(5,2) COMMENT '丢包率(%)',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
create_by VARCHAR(64) COMMENT '创建人',
update_by VARCHAR(64) COMMENT '更新人',
PRIMARY KEY (id),
UNIQUE KEY uk_probe_record (mtr_client_id, client_id, create_time),
INDEX idx_mtr_client_id (mtr_client_id, create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='网络mtr探测结果表';
</update>
<update id="createSwitchInfoTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
client_id VARCHAR(255) NOT NULL COMMENT '客户端ID',
name VARCHAR(100) NOT NULL COMMENT '网络接口名称',
switch_ip VARCHAR(100) COMMENT '交换机IP',
in_bytes DECIMAL(22,0) COMMENT '接收流量(字节)',
out_bytes DECIMAL(22,0) COMMENT '发送流量(字节)',
in_speed DECIMAL(20,2) DEFAULT 0.00 COMMENT '接收速率(bit/s)',
out_speed DECIMAL(20,2) DEFAULT 0.00 COMMENT '发送速率(bit/s)',
max_speed DECIMAL(20,0) COMMENT '流量最大值',
status VARCHAR(20) COMMENT '接口状态',
type VARCHAR(30) COMMENT '接口类型',
if_speed VARCHAR(50) COMMENT '端口速率(Mbps)',
if_index VARCHAR(50) COMMENT '端口索引',
if_in_discards VARCHAR(50) COMMENT '入站丢包',
if_out_discards VARCHAR(50) COMMENT '出站丢包',
if_in_errors VARCHAR(50) COMMENT '入站错误',
if_out_errors VARCHAR(50) COMMENT '出站错误',
create_time DATETIME COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
create_by VARCHAR(50) COMMENT '创建人',
update_by VARCHAR(50) COMMENT '更新人',
PRIMARY KEY (id),
UNIQUE KEY uk_switch_record (client_id, switch_ip, name, create_time),
INDEX idx_create_time (create_time),
INDEX idx_draw (client_id, name, create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交换机监控信息表';
</update>
<update id="createSwitchInfoDetailsTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
client_id VARCHAR(255) NOT NULL COMMENT '客户端ID',
name VARCHAR(100) NOT NULL COMMENT '网络接口名称',
switch_ip VARCHAR(100) COMMENT '交换机IP',
switch_name VARCHAR(100) COMMENT '交换机名称',
switch_sn VARCHAR(64) COMMENT '交换机SN',
in_bytes DECIMAL(22,2) COMMENT '接收流量(字节)',
out_bytes DECIMAL(22,2) COMMENT '发送流量(字节)',
in_speed DECIMAL(20,2) COMMENT '接收速率(bit/s)',
out_speed DECIMAL(20,2) COMMENT '发送速率(bit/s)',
max_speed DECIMAL(20,2) COMMENT '流量最大值',
status VARCHAR(20) COMMENT '接口状态',
type VARCHAR(30) COMMENT '接口类型',
interface_device_type VARCHAR(50) COMMENT '连接设备类型',
interface_name_remark VARCHAR(255) COMMENT '接口别名',
server_name VARCHAR(100) COMMENT '服务器名称',
server_client_id VARCHAR(255) COMMENT '服务器客户端ID',
server_port VARCHAR(200) COMMENT '服务器网口',
server_sn VARCHAR(64) COMMENT '服务器SN',
business_code VARCHAR(100) COMMENT '业务代码',
business_name VARCHAR(200) COMMENT '业务名称',
if_speed VARCHAR(50) COMMENT '端口速率(Mbps)',
if_index VARCHAR(50) COMMENT '端口索引',
if_in_discards VARCHAR(50) COMMENT '入站丢包',
if_out_discards VARCHAR(50) COMMENT '出站丢包',
if_in_errors VARCHAR(50) COMMENT '入站错误',
if_out_errors VARCHAR(50) COMMENT '出站错误',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
create_by VARCHAR(50) COMMENT '创建人',
update_by VARCHAR(50) COMMENT '更新人',
PRIMARY KEY (id),
UNIQUE KEY uk_switch_detail (client_id, switch_ip, name, create_time),
INDEX idx_filter_sort (name, interface_device_type, switch_sn, create_time),
INDEX idx_create_time (create_time),
INDEX idx_client_time (client_id, name, create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交换机监控详情表';
</update>
<!-- 单条插入语句 -->
<insert id="insert">
INSERT INTO ${tableName} (
`name`,
`mac`,
`status`,
`type`,
ipV4,
`in_dropped`,
`out_dropped`,
`in_speed`,
`out_speed`,
`total_in_speed`,
`total_out_speed`,
`speed`,
`duplex`,
business_id,
business_name,
service_sn,
node_name,
revenue_method,
package_bandwidth,
create_by,
update_by,
client_id
) VALUES (
#{name},
#{mac},
#{status},
#{type},
#{ipV4},
#{inDropped},
#{outDropped},
#{inSpeed},
#{outSpeed},
#{totalInSpeed},
#{totalOutSpeed},
#{speed},
#{duplex},
#{businessId},
#{businessName},
#{serviceSn},
#{nodeName},
#{revenueMethod},
#{packageBandwidth},
#{createBy},
#{updateBy},
#{clientId}
)
</insert>
<!-- 批量插入语句 -->
<insert id="batchInsert">
INSERT IGNORE INTO ${tableName} (
id,
`name`,
`mac`,
`status`,
`type`,
ipV4,
`in_dropped`,
`out_dropped`,
`in_speed`,
`out_speed`,
`total_in_speed`,
`total_out_speed`,
`speed`,
`duplex`,
business_id,
business_name,
service_sn,
node_name,
revenue_method,
package_bandwidth,
create_time,
update_time,
create_by,
update_by,
client_id
) VALUES
<foreach collection="dataList" item="data" separator=",">
(
#{data.id,jdbcType=BIGINT},
#{data.name,jdbcType=VARCHAR},
#{data.mac,jdbcType=VARCHAR},
#{data.status,jdbcType=VARCHAR},
#{data.type,jdbcType=VARCHAR},
#{data.ipV4,jdbcType=VARCHAR},
#{data.inDropped,jdbcType=DECIMAL},
#{data.outDropped,jdbcType=DECIMAL},
#{data.inSpeed,jdbcType=VARCHAR},
#{data.outSpeed,jdbcType=VARCHAR},
#{data.totalInSpeed,jdbcType=VARCHAR},
#{data.totalOutSpeed,jdbcType=VARCHAR},
#{data.speed,jdbcType=VARCHAR},
#{data.duplex,jdbcType=VARCHAR},
#{data.businessId,jdbcType=VARCHAR},
#{data.businessName,jdbcType=VARCHAR},
#{data.serviceSn,jdbcType=VARCHAR},
#{data.nodeName,jdbcType=VARCHAR},
#{data.revenueMethod,jdbcType=VARCHAR},
#{data.packageBandwidth,jdbcType=DECIMAL},
#{data.createTime,jdbcType=TIMESTAMP},
#{data.updateTime,jdbcType=TIMESTAMP},
#{data.createBy,jdbcType=VARCHAR},
#{data.updateBy,jdbcType=VARCHAR},
#{data.clientId,jdbcType=VARCHAR}
)
</foreach>
</insert>
<!-- 条件查询 -->
<select id="selectByCondition" resultType="EpsInitialTrafficData">
SELECT
a.id,
GROUP_CONCAT(DISTINCT a.`name` SEPARATOR ',') AS name,
a.`mac` AS mac,
a.`status` AS status,
a.`type` AS type,
a.`ipV4` AS ipV4,
a.`in_dropped` AS inDropped,
a.`out_dropped` AS outDropped,
CAST(sum(ifnull(a.`in_speed`,0)) AS DECIMAL(20,0)) AS inSpeed,
CAST(sum(ifnull(a.`out_speed`,0)) AS DECIMAL(20,0)) AS outSpeed,
CAST(sum(ifnull(a.`total_in_speed`,0)) AS DECIMAL(20,0)) AS totalInSpeed,
CAST(sum(ifnull(a.`total_out_speed`,0)) AS DECIMAL(20,0)) AS totalOutSpeed,
a.`machine_flow` AS machineFlow,
a.`speed` AS speed,
a.`duplex` AS duplex,
a.business_id AS businessId,
a.business_name AS businessName,
a.service_sn AS serviceSn,
a.node_name AS nodeName,
a.revenue_method AS revenueMethod,
a.package_bandwidth AS packageBandwidth,
a.create_time AS createTime,
a.update_time AS updateTime,
a.create_by AS createBy,
a.update_by AS updateBy,
a.client_id AS clientId
FROM ${tableName} a
INNER JOIN rm_network_interface b ON a.client_id = b.client_id and a.mac=b.mac_address
AND (b.bind_ip = 1 OR b.bind_ip = 3)
AND b.new_flag = 1
<where>
<if test="serviceSn != '' and serviceSn != null">
and a.service_sn = #{serviceSn}
</if>
<if test="businessId != '' and businessId != null">
and a.business_id = #{businessId}
</if>
<if test="clientId != '' and clientId != null">
and a.client_id = #{clientId}
</if>
<if test="startTime != null">
and a.create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and a.create_time &lt;= #{endTime}
</if>
<if test="revenueMethod != null">
and a.revenue_method = #{revenueMethod}
</if>
</where>
GROUP BY a.create_time DESC
</select>
<!-- 条件查询 -->
<select id="getAllTraficMsg" resultType="EpsInitialTrafficData">
SELECT
id,
`name` AS name,
`mac` AS mac,
`status` AS status,
`type` AS type,
`ipV4` AS ipV4,
`in_dropped` AS inDropped,
`out_dropped` AS outDropped,
`in_speed` AS inSpeed,
`out_speed` AS outSpeed,
`total_in_speed` AS totalInSpeed,
`total_out_speed` AS totalOutSpeed,
`speed` AS speed,
`duplex` AS duplex,
create_time AS createTime,
update_time AS updateTime,
create_by AS createBy,
update_by AS updateBy,
client_id AS clientId
FROM ${tableName}
<where>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
</where>
ORDER BY create_time desc
</select>
<update id="updateMachineTraffic" parameterType="EpsInitialTrafficData">
update ${tableName} set machine_flow=#{machineFlow} where client_id=#{clientId} and create_time=#{createTime}
</update>
<select id="getTrafficListByClientIds" resultType="EpsInitialTrafficData">
SELECT
CAST(sum(ifnull(in_speed,0)) AS DECIMAL(20,0)) AS inSpeed,
CAST(sum(ifnull(out_speed,0)) AS DECIMAL(20,0)) AS outSpeed,
create_time AS createTime
FROM ${tableName}
<where>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
<if test="clientIds != null">
and client_id in
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
#{clientId}
</foreach>
</if>
</where>
group by create_time
ORDER BY out_speed desc
</select>
</mapper>
@@ -0,0 +1,118 @@
<?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.tongran.system.mapper.EpsMethodChangeRecordMapper">
<resultMap type="EpsMethodChangeRecord" id="EpsMethodChangeRecordResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
<result property="changeContent" column="change_content" />
<result property="hardwareSn" column="hardware_sn" />
<result property="createTime" column="create_time" />
<result property="creatBy" column="creat_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="revenueMethod" column="revenue_method" />
<result property="trafficPort" column="traffic_port" />
<result property="packageBandwidth" column="package_bandwidth" />
<result property="businessName" column="business_name" />
<result property="businessCode" column="business_code" />
<result property="clientId" column="client_id" />
</resultMap>
<sql id="selectEpsMethodChangeRecordVo">
select id, node_name, change_content, hardware_sn, create_time, creat_by, update_time, update_by, revenue_method, traffic_port, package_bandwidth, business_name, business_code, client_id from eps_method_change_record
</sql>
<select id="selectEpsMethodChangeRecordList" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
<include refid="selectEpsMethodChangeRecordVo"/>
<where>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="changeContent != null and changeContent != ''"> and change_content like concat('%', #{changeContent}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="creatBy != null and creatBy != ''"> and creat_by = #{creatBy}</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="trafficPort != null and trafficPort != ''"> and traffic_port = #{trafficPort}</if>
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectEpsMethodChangeRecordById" parameterType="Long" resultMap="EpsMethodChangeRecordResult">
<include refid="selectEpsMethodChangeRecordVo"/>
where id = #{id}
</select>
<insert id="insertEpsMethodChangeRecord" parameterType="EpsMethodChangeRecord">
insert into eps_method_change_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="nodeName != null">node_name,</if>
<if test="changeContent != null">change_content,</if>
<if test="hardwareSn != null">hardware_sn,</if>
<if test="createTime != null">create_time,</if>
<if test="creatBy != null">creat_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="revenueMethod != null">revenue_method,</if>
<if test="trafficPort != null">traffic_port,</if>
<if test="packageBandwidth != null">package_bandwidth,</if>
<if test="businessName != null">business_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="clientId != null">client_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="changeContent != null">#{changeContent},</if>
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creatBy != null">#{creatBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="revenueMethod != null">#{revenueMethod},</if>
<if test="trafficPort != null">#{trafficPort},</if>
<if test="packageBandwidth != null">#{packageBandwidth},</if>
<if test="businessName != null">#{businessName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="clientId != null">#{clientId},</if>
</trim>
</insert>
<update id="updateEpsMethodChangeRecord" parameterType="EpsMethodChangeRecord">
update eps_method_change_record
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="changeContent != null">change_content = #{changeContent},</if>
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creatBy != null">creat_by = #{creatBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="revenueMethod != null">revenue_method = #{revenueMethod},</if>
<if test="trafficPort != null">traffic_port = #{trafficPort},</if>
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="clientId != null">client_id = #{clientId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsMethodChangeRecordById" parameterType="Long">
delete from eps_method_change_record where id = #{id}
</delete>
<delete id="deleteEpsMethodChangeRecordByIds" parameterType="String">
delete from eps_method_change_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,335 @@
<?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.tongran.system.mapper.EpsNodeBandwidthMapper">
<resultMap type="EpsNodeBandwidth" id="EpsNodeBandwidthResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
<result property="hardwareSn" column="hardware_sn" />
<result property="calculationMode" column="calculation_mode" />
<result property="bandwidthType" column="bandwidth_type" />
<result property="bandwidthResult" column="bandwidth_result" />
<result property="bandwidth95Daily" column="bandwidth_95_daily" />
<result property="bandwidth95Monthly" column="bandwidth_95_monthly" />
<result property="avgMonthlyBandwidth95" column="avg_monthly_bandwidth_95" />
<result property="packageBandwidthDaily" column="package_bandwidth_daily" />
<result property="machineFlow" column="machine_flow" />
<result property="uplinkSwitch" column="uplink_switch" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="switchSn" column="switch_sn" />
<result property="interfaceName" column="interface_name" />
<result property="resourceType" column="resource_type" />
<result property="interfaceLinkDeviceType" column="interface_link_device_type" />
<result property="effectiveBandwidth95Daily" column="effective_bandwidth_95_daily" />
<result property="effectiveBandwidth95Monthly" column="effective_bandwidth_95_monthly" />
<result property="effectiveAvgMonthlyBandwidth95" column="effective_avg_monthly_bandwidth_95" />
<result property="businessName" column="business_name" />
<result property="businessId" column="business_id" />
<result property="remark1" column="remark1" />
<result property="createDatetime" column="create_datetime" />
<result property="clientId" column="client_id" />
<result property="serverClientId" column="server_client_id" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEpsNodeBandwidthVo">
select id, node_name, hardware_sn, calculation_mode, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, machine_flow, uplink_switch, create_time, update_time, switch_sn, interface_name, resource_type, interface_link_device_type, effective_bandwidth_95_daily, effective_bandwidth_95_monthly, effective_avg_monthly_bandwidth_95, business_name, business_id, remark1, create_datetime, client_id, server_client_id, create_by, update_by from eps_node_bandwidth
</sql>
<select id="selectEpsNodeBandwidthList" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
<where>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="calculationMode != null and calculationMode != ''"> and calculation_mode = #{calculationMode}</if>
<if test="bandwidthType != null and bandwidthType != ''"> and bandwidth_type = #{bandwidthType}</if>
<if test="bandwidthResult != null "> and bandwidth_result = #{bandwidthResult}</if>
<if test="bandwidth95Daily != null "> and bandwidth_95_daily = #{bandwidth95Daily}</if>
<if test="bandwidth95Monthly != null "> and bandwidth_95_monthly = #{bandwidth95Monthly}</if>
<if test="avgMonthlyBandwidth95 != null "> and avg_monthly_bandwidth_95 = #{avgMonthlyBandwidth95}</if>
<if test="packageBandwidthDaily != null "> and package_bandwidth_daily = #{packageBandwidthDaily}</if>
<if test="machineFlow != null "> and machine_flow = #{machineFlow}</if>
<if test="uplinkSwitch != null and uplinkSwitch != ''"> and uplink_switch like concat('%', #{uplinkSwitch}, '%')</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="interfaceLinkDeviceType != null and interfaceLinkDeviceType != ''"> and interface_link_device_type = #{interfaceLinkDeviceType}</if>
<if test="effectiveBandwidth95Daily != null "> and effective_bandwidth_95_daily = #{effectiveBandwidth95Daily}</if>
<if test="effectiveBandwidth95Monthly != null "> and effective_bandwidth_95_monthly = #{effectiveBandwidth95Monthly}</if>
<if test="effectiveAvgMonthlyBandwidth95 != null "> and effective_avg_monthly_bandwidth_95 = #{effectiveAvgMonthlyBandwidth95}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
<if test="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
<if test="createDatetime != null "> and create_datetime = #{createDatetime}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="serverClientId != null and serverClientId != ''"> and server_client_id = #{serverClientId}</if>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
<if test="createTime != null"> and create_time = #{createTime}</if>
<if test="nodeNames != null and nodeNames.size() > 0">
AND node_name IN
<foreach collection="nodeNames" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</if>
<if test="switchNames != null and switchNames.size() > 0">
AND uplink_switch IN
<foreach collection="switchNames" item="switchName" open="(" separator="," close=")">
#{switchName}
</foreach>
</if>
</where>
order by create_time desc
</select>
<select id="selectEpsNodeBandwidthById" parameterType="Long" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
where id = #{id}
</select>
<insert id="insertEpsNodeBandwidth" parameterType="EpsNodeBandwidth" useGeneratedKeys="true" keyProperty="id">
insert into eps_node_bandwidth
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nodeName != null">node_name,</if>
<if test="hardwareSn != null">hardware_sn,</if>
<if test="calculationMode != null">calculation_mode,</if>
<if test="bandwidthType != null">bandwidth_type,</if>
<if test="bandwidthResult != null">bandwidth_result,</if>
<if test="bandwidth95Daily != null">bandwidth_95_daily,</if>
<if test="bandwidth95Monthly != null">bandwidth_95_monthly,</if>
<if test="avgMonthlyBandwidth95 != null">avg_monthly_bandwidth_95,</if>
<if test="packageBandwidthDaily != null">package_bandwidth_daily,</if>
<if test="machineFlow != null">machine_flow,</if>
<if test="uplinkSwitch != null">uplink_switch,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="interfaceName != null">interface_name,</if>
<if test="resourceType != null">resource_type,</if>
<if test="interfaceLinkDeviceType != null">interface_link_device_type,</if>
<if test="effectiveBandwidth95Daily != null">effective_bandwidth_95_daily,</if>
<if test="effectiveBandwidth95Monthly != null">effective_bandwidth_95_monthly,</if>
<if test="effectiveAvgMonthlyBandwidth95 != null">effective_avg_monthly_bandwidth_95,</if>
<if test="businessName != null">business_name,</if>
<if test="businessId != null">business_id,</if>
<if test="remark1 != null">remark1,</if>
<if test="createDatetime != null">create_datetime,</if>
<if test="clientId != null">client_id,</if>
<if test="serverClientId != null">server_client_id,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
create_time,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="nodeName != null">#{nodeName},</if>
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="calculationMode != null">#{calculationMode},</if>
<if test="bandwidthType != null">#{bandwidthType},</if>
<if test="bandwidthResult != null">#{bandwidthResult},</if>
<if test="bandwidth95Daily != null">#{bandwidth95Daily},</if>
<if test="bandwidth95Monthly != null">#{bandwidth95Monthly},</if>
<if test="avgMonthlyBandwidth95 != null">#{avgMonthlyBandwidth95},</if>
<if test="packageBandwidthDaily != null">#{packageBandwidthDaily},</if>
<if test="machineFlow != null">#{machineFlow},</if>
<if test="uplinkSwitch != null">#{uplinkSwitch},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="interfaceName != null">#{interfaceName},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="interfaceLinkDeviceType != null">#{interfaceLinkDeviceType},</if>
<if test="effectiveBandwidth95Daily != null">#{effectiveBandwidth95Daily},</if>
<if test="effectiveBandwidth95Monthly != null">#{effectiveBandwidth95Monthly},</if>
<if test="effectiveAvgMonthlyBandwidth95 != null">#{effectiveAvgMonthlyBandwidth95},</if>
<if test="businessName != null">#{businessName},</if>
<if test="businessId != null">#{businessId},</if>
<if test="remark1 != null">#{remark1},</if>
<if test="createDatetime != null">#{createDatetime},</if>
<if test="clientId != null">#{clientId},</if>
<if test="serverClientId != null">#{serverClientId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<choose>
<when test="createTime != null">
#{createTime},
</when>
<otherwise>
NOW(),
</otherwise>
</choose>
<choose>
<when test="updateTime != null">
#{updateTime},
</when>
<otherwise>
NOW(),
</otherwise>
</choose>
</trim>
</insert>
<update id="updateEpsNodeBandwidth" parameterType="EpsNodeBandwidth">
update eps_node_bandwidth
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="calculationMode != null">calculation_mode = #{calculationMode},</if>
<if test="bandwidthType != null">bandwidth_type = #{bandwidthType},</if>
<if test="bandwidthResult != null">bandwidth_result = #{bandwidthResult},</if>
<if test="bandwidth95Daily != null">bandwidth_95_daily = #{bandwidth95Daily},</if>
<if test="bandwidth95Monthly != null">bandwidth_95_monthly = #{bandwidth95Monthly},</if>
<if test="avgMonthlyBandwidth95 != null">avg_monthly_bandwidth_95 = #{avgMonthlyBandwidth95},</if>
<if test="packageBandwidthDaily != null">package_bandwidth_daily = #{packageBandwidthDaily},</if>
<if test="machineFlow != null">machine_flow = #{machineFlow},</if>
<if test="uplinkSwitch != null">uplink_switch = #{uplinkSwitch},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="interfaceLinkDeviceType != null">interface_link_device_type = #{interfaceLinkDeviceType},</if>
<if test="effectiveBandwidth95Daily != null">effective_bandwidth_95_daily = #{effectiveBandwidth95Daily},</if>
<if test="effectiveBandwidth95Monthly != null">effective_bandwidth_95_monthly = #{effectiveBandwidth95Monthly},</if>
<if test="effectiveAvgMonthlyBandwidth95 != null">effective_avg_monthly_bandwidth_95 = #{effectiveAvgMonthlyBandwidth95},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="businessId != null">business_id = #{businessId},</if>
<if test="remark1 != null">remark1 = #{remark1},</if>
<if test="createDatetime != null">create_datetime = #{createDatetime},</if>
<if test="clientId != null">client_id = #{clientId},</if>
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<update id="updateEpsNodeBandwidthByServerSn" parameterType="EpsNodeBandwidth">
update eps_node_bandwidth
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
</trim>
where hardware_sn = #{hardwareSn}
</update>
<update id="updateEpsNodeBandwidthBySwitchSn" parameterType="EpsNodeBandwidth">
update eps_node_bandwidth
<trim prefix="SET" suffixOverrides=",">
<if test="uplinkSwitch != null">uplink_switch = #{uplinkSwitch},</if>
</trim>
where switch_sn = #{switchSn}
</update>
<delete id="deleteEpsNodeBandwidthById" parameterType="Long">
delete from eps_node_bandwidth where id = #{id}
</delete>
<delete id="deleteEpsNodeBandwidthByIds" parameterType="String">
delete from eps_node_bandwidth where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="calculateAvg" parameterType="EpsNodeBandwidth" resultType="EpsNodeBandwidth">
select sum(ifnull(bandwidth_95_daily,0)) bandwidth95Daily,
sum(ifnull(effective_bandwidth_95_daily,0)) effectiveBandwidth95Daily
from eps_node_bandwidth
<where>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
<if test="monthTime != null">
and left(create_time,7) = #{monthTime}
</if>
<if test="nodeName != '' and nodeName != null">
and node_name = #{nodeName}
</if>
<if test="hardwareSn != '' and hardwareSn != null">
and hardware_sn = #{hardwareSn}
</if>
<if test="switchSn != '' and switchSn != null">
and switch_sn = #{switchSn}
</if>
<if test="interfaceName != '' and interfaceName != null">
and interface_name = #{interfaceName}
</if>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
<if test="calculationMode != '' and calculationMode != null">
and calculation_mode = #{calculationMode}
</if>
<if test="clientId != '' and clientId != null">
and client_id = #{clientId}
</if>
</where>
</select>
<select id="getAvgDetailMsg" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
<where>
<if test="createTime != null">
and left(create_time,7) = left(#{createTime},7)
</if>
<if test="hardwareSn != '' and hardwareSn != null">
and hardware_sn = #{hardwareSn}
</if>
<if test="nodeName != '' and nodeName != null">
and node_name = #{nodeName}
</if>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
<if test="clientId != '' and clientId != null">
and client_id = #{clientId}
</if>
</where>
</select>
<select id="countByAvgMsg" parameterType="EpsNodeBandwidth">
select count(1) from from eps_node_bandwidth
<where>
<if test="createTime != null">
and left(create_time,7) = #{createTime}
</if>
<if test="nodeName != '' and nodeName != null">
and node_name = #{nodeName}
</if>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
<if test="clientId != '' and clientId != null">
and client_id = #{clientId}
</if>
</where>
</select>
<select id="getListByMonitorView" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="calculationMode != null and calculationMode != ''"> and calculation_mode = #{calculationMode}</if>
<if test="bandwidthType != null and bandwidthType != ''"> and bandwidth_type = #{bandwidthType}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
<if test="clientIds != '' and clientIds != null">
and client_id in
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
#{clientId}
</foreach>
</if>
</where>
order by bandwidth_95_daily asc
</select>
</mapper>
@@ -0,0 +1,183 @@
<?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.tongran.system.mapper.EpsServerRevenueConfigMapper">
<resultMap type="EpsServerRevenueConfig" id="EpsServerRevenueConfigResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
<result property="revenueMethod" column="revenue_method" />
<result property="hardwareSn" column="hardware_sn" />
<result property="trafficPort" column="traffic_port" />
<result property="bandwidth95" column="bandwidth_95" />
<result property="packageBandwidth" column="package_bandwidth" />
<result property="updateTime" column="update_time" />
<result property="businessName" column="business_name" />
<result property="businessCode" column="business_code" />
<result property="registrationStatus" column="registration_status" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="changed" column="changed" />
<result property="serverIp" column="server_ip" />
</resultMap>
<sql id="selectEpsServerRevenueConfigVo">
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time, changed, server_ip from eps_server_revenue_config
</sql>
<select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/>
<where>
and registration_status = "1"
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="trafficPort != null and trafficPort != ''"> and traffic_port = #{trafficPort}</if>
<if test="bandwidth95 != null "> and bandwidth_95 = #{bandwidth95}</if>
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="changed != null and changed != ''"> and changed = #{changed}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where>
</select>
<select id="selectEpsServerRevenueConfigById" parameterType="Long" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/>
where id = #{id}
</select>
<insert id="insertEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
insert into eps_server_revenue_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="nodeName != null">node_name,</if>
<if test="revenueMethod != null">revenue_method,</if>
<if test="hardwareSn != null">hardware_sn,</if>
<if test="trafficPort != null">traffic_port,</if>
<if test="bandwidth95 != null">bandwidth_95,</if>
<if test="packageBandwidth != null">package_bandwidth,</if>
<if test="updateTime != null">update_time,</if>
<if test="businessName != null">business_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="registrationStatus != null">registration_status,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="changed != null">changed,</if>
<if test="serverIp != null">server_ip,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="revenueMethod != null">#{revenueMethod},</if>
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="trafficPort != null">#{trafficPort},</if>
<if test="bandwidth95 != null">#{bandwidth95},</if>
<if test="packageBandwidth != null">#{packageBandwidth},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="businessName != null">#{businessName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="registrationStatus != null">#{registrationStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="changed != null">#{changed},</if>
<if test="serverIp != null">#{serverIp},</if>
</trim>
</insert>
<update id="updateEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
update eps_server_revenue_config
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="revenueMethod != null">revenue_method = #{revenueMethod},</if>
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="trafficPort != null">traffic_port = #{trafficPort},</if>
<if test="bandwidth95 != null">bandwidth_95 = #{bandwidth95},</if>
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="registrationStatus != null">registration_status = #{registrationStatus},</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="changed != null">changed = #{changed},</if>
<if test="serverIp != null">server_ip = #{serverIp},</if>
</trim>
where id = #{id}
</update>
<update id="updateEpsServerRevenueConfigByServerSn" parameterType="EpsServerRevenueConfig">
update eps_server_revenue_config
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
</trim>
where hardware_sn = #{hardwareSn}
</update>
<delete id="deleteEpsServerRevenueConfigById" parameterType="Long">
delete from eps_server_revenue_config where id = #{id}
</delete>
<delete id="deleteEpsServerRevenueConfigByIds" parameterType="String">
delete from eps_server_revenue_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getNodeMsgByIp" parameterType="String" resultType="java.util.Map">
SELECT
rrr.hardware_sn AS hardwareSn,
rrr.resource_name AS resourceName,
esrc.revenue_method AS revenueMethod,
esrc.business_code AS businessCode,
esrc.business_name AS businessName,
esrc.package_bandwidth AS packageBandwidth
FROM
rm_resource_registration rrr
LEFT JOIN
eps_server_revenue_config esrc
ON
rrr.hardware_sn = esrc.hardware_sn
<where>
and rrr.registration_status = '1'
and rrr.ip_address = #{ipAddress}
</where>
</select>
<select id="getNodeMsgBySn" parameterType="String" resultType="java.util.Map">
SELECT
rrr.hardware_sn AS hardwareSn,
rrr.resource_name AS resourceName,
esrc.revenue_method AS revenueMethod,
esrc.business_code AS businessCode,
esrc.business_name AS businessName,
esrc.package_bandwidth AS packageBandwidth
FROM
rm_resource_registration rrr
LEFT JOIN
eps_server_revenue_config esrc
ON
rrr.hardware_sn = esrc.hardware_sn
<where>
and rrr.registration_status = '1'
and rrr.hardware_sn = #{hardwareSn}
</where>
</select>
<select id="countBySn" parameterType="String">
<include refid="selectEpsServerRevenueConfigVo"/>
where hardware_sn = #{hardwareSn}
</select>
<select id="countBusinessByTraffic" resultType="java.lang.Integer">
select count(1) from eps_server_revenue_config a left join rm_resource_registration b on a.hardware_sn=b.hardware_sn where a.revenue_method = '1' and b.online_status='1'
</select>
<select id="countDeviceNumTop5" resultType="java.util.Map">
select count(1) total,a.business_name businessName from eps_server_revenue_config a left join rm_resource_registration b on a.hardware_sn=b.hardware_sn where a.revenue_method = '1' and b.online_status='1' group by a.business_name order by total desc limit 5
</select>
</mapper>
@@ -0,0 +1,127 @@
<?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.tongran.system.mapper.EpsTaskStatisticsMapper">
<resultMap type="EpsTaskStatistics" id="EpsTaskStatisticsResult">
<result property="id" column="id" />
<result property="taskName" column="task_name" />
<result property="businessCode" column="business_code" />
<result property="businessName" column="business_name" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="percentile95" column="percentile_95" />
<result property="monthlyAvgPercentile95" column="monthly_avg_percentile_95" />
<result property="resourceType" column="resource_type" />
<result property="includedResources" column="included_resources" />
<result property="calculationType" column="calculation_type" />
<result property="calculationMode" column="calculation_mode" />
<result property="taskStatus" column="task_status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEpsTaskStatisticsVo">
select id, task_name, business_code, business_name, start_time, end_time, percentile_95, monthly_avg_percentile_95, resource_type, included_resources, calculation_type, calculation_mode, task_status, create_time, update_time, create_by, update_by from eps_task_statistics
</sql>
<select id="selectEpsTaskStatisticsList" parameterType="EpsTaskStatistics" resultMap="EpsTaskStatisticsResult">
<include refid="selectEpsTaskStatisticsVo"/>
<where>
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</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 startTime != ''"> and start_time = #{startTime}</if>
<if test="endTime != null and endTime != ''"> and end_time = #{endTime}</if>
<if test="percentile95 != null "> and percentile_95 = #{percentile95}</if>
<if test="monthlyAvgPercentile95 != null "> and monthly_avg_percentile_95 = #{monthlyAvgPercentile95}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="includedResources != null and includedResources != ''"> and included_resources = #{includedResources}</if>
<if test="calculationType != null and calculationType != ''"> and calculation_type = #{calculationType}</if>
<if test="calculationMode != null and calculationMode != ''"> and calculation_mode = #{calculationMode}</if>
<if test="taskStatus != null and taskStatus != ''"> and task_status = #{taskStatus}</if>
</where>
</select>
<select id="selectEpsTaskStatisticsById" parameterType="Long" resultMap="EpsTaskStatisticsResult">
<include refid="selectEpsTaskStatisticsVo"/>
where id = #{id}
</select>
<insert id="insertEpsTaskStatistics" parameterType="EpsTaskStatistics" useGeneratedKeys="true" keyProperty="id">
insert into eps_task_statistics
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="businessName != null and businessName != ''">business_name,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="percentile95 != null">percentile_95,</if>
<if test="monthlyAvgPercentile95 != null">monthly_avg_percentile_95,</if>
<if test="resourceType != null">resource_type,</if>
<if test="includedResources != null">included_resources,</if>
<if test="calculationType != null">calculation_type,</if>
<if test="calculationMode != null">calculation_mode,</if>
<if test="taskStatus != null and taskStatus != ''">task_status,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">#{taskName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null and businessName != ''">#{businessName},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="percentile95 != null">#{percentile95},</if>
<if test="monthlyAvgPercentile95 != null">#{monthlyAvgPercentile95},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="includedResources != null">#{includedResources},</if>
<if test="calculationType != null">#{calculationType},</if>
<if test="calculationMode != null">#{calculationMode},</if>
<if test="taskStatus != null and taskStatus != ''">#{taskStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateEpsTaskStatistics" parameterType="EpsTaskStatistics">
update eps_task_statistics
<trim prefix="SET" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="percentile95 != null">percentile_95 = #{percentile95},</if>
<if test="monthlyAvgPercentile95 != null">monthly_avg_percentile_95 = #{monthlyAvgPercentile95},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="includedResources != null">included_resources = #{includedResources},</if>
<if test="calculationType != null">calculation_type = #{calculationType},</if>
<if test="calculationMode != null">calculation_mode = #{calculationMode},</if>
<if test="taskStatus != null and taskStatus != ''">task_status = #{taskStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsTaskStatisticsById" parameterType="Long">
delete from eps_task_statistics where id = #{id}
</delete>
<delete id="deleteEpsTaskStatisticsByIds" parameterType="String">
delete from eps_task_statistics where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,114 @@
<?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.tongran.system.mapper.EpsTrafficDataMapper">
<resultMap type="EpsTrafficData" id="EpsTrafficDataResult">
<result property="id" column="id" />
<result property="hardwareSn" column="hardware_sn" />
<result property="nodeName" column="node_name" />
<result property="revenueMethod" column="revenue_method" />
<result property="trafficPort" column="traffic_port" />
<result property="txBytes" column="tx_bytes" />
<result property="rxBytes" column="rx_bytes" />
<result property="packageBandwidth" column="package_bandwidth" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectEpsTrafficDataVo">
select id, hardware_sn, node_name, revenue_method, traffic_port, tx_bytes, rx_bytes, package_bandwidth, create_time, update_time, creator_id, creator_name, updater_id, updater_name from eps_traffic_data
</sql>
<select id="selectEpsTrafficDataList" parameterType="EpsTrafficData" resultMap="EpsTrafficDataResult">
<include refid="selectEpsTrafficDataVo"/>
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="trafficPort != null and trafficPort != ''"> and traffic_port = #{trafficPort}</if>
<if test="txBytes != null "> and tx_bytes = #{txBytes}</if>
<if test="rxBytes != null "> and rx_bytes = #{rxBytes}</if>
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectEpsTrafficDataById" parameterType="Long" resultMap="EpsTrafficDataResult">
<include refid="selectEpsTrafficDataVo"/>
where id = #{id}
</select>
<insert id="insertEpsTrafficData" parameterType="EpsTrafficData" useGeneratedKeys="true" keyProperty="id">
insert into eps_traffic_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">hardware_sn,</if>
<if test="nodeName != null">node_name,</if>
<if test="revenueMethod != null">revenue_method,</if>
<if test="trafficPort != null">traffic_port,</if>
<if test="txBytes != null">tx_bytes,</if>
<if test="rxBytes != null">rx_bytes,</if>
<if test="packageBandwidth != null">package_bandwidth,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="revenueMethod != null">#{revenueMethod},</if>
<if test="trafficPort != null">#{trafficPort},</if>
<if test="txBytes != null">#{txBytes},</if>
<if test="rxBytes != null">#{rxBytes},</if>
<if test="packageBandwidth != null">#{packageBandwidth},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateEpsTrafficData" parameterType="EpsTrafficData">
update eps_traffic_data
<trim prefix="SET" suffixOverrides=",">
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="revenueMethod != null">revenue_method = #{revenueMethod},</if>
<if test="trafficPort != null">traffic_port = #{trafficPort},</if>
<if test="txBytes != null">tx_bytes = #{txBytes},</if>
<if test="rxBytes != null">rx_bytes = #{rxBytes},</if>
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsTrafficDataById" parameterType="Long">
delete from eps_traffic_data where id = #{id}
</delete>
<delete id="deleteEpsTrafficDataByIds" parameterType="String">
delete from eps_traffic_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,587 @@
<?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.tongran.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>
<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"/>
<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 &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{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 &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{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>
<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>
<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 &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{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 ${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>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{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>
<select id="geSwitchListByMonitorView" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
select switch_name switchName,client_id clientId, name, in_speed inSpeed, out_speed outSpeed, create_time createTime from initial_switch_info_details
<where>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{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="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 &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{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 &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{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 &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
</where>
order by create_time desc
</select>
</mapper>
@@ -0,0 +1,83 @@
<?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.tongran.system.mapper.KnowledgeBaseMapper">
<resultMap type="KnowledgeBase" id="KnowledgeBaseResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="issueType" column="issue_type" />
<result property="solution" column="solution" />
<result property="createTime" column="create_time" />
<result property="creatBy" column="creat_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectKnowledgeBaseVo">
select id, title, issue_type, solution, create_time, creat_by, update_time, update_by from knowledge_base
</sql>
<select id="selectKnowledgeBaseList" parameterType="KnowledgeBase" resultMap="KnowledgeBaseResult">
<include refid="selectKnowledgeBaseVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="issueType != null and issueType != ''"> and issue_type = #{issueType}</if>
<if test="solution != null and solution != ''"> and solution like concat('%', #{solution}, '%')</if>
<if test="creatBy != null and creatBy != ''"> and creat_by = #{creatBy}</if>
</where>
</select>
<select id="selectKnowledgeBaseById" parameterType="Long" resultMap="KnowledgeBaseResult">
<include refid="selectKnowledgeBaseVo"/>
where id = #{id}
</select>
<insert id="insertKnowledgeBase" parameterType="KnowledgeBase" useGeneratedKeys="true" keyProperty="id">
insert into knowledge_base
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="issueType != null">issue_type,</if>
<if test="solution != null">solution,</if>
<if test="createTime != null">create_time,</if>
<if test="creatBy != null">creat_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="issueType != null">#{issueType},</if>
<if test="solution != null">#{solution},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creatBy != null">#{creatBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateKnowledgeBase" parameterType="KnowledgeBase">
update knowledge_base
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="issueType != null">issue_type = #{issueType},</if>
<if test="solution != null">solution = #{solution},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creatBy != null">creat_by = #{creatBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteKnowledgeBaseById" parameterType="Long">
delete from knowledge_base where id = #{id}
</delete>
<delete id="deleteKnowledgeBaseByIds" parameterType="String">
delete from knowledge_base where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,114 @@
<?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.tongran.system.mapper.MtmMonitoringTemplateMapper">
<resultMap type="MtmMonitoringTemplate" id="MtmMonitoringTemplateResult">
<result property="id" column="id" />
<result property="templateName" column="template_name" />
<result property="description" column="description" />
<result property="itemType" column="item_type" />
<result property="includedResources" column="included_resources" />
<result property="discoveryItemType" column="discovery_item_type" />
<result property="itemName" column="item_name" />
<result property="itemDescription" column="item_description" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectMtmMonitoringTemplateVo">
select id, template_name, description, item_type, included_resources, discovery_item_type, item_name, item_description, create_time, update_time, creator_id, creator_name, updater_id, updater_name from mtm_monitoring_template
</sql>
<select id="selectMtmMonitoringTemplateList" parameterType="MtmMonitoringTemplate" resultMap="MtmMonitoringTemplateResult">
<include refid="selectMtmMonitoringTemplateVo"/>
<where>
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="includedResources != null and includedResources != ''"> and included_resources = #{includedResources}</if>
<if test="discoveryItemType != null and discoveryItemType != ''"> and discovery_item_type = #{discoveryItemType}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="itemDescription != null and itemDescription != ''"> and item_description = #{itemDescription}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectMtmMonitoringTemplateById" parameterType="Long" resultMap="MtmMonitoringTemplateResult">
<include refid="selectMtmMonitoringTemplateVo"/>
where id = #{id}
</select>
<insert id="insertMtmMonitoringTemplate" parameterType="MtmMonitoringTemplate" useGeneratedKeys="true" keyProperty="id">
insert into mtm_monitoring_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateName != null">template_name,</if>
<if test="description != null">description,</if>
<if test="itemType != null">item_type,</if>
<if test="includedResources != null">included_resources,</if>
<if test="discoveryItemType != null">discovery_item_type,</if>
<if test="itemName != null">item_name,</if>
<if test="itemDescription != null">item_description,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateName != null">#{templateName},</if>
<if test="description != null">#{description},</if>
<if test="itemType != null">#{itemType},</if>
<if test="includedResources != null">#{includedResources},</if>
<if test="discoveryItemType != null">#{discoveryItemType},</if>
<if test="itemName != null">#{itemName},</if>
<if test="itemDescription != null">#{itemDescription},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateMtmMonitoringTemplate" parameterType="MtmMonitoringTemplate">
update mtm_monitoring_template
<trim prefix="SET" suffixOverrides=",">
<if test="templateName != null">template_name = #{templateName},</if>
<if test="description != null">description = #{description},</if>
<if test="itemType != null">item_type = #{itemType},</if>
<if test="includedResources != null">included_resources = #{includedResources},</if>
<if test="discoveryItemType != null">discovery_item_type = #{discoveryItemType},</if>
<if test="itemName != null">item_name = #{itemName},</if>
<if test="itemDescription != null">item_description = #{itemDescription},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMtmMonitoringTemplateById" parameterType="Long">
delete from mtm_monitoring_template where id = #{id}
</delete>
<delete id="deleteMtmMonitoringTemplateByIds" parameterType="String">
delete from mtm_monitoring_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,155 @@
<?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.tongran.system.mapper.RmEpsTopologyManagementMapper">
<resultMap type="RmEpsTopologyManagement" id="RmEpsTopologyManagementResult">
<result property="id" column="id" />
<result property="switchName" column="switch_name" />
<result property="clientId" column="client_Id" />
<result property="switchSn" column="switch_sn" />
<result property="interfaceName" column="interface_name" />
<result property="connectedDeviceType" column="connected_device_type" />
<result property="serverName" column="server_name" />
<result property="serverSn" column="server_sn" />
<result property="serverPort" column="server_port" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
<result property="switchIpAddress" column="switch_ip_address" />
<result property="peerSwitchName" column="peer_switch_name" />
<result property="peerSwitchInterface" column="peer_switch_interface" />
<result property="serverClientId" column="server_client_id" />
</resultMap>
<sql id="selectRmEpsTopologyManagementVo">
select id, switch_name, client_id, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name, switch_ip_address, peer_switch_name, peer_switch_interface, server_client_id from rm_eps_topology_management
</sql>
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
<include refid="selectRmEpsTopologyManagementVo"/>
<where>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="connectedDeviceType != null and connectedDeviceType != ''"> and connected_device_type = #{connectedDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
<if test="switchIpAddress != null and switchIpAddress != ''"> and switch_ip_address = #{switchIpAddress}</if>
<if test="resourceName != null and resourceName != ''">and (switch_name like concat('%', #{resourceName}, '%') or server_name like concat('%', #{resourceName}, '%'))</if>
<if test="peerSwitchName != null and peerSwitchName != ''"> and peer_switch_name like concat('%', #{peerSwitchName}, '%')</if>
<if test="peerSwitchInterface != null and peerSwitchInterface != ''"> and peer_switch_interface = #{peerSwitchInterface}</if>
<if test="serverClientId != null and serverClientId != ''"> and server_client_id = #{serverClientId}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
</where>
</select>
<select id="selectRmEpsTopologyManagementById" parameterType="Long" resultMap="RmEpsTopologyManagementResult">
<include refid="selectRmEpsTopologyManagementVo"/>
where id = #{id}
</select>
<insert id="insertRmEpsTopologyManagement" parameterType="RmEpsTopologyManagement" useGeneratedKeys="true" keyProperty="id">
insert into rm_eps_topology_management
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="switchName != null">switch_name,</if>
<if test="clientId != null">client_id,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="interfaceName != null">interface_name,</if>
<if test="connectedDeviceType != null">connected_device_type,</if>
<if test="serverName != null">server_name,</if>
<if test="serverSn != null">server_sn,</if>
<if test="serverPort != null">server_port,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
<if test="switchIpAddress != null">switch_ip_address,</if>
<if test="peerSwitchName != null">peer_switch_name,</if>
<if test="peerSwitchInterface != null">peer_switch_interface,</if>
<if test="serverClientId != null">server_client_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchName != null">#{switchName},</if>
<if test="clientId != null">#{clientId},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="interfaceName != null">#{interfaceName},</if>
<if test="connectedDeviceType != null">#{connectedDeviceType},</if>
<if test="serverName != null">#{serverName},</if>
<if test="serverSn != null">#{serverSn},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
<if test="switchIpAddress != null">#{switchIpAddress},</if>
<if test="peerSwitchName != null">#{peerSwitchName},</if>
<if test="peerSwitchInterface != null">#{peerSwitchInterface},</if>
<if test="serverClientId != null">#{serverClientId},</if>
</trim>
</insert>
<update id="updateRmEpsTopologyManagement" parameterType="RmEpsTopologyManagement">
update rm_eps_topology_management
<trim prefix="SET" suffixOverrides=",">
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="clientId != null">client_id = #{clientId},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
<if test="connectedDeviceType != null">connected_device_type = #{connectedDeviceType},</if>
<if test="serverName != null">server_name = #{serverName},</if>
<if test="serverSn != null">server_sn = #{serverSn},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
<if test="switchIpAddress != null">switch_ip_address = #{switchIpAddress},</if>
<if test="peerSwitchName != null">peer_switch_name = #{peerSwitchName},</if>
<if test="peerSwitchInterface != null">peer_switch_interface = #{peerSwitchInterface},</if>
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
</trim>
where id = #{id}
</update>
<update id="updateRmEpsTopologyManagementByServerSn" parameterType="RmEpsTopologyManagement">
update rm_eps_topology_management
<trim prefix="SET" suffixOverrides=",">
<if test="serverName != null">`server_name` = #{serverName},</if>
</trim>
where server_sn = #{serverSn}
</update>
<update id="updateRmEpsTopologyManagementBySwitchSn" parameterType="RmEpsTopologyManagement">
update rm_eps_topology_management
<trim prefix="SET" suffixOverrides=",">
<if test="switchName != null">`switch_name` = #{switchName},</if>
</trim>
where switch_sn = #{switchSn}
</update>
<delete id="deleteRmEpsTopologyManagementById" parameterType="Long">
delete from rm_eps_topology_management where id = #{id}
</delete>
<delete id="deleteRmEpsTopologyManagementByIds" parameterType="String">
delete from rm_eps_topology_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,124 @@
<?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.tongran.system.mapper.RmMonitorConfigDetailsMapper">
<resultMap type="RmMonitorConfigDetails" id="RmMonitorConfigDetailsResult">
<result property="id" column="id" />
<result property="monitorId" column="monitor_id" />
<result property="deployDevice" column="deploy_device" />
<result property="inBytes" column="in_bytes" />
<result property="outBytes" column="out_bytes" />
<result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectRmMonitorConfigDetailsVo">
select id, monitor_id, deploy_device, in_bytes, out_bytes, in_speed, out_speed, create_by, update_by, create_time, update_time from rm_monitor_config_details
</sql>
<select id="selectRmMonitorConfigDetailsList" parameterType="RmMonitorConfigDetails" resultMap="RmMonitorConfigDetailsResult">
<include refid="selectRmMonitorConfigDetailsVo"/>
<where>
<if test="monitorId != null "> and monitor_id = #{monitorId}</if>
<if test="deployDevice != null and deployDevice != ''"> and deploy_device = #{deployDevice}</if>
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
</where>
</select>
<select id="selectRmMonitorConfigDetailsById" parameterType="Long" resultMap="RmMonitorConfigDetailsResult">
<include refid="selectRmMonitorConfigDetailsVo"/>
where id = #{id}
</select>
<insert id="insertRmMonitorConfigDetails" parameterType="RmMonitorConfigDetails" useGeneratedKeys="true" keyProperty="id">
insert into rm_monitor_config_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="monitorId != null">monitor_id,</if>
<if test="deployDevice != null">deploy_device,</if>
<if test="inBytes != null">in_bytes,</if>
<if test="outBytes != null">out_bytes,</if>
<if test="inSpeed != null">in_speed,</if>
<if test="outSpeed != null">out_speed,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorId != null">#{monitorId},</if>
<if test="deployDevice != null">#{deployDevice},</if>
<if test="inBytes != null">#{inBytes},</if>
<if test="outBytes != null">#{outBytes},</if>
<if test="inSpeed != null">#{inSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</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>
</trim>
</insert>
<update id="updateRmMonitorConfigDetails" parameterType="RmMonitorConfigDetails">
update rm_monitor_config_details
<trim prefix="SET" suffixOverrides=",">
<if test="monitorId != null">monitor_id = #{monitorId},</if>
<if test="deployDevice != null">deploy_device = #{deployDevice},</if>
<if test="inBytes != null">in_bytes = #{inBytes},</if>
<if test="outBytes != null">out_bytes = #{outBytes},</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteRmMonitorConfigDetailsById" parameterType="Long">
delete from rm_monitor_config_details where id = #{id}
</delete>
<delete id="deleteRmMonitorConfigDetailsByIds" parameterType="String">
delete from rm_monitor_config_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteRmMonitorConfigDetailsByMonitorIds" parameterType="Long">
delete from rm_monitor_config_details where monitor_id in
<foreach item="monitorId" collection="array" open="(" separator="," close=")">
#{monitorId}
</foreach>
</delete>
<insert id="batchInsertRmMonitorConfigDetails" parameterType="java.util.List">
insert IGNORE into rm_monitor_config_details
(monitor_id, deploy_device, in_bytes, out_bytes, in_speed, out_speed, create_by, update_by, create_time, update_time)
values
<foreach collection="list" item="item" separator=",">
(
#{item.monitorId},
#{item.deployDevice},
#{item.inBytes},
#{item.outBytes},
#{item.inSpeed},
#{item.outSpeed},
#{item.createBy},
#{item.updateBy},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
</mapper>
@@ -0,0 +1,97 @@
<?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.tongran.system.mapper.RmMonitorConfigMapper">
<resultMap type="RmMonitorConfig" id="RmMonitorConfigResult">
<result property="id" column="id" />
<result property="configName" column="config_name" />
<result property="monitorStartTime" column="monitor_start_time" />
<result property="resourceType" column="resource_type" />
<result property="businessCode" column="business_code" />
<result property="businessName" column="business_name" />
<result property="deployDevice" column="deploy_device" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectRmMonitorConfigVo">
select id, config_name, monitor_start_time, resource_type, business_code, business_name, deploy_device, create_time, update_time, create_by, update_by from rm_monitor_config
</sql>
<select id="selectRmMonitorConfigList" parameterType="RmMonitorConfig" resultMap="RmMonitorConfigResult">
<include refid="selectRmMonitorConfigVo"/>
<where>
<if test="configName != null and configName != ''"> and config_name = #{configName}</if>
<if test="monitorStartTime != null and monitorStartTime != ''"> and monitor_start_time = #{monitorStartTime}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</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="deployDevice != null and deployDevice != ''"> and deploy_device = #{deployDevice}</if>
</where>
</select>
<select id="selectRmMonitorConfigById" parameterType="Long" resultMap="RmMonitorConfigResult">
<include refid="selectRmMonitorConfigVo"/>
where id = #{id}
</select>
<insert id="insertRmMonitorConfig" parameterType="RmMonitorConfig" useGeneratedKeys="true" keyProperty="id">
insert into rm_monitor_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="configName != null and configName != ''">config_name,</if>
<if test="monitorStartTime != null and monitorStartTime != ''">monitor_start_time,</if>
<if test="resourceType != null and resourceType != ''">resource_type,</if>
<if test="businessCode != null">business_code,</if>
<if test="businessName != null">business_name,</if>
<if test="deployDevice != null and deployDevice != ''">deploy_device,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="configName != null and configName != ''">#{configName},</if>
<if test="monitorStartTime != null and monitorStartTime != ''">#{monitorStartTime},</if>
<if test="resourceType != null and resourceType != ''">#{resourceType},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null">#{businessName},</if>
<if test="deployDevice != null and deployDevice != ''">#{deployDevice},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateRmMonitorConfig" parameterType="RmMonitorConfig">
update rm_monitor_config
<trim prefix="SET" suffixOverrides=",">
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="monitorStartTime != null and monitorStartTime != ''">monitor_start_time = #{monitorStartTime},</if>
<if test="resourceType != null and resourceType != ''">resource_type = #{resourceType},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="deployDevice != null and deployDevice != ''">deploy_device = #{deployDevice},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmMonitorConfigById" parameterType="Long">
delete from rm_monitor_config where id = #{id}
</delete>
<delete id="deleteRmMonitorConfigByIds" parameterType="String">
delete from rm_monitor_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,85 @@
<?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.tongran.system.mapper.RmRegistrationMachineMapper">
<resultMap type="RmRegistrationMachine" id="RmRegistrationMachineResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
<result property="machineCode" column="machine_code" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectRmRegistrationMachineVo">
select id, client_id, machine_code, create_time, update_time, create_by, update_by from rm_registration_machine
</sql>
<select id="selectRmRegistrationMachineList" parameterType="RmRegistrationMachine" resultMap="RmRegistrationMachineResult">
<include refid="selectRmRegistrationMachineVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="machineCode != null and machineCode != ''"> and machine_code = #{machineCode}</if>
</where>
</select>
<select id="selectRmRegistrationMachineById" parameterType="Long" resultMap="RmRegistrationMachineResult">
<include refid="selectRmRegistrationMachineVo"/>
where id = #{id}
</select>
<insert id="insertRmRegistrationMachine" parameterType="RmRegistrationMachine" useGeneratedKeys="true" keyProperty="id">
insert into rm_registration_machine
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="machineCode != null and machineCode != ''">machine_code,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="machineCode != null and machineCode != ''">#{machineCode},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateRmRegistrationMachine" parameterType="RmRegistrationMachine">
update rm_registration_machine
<trim prefix="SET" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="machineCode != null and machineCode != ''">machine_code = #{machineCode},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmRegistrationMachineById" parameterType="Long">
delete from rm_registration_machine where id = #{id}
</delete>
<delete id="deleteRmRegistrationMachineByIds" parameterType="String">
delete from rm_registration_machine where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getAllMachineClientId" resultType="RmRegistrationMachine">
select client_id clientId from rm_registration_machine
<where>
and client_id != ''
</where>
group by client_id
</select>
</mapper>
@@ -0,0 +1,119 @@
<?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.tongran.system.mapper.RmResourceGroupMapper">
<resultMap type="RmResourceGroup" id="RmResourceGroupResult">
<result property="id" column="id" />
<result property="groupName" column="group_name" />
<result property="description" column="description" />
<result property="includedDevicesId" column="included_devices_id" />
<result property="includedDevicesName" column="included_devices_name" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectRmResourceGroupVo">
select id, group_name, description, included_devices_id, included_devices_name, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_group
</sql>
<select id="selectRmResourceGroupList" parameterType="RmResourceGroup" resultMap="RmResourceGroupResult">
<include refid="selectRmResourceGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="includedDevicesId != null and includedDevicesId != ''"> and included_devices_id = #{includedDevicesId}</if>
<if test="includedDevicesName != null and includedDevicesName != ''"> and included_devices_name like concat('%', #{includedDevicesName}, '%')</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectRmResourceGroupById" parameterType="Long" resultMap="RmResourceGroupResult">
<include refid="selectRmResourceGroupVo"/>
where id = #{id}
</select>
<insert id="insertRmResourceGroup" parameterType="RmResourceGroup" useGeneratedKeys="true" keyProperty="id">
insert into rm_resource_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupName != null">group_name,</if>
<if test="description != null">description,</if>
<if test="includedDevicesId != null">included_devices_id,</if>
<if test="includedDevicesName != null">included_devices_name,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupName != null">#{groupName},</if>
<if test="description != null">#{description},</if>
<if test="includedDevicesId != null">#{includedDevicesId},</if>
<if test="includedDevicesName != null">#{includedDevicesName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateRmResourceGroup" parameterType="RmResourceGroup">
update rm_resource_group
<trim prefix="SET" suffixOverrides=",">
<if test="groupName != null">group_name = #{groupName},</if>
<if test="description != null">description = #{description},</if>
<if test="includedDevicesId != null">included_devices_id = #{includedDevicesId},</if>
<if test="includedDevicesName != null">included_devices_name = #{includedDevicesName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmResourceGroupById" parameterType="Long">
delete from rm_resource_group where id = #{id}
</delete>
<delete id="deleteRmResourceGroupByIds" parameterType="String">
delete from rm_resource_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectMonitorMsgAndGroupMsg" parameterType="Long" resultType="RmResourceGroup">
select b.monitor_items monitorItems,b.discovery_rules discoveryRules from rm_resource_group a left join rm_monitor_template b on a.id=b.resource_group_id
where FIND_IN_SET(#{id}, a.included_devices_id) > 0
limit 1
</select>
<select id="exitsResourceById" parameterType="RmResourceGroup" resultType="java.lang.Integer">
select count(1) from rm_resource_group
where FIND_IN_SET(#{resourceIds}, included_devices_id) > 0
</select>
<update id="updateRmPolicyStatus" parameterType="Long">
update rm_monitor_policy set status = '0'
where resource_group_id = #{resourceGroupId}
</update>
<update id="updateScriptPolicyStatus" parameterType="Long">
update rm_deployment_policy set policy_status = '0'
where resource_group_id = #{resourceGroupId}
</update>
</mapper>
@@ -0,0 +1,420 @@
<?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.tongran.system.mapper.RmResourceRegistrationMapper">
<resultMap type="RmResourceRegistration" id="RmResourceRegistrationResult">
<result property="id" column="id" />
<result property="hardwareSn" column="hardware_sn" />
<result property="resourceType" column="resource_type" />
<result property="resourceName" column="resource_name" />
<result property="ipAddress" column="ip_address" />
<result property="resourcePort" column="resource_port" />
<result property="otherPortName" column="other_port_name" />
<result property="agentVersion" column="agent_version" />
<result property="protocol" column="protocol" />
<result property="resourceVersion" column="resource_version" />
<result property="rwPermission" column="rw_permission" />
<result property="snmpDetect" column="snmp_detect" />
<result property="teamName" column="team_name" />
<result property="snmpCollectAddr" column="snmp_collect_addr" />
<result property="snmpCollectPort" column="snmp_collect_port" />
<result property="securityLevel" column="security_level" />
<result property="encryption" column="encryption" />
<result property="resourceUserName" column="resource_user_name" />
<result property="resourcePwd" column="resource_pwd" />
<result property="registrationStatus" column="registration_status" />
<result property="onlineStatus" column="online_status" />
<result property="switchOnlineStatus" column="switch_online_status" />
<result property="description" column="description" />
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="serviceNumber" column="service_number" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
<result property="clientId" column="client_id" />
<result property="operator" column="operator" />
<result property="province" column="province" />
<result property="publicIp" column="public_ip" />
<result property="businessName" column="business_name" />
<result property="logicalNodeId" column="logical_node_id" />
<result property="multiPublicIpStatus" column="multi_public_ip_status" />
<result property="heartbeatCount" column="heartbeat_count" />
<result property="heartbeatInterval" column="heartbeat_interval" />
<result property="onboardTime" column="onboard_time" />
</resultMap>
<sql id="selectRmResourceRegistrationVo">
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name,
agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr,
snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status,
online_status, switch_online_status, description, customer_id, customer_name, service_number,
create_time, update_time, creator_id, creator_name, updater_id, updater_name, client_id, operator,
province, public_ip, business_name, logical_node_id, multi_public_ip_status, heartbeat_count,
heartbeat_interval, onboard_time from rm_resource_registration
</sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name like concat('%', #{otherPortName}, '%')</if>
<if test="agentVersion != null and agentVersion != ''"> and agent_version = #{agentVersion}</if>
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
<if test="snmpDetect != null and snmpDetect != ''"> and snmp_detect = #{snmpDetect}</if>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="snmpCollectAddr != null and snmpCollectAddr != ''"> and snmp_collect_addr = #{snmpCollectAddr}</if>
<if test="snmpCollectPort != null "> and snmp_collect_port = #{snmpCollectPort}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name like concat('%', #{resourceUserName}, '%')</if>
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="switchOnlineStatus != null and switchOnlineStatus != ''"> and switch_online_status = #{switchOnlineStatus}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
<if test="queryName != null and queryName != ''"> and (hardware_sn = #{queryName} or resource_name like concat('%', #{queryName}, '%')) </if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="operator != null and operator != ''"> and operator = #{operator}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="publicIp != null and publicIp != ''"> and public_ip = #{publicIp}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="logicalNodeId != null and logicalNodeId != ''"> and logical_node_id = #{logicalNodeId}</if>
<if test="multiPublicIpStatus != null and multiPublicIpStatus != ''"> and multi_public_ip_status = #{multiPublicIpStatus}</if>
</where>
order by create_time desc
</select>
<select id="selectRmResourceRegistrationById" parameterType="Long" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
where id = #{id}
</select>
<insert id="insertRmResourceRegistration" parameterType="RmResourceRegistration" useGeneratedKeys="true" keyProperty="id">
insert into rm_resource_registration
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">hardware_sn,</if>
<if test="resourceType != null">resource_type,</if>
<if test="resourceName != null">resource_name,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="resourcePort != null">resource_port,</if>
<if test="otherPortName != null">other_port_name,</if>
<if test="agentVersion != null">agent_version,</if>
<if test="protocol != null">protocol,</if>
<if test="resourceVersion != null">resource_version,</if>
<if test="rwPermission != null">rw_permission,</if>
<if test="snmpDetect != null">snmp_detect,</if>
<if test="teamName != null">team_name,</if>
<if test="snmpCollectAddr != null">snmp_collect_addr,</if>
<if test="snmpCollectPort != null">snmp_collect_port,</if>
<if test="securityLevel != null">security_level,</if>
<if test="encryption != null">encryption,</if>
<if test="resourceUserName != null">resource_user_name,</if>
<if test="resourcePwd != null">resource_pwd,</if>
<if test="registrationStatus != null">registration_status,</if>
<if test="onlineStatus != null">online_status,</if>
<if test="switchOnlineStatus != null">switch_online_status,</if>
<if test="description != null">description,</if>
<if test="customerId != null">customer_id,</if>
<if test="customerName != null">customer_name,</if>
<if test="serviceNumber != null">service_number,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
<if test="clientId != null">client_id,</if>
<if test="operator != null">operator,</if>
<if test="province != null">province,</if>
<if test="publicIp != null">public_ip,</if>
<if test="businessName != null">business_name,</if>
<if test="logicalNodeId != null">logical_node_id,</if>
<if test="multiPublicIpStatus != null">multi_public_ip_status,</if>
<if test="heartbeatCount != null">heartbeat_count,</if>
<if test="heartbeatInterval != null">heartbeat_interval,</if>
<if test="onboardTime != null">onboard_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="resourceName != null">#{resourceName},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="resourcePort != null">#{resourcePort},</if>
<if test="otherPortName != null">#{otherPortName},</if>
<if test="agentVersion != null">#{agentVersion},</if>
<if test="protocol != null">#{protocol},</if>
<if test="resourceVersion != null">#{resourceVersion},</if>
<if test="rwPermission != null">#{rwPermission},</if>
<if test="snmpDetect != null">#{snmpDetect},</if>
<if test="teamName != null">#{teamName},</if>
<if test="snmpCollectAddr != null">#{snmpCollectAddr},</if>
<if test="snmpCollectPort != null">#{snmpCollectPort},</if>
<if test="securityLevel != null">#{securityLevel},</if>
<if test="encryption != null">#{encryption},</if>
<if test="resourceUserName != null">#{resourceUserName},</if>
<if test="resourcePwd != null">#{resourcePwd},</if>
<if test="registrationStatus != null">#{registrationStatus},</if>
<if test="onlineStatus != null">#{onlineStatus},</if>
<if test="switchOnlineStatus != null">#{switchOnlineStatus},</if>
<if test="description != null">#{description},</if>
<if test="customerId != null">#{customerId},</if>
<if test="customerName != null">#{customerName},</if>
<if test="serviceNumber != null">#{serviceNumber},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
<if test="clientId != null">#{clientId},</if>
<if test="operator != null">#{operator},</if>
<if test="province != null">#{province},</if>
<if test="publicIp != null">#{publicIp},</if>
<if test="businessName != null">#{businessName},</if>
<if test="logicalNodeId != null">#{logicalNodeId},</if>
<if test="multiPublicIpStatus != null">#{multiPublicIpStatus},</if>
<if test="heartbeatCount != null">#{heartbeatCount},</if>
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
<if test="onboardTime != null">#{onboardTime},</if>
</trim>
</insert>
<update id="updateRmResourceRegistration" parameterType="RmResourceRegistration">
update rm_resource_registration
<trim prefix="SET" suffixOverrides=",">
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="resourceName != null">resource_name = #{resourceName},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
<if test="protocol != null">protocol = #{protocol},</if>
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
<if test="teamName != null">team_name = #{teamName},</if>
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
<if test="snmpCollectPort != null">snmp_collect_port = #{snmpCollectPort},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
<if test="resourcePwd != null">resource_pwd = #{resourcePwd},</if>
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="switchOnlineStatus != null">switch_online_status = #{switchOnlineStatus},</if>
<if test="description != null">description = #{description},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
<if test="clientId != null">client_id = #{clientId},</if>
<if test="operator != null">operator = #{operator},</if>
<if test="province != null">province = #{province},</if>
<if test="publicIp != null">public_ip = #{publicIp},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="logicalNodeId != null">logical_node_id = #{logicalNodeId},</if>
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmResourceRegistrationById" parameterType="Long">
delete from rm_resource_registration where id = #{id}
</delete>
<delete id="deleteRmResourceRegistrationByIds" parameterType="String">
delete from rm_resource_registration where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 查询所有资源名称(包含设备使用)-->
<select id="selectAllResourceName" resultType="java.util.Map">
select id id,resource_name resourceName from rm_resource_registration
<where>
and registration_status = 1
</where>
group by id
</select>
<!-- 查询所有资源名称-->
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
SELECT
resource_name AS resourceName,
CASE
WHEN resource_type = '1' THEN ip_address
WHEN resource_type = '2' THEN snmp_collect_addr
END AS ipAddress,
hardware_sn AS hardwareSn
FROM rm_resource_registration
<where>
and registration_status = 1
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name = #{otherPortName}</if>
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name = #{resourceUserName}</if>
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
group by resource_name
</select>
<select id="countBySn" parameterType="String">
select count(1) from rm_resource_registration
where hardware_sn = #{hardwareSn}
</select>
<update id="updateStatusByResource" parameterType="RmResourceRegistration">
update rm_resource_registration
<trim prefix="SET" suffixOverrides=",">
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="resourceName != null">resource_name = #{resourceName},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
<if test="protocol != null">protocol = #{protocol},</if>
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
<if test="teamName != null">team_name = #{teamName},</if>
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
<if test="snmpCollectPort != null">snmp_collect_port = #{snmpCollectPort},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
<if test="resourcePwd != null">resource_pwd = #{resourcePwd},</if>
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="switchOnlineStatus != null">switch_online_status = #{switchOnlineStatus},</if>
<if test="description != null">description = #{description},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
<if test="clientId != null">client_id = #{clientId},</if>
<if test="operator != null">operator = #{operator},</if>
<if test="province != null">province = #{province},</if>
<if test="publicIp != null">public_ip = #{publicIp},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="logicalNodeId != null">logical_node_id = #{logicalNodeId},</if>
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
</trim>
<where>
<choose>
<when test="hardwareSn != null">
and hardware_sn = #{hardwareSn}
</when>
<when test="clientId != null">
and client_id = #{clientId}
</when>
<otherwise>
and 1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
</otherwise>
</choose>
</where>
</update>
<select id="getRegistrationByIds" parameterType="String" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectRegistMsgByClientId" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
</where>
order by create_time desc
</select>
<select id="getAllLogicalNodeId" parameterType="RmResourceRegistration" resultType="java.util.Map">
select logical_node_id logicalNodeId from rm_resource_registration where logical_node_id != ''
group by logical_node_id
</select>
<select id="getRegistrationTableInfoList" parameterType="RmResourceRegistration" resultType="RmResourceRegistration">
select
a.id,
a.hardware_sn as hardwareSn,
a.agent_version as agentVersion,
a.registration_status as registrationStatus,
a.online_status as onlineStatus,
a.create_time as createTime,
a.update_time as updateTime,
a.client_id as clientId,
a.business_name as businessName,
a.logical_node_id as logicalNodeId,
a.multi_public_ip_status as multiPublicIpStatus,
a.heartbeat_count as heartbeatCount,
a.heartbeat_interval as heartbeatInterval,
a.onboard_time as onboardTime,
b.machine_code as machineCode
from rm_resource_registration a
left join rm_registration_machine b on a.client_id = b.client_id
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and a.hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and a.resource_type = #{resourceType}</if>
<if test="agentVersion != null and agentVersion != ''"> and a.agent_version = #{agentVersion}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and a.registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and a.online_status = #{onlineStatus}</if>
<if test="clientId != null and clientId != ''"> and a.client_id = #{clientId}</if>
<if test="businessName != null and businessName != ''"> and a.business_name like concat('%', #{businessName}, '%')</if>
<if test="logicalNodeId != null and logicalNodeId != ''"> and a.logical_node_id = #{logicalNodeId}</if>
<if test="multiPublicIpStatus != null and multiPublicIpStatus != ''"> and a.multi_public_ip_status = #{multiPublicIpStatus}</if>
<if test="businessEmpty"> and a.business_name is null</if>
<if test="logicalNodeEmpty"> and a.logical_node_id is null</if>
</where>
order by a.create_time desc
</select>
</mapper>
@@ -0,0 +1,91 @@
<?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.tongran.system.mapper.RmSwitchInterfaceInfoMapper">
<resultMap type="RmSwitchInterfaceInfo" id="RmSwitchInterfaceInfoResult">
<result property="id" column="id" />
<result property="hardwareSn" column="hardware_sn" />
<result property="switchName" column="switch_name" />
<result property="interfaceName" column="interface_name" />
<result property="interfaceRemark" column="interface_remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="clientId" column="client_id" />
</resultMap>
<sql id="selectRmSwitchInterfaceInfoVo">
select id, hardware_sn, switch_name, interface_name, interface_remark, create_time, update_time, create_by, update_by, client_id from rm_switch_interface_info
</sql>
<select id="selectRmSwitchInterfaceInfoList" parameterType="RmSwitchInterfaceInfo" resultMap="RmSwitchInterfaceInfoResult">
<include refid="selectRmSwitchInterfaceInfoVo"/>
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="interfaceRemark != null and interfaceRemark != ''"> and interface_remark = #{interfaceRemark}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
</where>
</select>
<select id="selectRmSwitchInterfaceInfoById" parameterType="Long" resultMap="RmSwitchInterfaceInfoResult">
<include refid="selectRmSwitchInterfaceInfoVo"/>
where id = #{id}
</select>
<insert id="insertRmSwitchInterfaceInfo" parameterType="RmSwitchInterfaceInfo" useGeneratedKeys="true" keyProperty="id">
insert into rm_switch_interface_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
<if test="switchName != null and switchName != ''">switch_name,</if>
<if test="interfaceName != null and interfaceName != ''">interface_name,</if>
<if test="interfaceRemark != null">interface_remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="clientId != null">client_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
<if test="switchName != null and switchName != ''">#{switchName},</if>
<if test="interfaceName != null and interfaceName != ''">#{interfaceName},</if>
<if test="interfaceRemark != null">#{interfaceRemark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="clientId != null">#{clientId},</if>
</trim>
</insert>
<update id="updateRmSwitchInterfaceInfo" parameterType="RmSwitchInterfaceInfo">
update rm_switch_interface_info
<trim prefix="SET" suffixOverrides=",">
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
<if test="switchName != null and switchName != ''">switch_name = #{switchName},</if>
<if test="interfaceName != null and interfaceName != ''">interface_name = #{interfaceName},</if>
<if test="interfaceRemark != null">interface_remark = #{interfaceRemark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmSwitchInterfaceInfoById" parameterType="Long">
delete from rm_switch_interface_info where id = #{id}
</delete>
<delete id="deleteRmSwitchInterfaceInfoByIds" parameterType="String">
delete from rm_switch_interface_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,172 @@
<?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.tongran.system.mapper.RmSwitchManagementMapper">
<resultMap type="RmSwitchManagement" id="RmSwitchManagementResult">
<result property="id" column="id" />
<result property="switchType" column="switch_type" />
<result property="switchName" column="switch_name" />
<result property="hardwareSn" column="hardware_sn" />
<result property="snmpAddress" column="snmp_address" />
<result property="snmpPort" column="snmp_port" />
<result property="onlineStatus" column="online_status" />
<result property="heartbeatCount" column="heartbeat_count" />
<result property="heartbeatInterval" column="heartbeat_interval" />
<result property="heartbeatOid" column="heartbeat_oid" />
<result property="snmpVersion" column="snmp_version" />
<result property="upTime" column="up_time" />
<result property="readWritePermission" column="read_write_permission" />
<result property="securityLevel" column="security_level" />
<result property="encryptionMethod" column="encryption_method" />
<result property="communityName" column="community_name" />
<result property="switchUser" column="switch_user" />
<result property="switchPassword" column="switch_password" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="clientId" column="client_id" />
</resultMap>
<sql id="selectRmSwitchManagementVo">
select id, switch_type, switch_name, hardware_sn, snmp_address, snmp_port, online_status, heartbeat_count, heartbeat_interval, heartbeat_oid, snmp_version, up_time, read_write_permission, security_level, encryption_method, community_name, switch_user, switch_password, create_time, update_time, create_by, update_by, client_id from rm_switch_management
</sql>
<select id="selectRmSwitchManagementList" parameterType="RmSwitchManagement" resultMap="RmSwitchManagementResult">
<include refid="selectRmSwitchManagementVo"/>
<where>
<if test="switchType != null and switchType != ''"> and switch_type = #{switchType}</if>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="snmpAddress != null and snmpAddress != ''"> and snmp_address = #{snmpAddress}</if>
<if test="snmpPort != null "> and snmp_port = #{snmpPort}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="heartbeatCount != null and heartbeatCount != ''"> and heartbeat_count = #{heartbeatCount}</if>
<if test="heartbeatInterval != null and heartbeatInterval != ''"> and heartbeat_interval = #{heartbeatInterval}</if>
<if test="heartbeatOid != null and heartbeatOid != ''"> and heartbeat_oid = #{heartbeatOid}</if>
<if test="snmpVersion != null and snmpVersion != ''"> and snmp_version = #{snmpVersion}</if>
<if test="upTime != null "> and up_time = #{upTime}</if>
<if test="readWritePermission != null and readWritePermission != ''"> and read_write_permission = #{readWritePermission}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryptionMethod != null and encryptionMethod != ''"> and encryption_method = #{encryptionMethod}</if>
<if test="communityName != null and communityName != ''"> and community_name like concat('%', #{communityName}, '%')</if>
<if test="switchUser != null and switchUser != ''"> and switch_user = #{switchUser}</if>
<if test="switchPassword != null and switchPassword != ''"> and switch_password = #{switchPassword}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="queryName != null and queryName != ''">
and (snmp_address = #{queryName} or switch_name like concat('%', #{queryName}, '%'))
</if>
</where>
order by create_time desc
</select>
<select id="selectRmSwitchManagementById" parameterType="Long" resultMap="RmSwitchManagementResult">
<include refid="selectRmSwitchManagementVo"/>
where id = #{id}
</select>
<insert id="insertRmSwitchManagement" parameterType="RmSwitchManagement" useGeneratedKeys="true" keyProperty="id">
insert into rm_switch_management
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="switchType != null">switch_type,</if>
<if test="switchName != null and switchName != ''">switch_name,</if>
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
<if test="snmpAddress != null and snmpAddress != ''">snmp_address,</if>
<if test="snmpPort != null">snmp_port,</if>
<if test="onlineStatus != null and onlineStatus != ''">online_status,</if>
<if test="heartbeatCount != null and heartbeatCount != ''">heartbeat_count,</if>
<if test="heartbeatInterval != null and heartbeatInterval != ''">heartbeat_interval,</if>
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid,</if>
<if test="snmpVersion != null and snmpVersion != ''">snmp_version,</if>
<if test="upTime != null">up_time,</if>
<if test="readWritePermission != null">read_write_permission,</if>
<if test="securityLevel != null">security_level,</if>
<if test="encryptionMethod != null">encryption_method,</if>
<if test="communityName != null">community_name,</if>
<if test="switchUser != null">switch_user,</if>
<if test="switchPassword != null">switch_password,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="clientId != null">client_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchType != null">#{switchType},</if>
<if test="switchName != null and switchName != ''">#{switchName},</if>
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
<if test="snmpAddress != null and snmpAddress != ''">#{snmpAddress},</if>
<if test="snmpPort != null">#{snmpPort},</if>
<if test="onlineStatus != null and onlineStatus != ''">#{onlineStatus},</if>
<if test="heartbeatCount != null and heartbeatCount != ''">#{heartbeatCount},</if>
<if test="heartbeatInterval != null and heartbeatInterval != ''">#{heartbeatInterval},</if>
<if test="heartbeatOid != null and heartbeatOid != ''">#{heartbeatOid},</if>
<if test="snmpVersion != null and snmpVersion != ''">#{snmpVersion},</if>
<if test="upTime != null">#{upTime},</if>
<if test="readWritePermission != null">#{readWritePermission},</if>
<if test="securityLevel != null">#{securityLevel},</if>
<if test="encryptionMethod != null">#{encryptionMethod},</if>
<if test="communityName != null">#{communityName},</if>
<if test="switchUser != null">#{switchUser},</if>
<if test="switchPassword != null">#{switchPassword},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="clientId != null">#{clientId},</if>
</trim>
</insert>
<update id="updateRmSwitchManagement" parameterType="RmSwitchManagement">
update rm_switch_management
<trim prefix="SET" suffixOverrides=",">
<if test="switchType != null">switch_type = #{switchType},</if>
<if test="switchName != null and switchName != ''">switch_name = #{switchName},</if>
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
<if test="snmpAddress != null and snmpAddress != ''">snmp_address = #{snmpAddress},</if>
<if test="snmpPort != null">snmp_port = #{snmpPort},</if>
<if test="onlineStatus != null and onlineStatus != ''">online_status = #{onlineStatus},</if>
<if test="heartbeatCount != null and heartbeatCount != ''">heartbeat_count = #{heartbeatCount},</if>
<if test="heartbeatInterval != null and heartbeatInterval != ''">heartbeat_interval = #{heartbeatInterval},</if>
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid = #{heartbeatOid},</if>
<if test="snmpVersion != null and snmpVersion != ''">snmp_version = #{snmpVersion},</if>
<if test="upTime != null">up_time = #{upTime},</if>
<if test="readWritePermission != null">read_write_permission = #{readWritePermission},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryptionMethod != null">encryption_method = #{encryptionMethod},</if>
<if test="communityName != null">community_name = #{communityName},</if>
<if test="switchUser != null">switch_user = #{switchUser},</if>
<if test="switchPassword != null">switch_password = #{switchPassword},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
<where>
<choose>
<when test="id != null">
and id = #{id}
</when>
<when test="clientId != null and clientId != ''">
and client_id = #{clientId}
</when>
<otherwise>
and 1=0
</otherwise>
</choose>
</where>
</update>
<delete id="deleteRmSwitchManagementById" parameterType="Long">
delete from rm_switch_management where id = #{id}
</delete>
<delete id="deleteRmSwitchManagementByIds" parameterType="String">
delete from rm_switch_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +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.tongran.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="SysConfig">
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,157 @@
<?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.tongran.system.mapper.SysDeptMapper">
<resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
</mapper>
@@ -0,0 +1,124 @@
<?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.tongran.system.mapper.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
from sys_dict_data
</sql>
<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="dictType != null and dictType != ''">
AND dict_type = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dict_label like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by dict_sort asc
</select>
<select id="selectDictDataByType" parameterType="String" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="Long">
delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
<update id="updateDictData" parameterType="SysDictData">
update sys_dict_data
<set>
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if>
<if test="listClass != null and listClass != ''">list_class,</if>
<if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>
@@ -0,0 +1,105 @@
<?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.tongran.system.mapper.SysDictTypeMapper">
<resultMap type="SysDictType" id="SysDictTypeResult">
<id property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type
</sql>
<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectDictTypeAll" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
</select>
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_id = #{dictId}
</select>
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
delete from sys_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteDictTypeByIds" parameterType="Long">
delete from sys_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
<update id="updateDictType" parameterType="SysDictType">
update sys_dict_type
<set>
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_id = #{dictId}
</update>
<insert id="insertDictType" parameterType="SysDictType">
insert into sys_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictName != null and dictName != ''">#{dictName},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>
@@ -0,0 +1,54 @@
<?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.tongran.system.mapper.SysLogininforMapper">
<resultMap type="SysLogininfor" id="SysLogininforResult">
<id property="infoId" column="info_id" />
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="ipaddr" column="ipaddr" />
<result property="msg" column="msg" />
<result property="accessTime" column="access_time" />
</resultMap>
<insert id="insertLogininfor" parameterType="SysLogininfor">
insert into sys_logininfor (user_name, status, ipaddr, msg, access_time)
values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate())
</insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND access_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND access_time &lt;= #{params.endTime}
</if>
</where>
order by info_id desc
</select>
<delete id="deleteLogininforByIds" parameterType="Long">
delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table sys_logininfor
</update>
</mapper>
@@ -0,0 +1,92 @@
<?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.tongran.system.mapper.SysMenuClickMapper">
<resultMap type="SysMenuClick" id="SysMenuClickResult">
<result property="id" column="id" />
<result property="pageRoute" column="page_route" />
<result property="pageName" column="page_name" />
<result property="clickCount" column="click_count" />
<result property="lastClickTime" column="last_click_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysMenuClickVo">
select id, page_route, page_name, click_count, last_click_time, create_by, create_time, update_by, update_time, remark from sys_menu_click
</sql>
<select id="selectSysMenuClickList" parameterType="SysMenuClick" resultMap="SysMenuClickResult">
<include refid="selectSysMenuClickVo"/>
<where>
<if test="pageRoute != null and pageRoute != ''"> and page_route = #{pageRoute}</if>
<if test="pageName != null and pageName != ''"> and page_name like concat('%', #{pageName}, '%')</if>
<if test="clickCount != null "> and click_count = #{clickCount}</if>
<if test="lastClickTime != null "> and last_click_time = #{lastClickTime}</if>
</where>
order by click_count desc
</select>
<select id="selectSysMenuClickById" parameterType="Long" resultMap="SysMenuClickResult">
<include refid="selectSysMenuClickVo"/>
where id = #{id}
</select>
<insert id="insertSysMenuClick" parameterType="SysMenuClick" useGeneratedKeys="true" keyProperty="id">
insert into sys_menu_click
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pageRoute != null and pageRoute != ''">page_route,</if>
<if test="pageName != null">page_name,</if>
<if test="clickCount != null">click_count,</if>
<if test="lastClickTime != null">last_click_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pageRoute != null and pageRoute != ''">#{pageRoute},</if>
<if test="pageName != null">#{pageName},</if>
<if test="clickCount != null">#{clickCount},</if>
<if test="lastClickTime != null">#{lastClickTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysMenuClick" parameterType="SysMenuClick">
update sys_menu_click
<trim prefix="SET" suffixOverrides=",">
<if test="pageRoute != null and pageRoute != ''">page_route = #{pageRoute},</if>
<if test="pageName != null">page_name = #{pageName},</if>
<if test="clickCount != null">click_count = #{clickCount},</if>
<if test="lastClickTime != null">last_click_time = #{lastClickTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysMenuClickById" parameterType="Long">
delete from sys_menu_click where id = #{id}
</delete>
<delete id="deleteSysMenuClickByIds" parameterType="String">
delete from sys_menu_click where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,206 @@
<?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.tongran.system.mapper.SysMenuMapper">
<resultMap type="SysMenu" id="SysMenuResult">
<id property="menuId" column="menu_id" />
<result property="menuName" column="menu_name" />
<result property="parentName" column="parent_name" />
<result property="parentId" column="parent_id" />
<result property="orderNum" column="order_num" />
<result property="path" column="path" />
<result property="component" column="component" />
<result property="query" column="query" />
<result property="routeName" column="route_name" />
<result property="isFrame" column="is_frame" />
<result property="isCache" column="is_cache" />
<result property="menuType" column="menu_type" />
<result property="visible" column="visible" />
<result property="status" column="status" />
<result property="perms" column="perms" />
<result property="icon" column="icon" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectMenuVo">
select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from sys_menu
</sql>
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
<where>
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by parent_id, order_num
</select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
where ur.user_id = #{params.userId}
<if test="menuName != null and menuName != ''">
AND m.menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND m.visible = #{visible}
</if>
<if test="status != null and status != ''">
AND m.status = #{status}
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId}
<if test="menuCheckStrictly">
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
</select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' and rm.role_id = #{roleId}
</select>
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_id = #{menuId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from sys_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="SysMenu">
update sys_menu
<set>
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="path != null and path != ''">path = #{path},</if>
<if test="component != null">component = #{component},</if>
<if test="query != null">`query` = #{query},</if>
<if test="routeName != null">route_name = #{routeName},</if>
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
<if test="visible != null">visible = #{visible},</if>
<if test="status != null">status = #{status},</if>
<if test="perms !=null">perms = #{perms},</if>
<if test="icon !=null and icon != ''">icon = #{icon},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where menu_id = #{menuId}
</update>
<insert id="insertMenu" parameterType="SysMenu">
insert into sys_menu(
<if test="menuId != null and menuId != 0">menu_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="menuName != null and menuName != ''">menu_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="path != null and path != ''">path,</if>
<if test="component != null and component != ''">component,</if>
<if test="query != null and query != ''">`query`,</if>
<if test="routeName != null">route_name,</if>
<if test="isFrame != null and isFrame != ''">is_frame,</if>
<if test="isCache != null and isCache != ''">is_cache,</if>
<if test="menuType != null and menuType != ''">menu_type,</if>
<if test="visible != null">visible,</if>
<if test="status != null">status,</if>
<if test="perms !=null and perms != ''">perms,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="menuId != null and menuId != 0">#{menuId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="menuName != null and menuName != ''">#{menuName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="path != null and path != ''">#{path},</if>
<if test="component != null and component != ''">#{component},</if>
<if test="query != null and query != ''">#{query},</if>
<if test="routeName != null">#{routeName},</if>
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
<if test="isCache != null and isCache != ''">#{isCache},</if>
<if test="menuType != null and menuType != ''">#{menuType},</if>
<if test="visible != null">#{visible},</if>
<if test="status != null">#{status},</if>
<if test="perms !=null and perms != ''">#{perms},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deleteMenuById" parameterType="Long">
delete from sys_menu where menu_id = #{menuId}
</delete>
</mapper>
@@ -0,0 +1,89 @@
<?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.tongran.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,86 @@
<?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.tongran.system.mapper.SysOperLogMapper">
<resultMap type="SysOperLog" id="SysOperLogResult">
<id property="operId" column="oper_id" />
<result property="title" column="title" />
<result property="businessType" column="business_type" />
<result property="method" column="method" />
<result property="requestMethod" column="request_method" />
<result property="operatorType" column="operator_type" />
<result property="operName" column="oper_name" />
<result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" />
<result property="operParam" column="oper_param" />
<result property="jsonResult" column="json_result" />
<result property="status" column="status" />
<result property="errorMsg" column="error_msg" />
<result property="operTime" column="oper_time" />
<result property="costTime" column="cost_time" />
</resultMap>
<sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time, cost_time
from sys_oper_log
</sql>
<insert id="insertOperlog" parameterType="SysOperLog">
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
</insert>
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
<where>
<if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%')
</if>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="businessType != null">
AND business_type = #{businessType}
</if>
<if test="businessTypes != null and businessTypes.length > 0">
AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND oper_time &lt;= #{params.endTime}
</if>
</where>
order by oper_id desc
</select>
<delete id="deleteOperLogByIds" parameterType="Long">
delete from sys_oper_log where oper_id in
<foreach collection="array" item="operId" open="(" separator="," close=")">
#{operId}
</foreach>
</delete>
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
where oper_id = #{operId}
</select>
<update id="cleanOperLog">
truncate table sys_oper_log
</update>
</mapper>
@@ -0,0 +1,122 @@
<?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.tongran.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id" />
<result property="postCode" column="post_code" />
<result property="postName" column="post_name" />
<result property="postSort" column="post_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,34 @@
<?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.tongran.system.mapper.SysRoleDeptMapper">
<resultMap type="SysRoleDept" id="SysRoleDeptResult">
<result property="roleId" column="role_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
delete from sys_role_dept where role_id=#{roleId}
</delete>
<select id="selectCountRoleDeptByDeptId" resultType="Integer">
select count(1) from sys_role_dept where dept_id=#{deptId}
</select>
<delete id="deleteRoleDept" parameterType="Long">
delete from sys_role_dept where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleDept">
insert into sys_role_dept(role_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.deptId})
</foreach>
</insert>
</mapper>
@@ -0,0 +1,152 @@
<?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.tongran.system.mapper.SysRoleMapper">
<resultMap type="SysRole" id="SysRoleResult">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="menuCheckStrictly" column="menu_check_strictly" />
<result property="deptCheckStrictly" column="dept_check_strictly" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
<select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
</select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
select r.role_id
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null">role_sort,</if>
<if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null">#{roleSort},</if>
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateRole" parameterType="SysRole">
update sys_role
<set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
<if test="roleSort != null">role_sort = #{roleSort},</if>
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where role_id = #{roleId}
</update>
<delete id="deleteRoleById" parameterType="Long">
update sys_role set del_flag = '2' where role_id = #{roleId}
</delete>
<delete id="deleteRoleByIds" parameterType="Long">
update sys_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,34 @@
<?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.tongran.system.mapper.SysRoleMenuMapper">
<resultMap type="SysRoleMenu" id="SysRoleMenuResult">
<result property="roleId" column="role_id" />
<result property="menuId" column="menu_id" />
</resultMap>
<select id="checkMenuExistRole" resultType="Integer">
select count(1) from sys_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
delete from sys_role_menu where role_id=#{roleId}
</delete>
<delete id="deleteRoleMenu" parameterType="Long">
delete from sys_role_menu where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleMenu">
insert into sys_role_menu(role_id, menu_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.menuId})
</foreach>
</insert>
</mapper>
@@ -0,0 +1,223 @@
<?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.tongran.system.mapper.SysUserMapper">
<resultMap type="SysUser" id="SysUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="pwdUpdateDate" column="pwd_update_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.del_flag = '0' and r.role_id = #{roleId}
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="pwdUpdateDate != null">pwd_update_date,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="pwdUpdateDate != null">#{pwdUpdateDate},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateUser" parameterType="SysUser">
update sys_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<update id="updateUserStatus" parameterType="SysUser">
update sys_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_id = #{userId}
</update>
<update id="resetUserPwd" parameterType="SysUser">
update sys_user set pwd_update_date = sysdate(), password = #{password} where user_id = #{userId}
</update>
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,34 @@
<?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.tongran.system.mapper.SysUserPostMapper">
<resultMap type="SysUserPost" id="SysUserPostResult">
<result property="userId" column="user_id" />
<result property="postId" column="post_id" />
</resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long">
delete from sys_user_post where user_id=#{userId}
</delete>
<select id="countUserPostById" resultType="Integer">
select count(1) from sys_user_post where post_id=#{postId}
</select>
<delete id="deleteUserPost" parameterType="Long">
delete from sys_user_post where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserPost">
insert into sys_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId})
</foreach>
</insert>
</mapper>
@@ -0,0 +1,44 @@
<?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.tongran.system.mapper.SysUserRoleMapper">
<resultMap type="SysUserRole" id="SysUserRoleResult">
<result property="userId" column="user_id" />
<result property="roleId" column="role_id" />
</resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from sys_user_role where user_id=#{userId}
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">
select count(1) from sys_user_role where role_id=#{roleId}
</select>
<delete id="deleteUserRole" parameterType="Long">
delete from sys_user_role where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserRole">
insert into sys_user_role(user_id, role_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.roleId})
</foreach>
</insert>
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
</delete>
<delete id="deleteUserRoleInfos">
delete from sys_user_role where role_id=#{roleId} and user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,96 @@
<?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.tongran.system.mapper.UserTableColumnConfigMapper">
<resultMap type="UserTableColumnConfig" id="UserTableColumnConfigResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="pageRoute" column="page_route" />
<result property="columnConfig" column="column_config" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectUserTableColumnConfigVo">
select id, user_id, page_route, column_config, create_by, create_time, update_by, update_time, remark from user_table_column_config
</sql>
<select id="selectUserTableColumnConfigList" parameterType="UserTableColumnConfig" resultMap="UserTableColumnConfigResult">
<include refid="selectUserTableColumnConfigVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="pageRoute != null and pageRoute != ''"> and page_route = #{pageRoute}</if>
<if test="columnConfig != null and columnConfig != ''"> and column_config = #{columnConfig}</if>
</where>
</select>
<select id="selectUserTableColumnConfigById" parameterType="Long" resultMap="UserTableColumnConfigResult">
<include refid="selectUserTableColumnConfigVo"/>
where id = #{id}
</select>
<insert id="insertUserTableColumnConfig" parameterType="UserTableColumnConfig" useGeneratedKeys="true" keyProperty="id">
insert into user_table_column_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="pageRoute != null and pageRoute != ''">page_route,</if>
<if test="columnConfig != null and columnConfig != ''">column_config,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="pageRoute != null and pageRoute != ''">#{pageRoute},</if>
<if test="columnConfig != null and columnConfig != ''">#{columnConfig},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateUserTableColumnConfig" parameterType="UserTableColumnConfig">
update user_table_column_config
<trim prefix="SET" suffixOverrides=",">
<if test="columnConfig != null and columnConfig != ''">column_config = #{columnConfig},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
<where>
<choose>
<when test="id != null">
and id = #{id}
</when>
<when test="userId != null and pageRoute != null">
and user_id = #{userId} and page_route = #{pageRoute}
</when>
<otherwise>
and 1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
</otherwise>
</choose>
</where>
</update>
<delete id="deleteUserTableColumnConfigById" parameterType="Long">
delete from user_table_column_config where id = #{id}
</delete>
<delete id="deleteUserTableColumnConfigByIds" parameterType="String">
delete from user_table_column_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>