REM:
1. 增加业务组信息表
2. 增加业务数据库相关对象
3. 增加业务组Mapper
4. 增加业务数据库相关配置文件
5. 增加业务数据库初始化脚本
This commit is contained in:
HuangXin 2021-01-13 16:03:46 +08:00
parent 8d95610e37
commit 346c604165
7 changed files with 258 additions and 1 deletions

View File

@ -19,9 +19,13 @@ public enum DisposeDeviceType implements BaseEnum {
*/
PENGXIN_PLATFORM(2, "鹏信处置设备"),
/**
* The HuaWei platform.
* The Huawei platform.
*/
HUAWEI_PLATFORM(3, "华为处置设备"),
/**
* Dptech bypass umc dispose device type.
*/
DPTECH_BYPASS_UMC(4, "迪普旁路牵引UMC管理平台"),
/**
* The Virtual dispose.
*/

View File

@ -0,0 +1,68 @@
package com.dispose.common;
/**
* The enum Service type.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
public enum ServiceType implements BaseEnum {
/**
* The Service and others.
*/
SERVICE_AND_OTHERS(0, "服务器以及其它类型"),
/**
* Web site service type.
*/
WEB_SITE(1, "网站"),
/**
* Dns service service type.
*/
DNS_SERVICE(2, "DNS 服务"),
/**
* Game service service type.
*/
GAME_SERVICE(3, "游戏 服务"),
;
/**
* The Code.
*/
private final Integer code;
/**
* The Readme.
*/
private final String readme;
/**
* Instantiates a new Service type.
*
* @param code the code
* @param readme the readme
*/
ServiceType(int code, String readme) {
this.code = code;
this.readme = readme;
}
/**
* Gets value.
*
* @return the value
*/
@Override
public Integer getValue() {
return this.code;
}
/**
* Gets description.
*
* @return the description
*/
@Override
public String getDescription() {
return this.readme;
}
}

View File

@ -0,0 +1,44 @@
package com.dispose.mapper;
import com.dispose.pojo.entity.ServiceInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* The interface Service group mapper.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
public interface ServiceGroupMapper {
/**
* Select all list.
*
* @return the list
*/
List<ServiceInfo> selectAll();
/**
* Add service group int.
*
* @param svrGrps the svr grps
* @return the int
*/
int addServiceGroup(@Param("svrGrps") List<ServiceInfo> svrGrps);
/**
* Del service group by id int.
*
* @param id the id
* @return the int
*/
int delServiceGroupById(@Param("id") Long id);
/**
* Del service group by service id int.
*
* @param serviceId the service id
* @return the int
*/
int delServiceGroupByServiceId(@Param("serviceId") Long serviceId);
}

View File

@ -0,0 +1,62 @@
package com.dispose.pojo.entity;
import com.dispose.common.ServiceType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.annotation.NameStyle;
import tk.mybatis.mapper.code.Style;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* The type Service info.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder(alphabetic = true)
@Table(name = "service_group")
@NameStyle(Style.normal)
public class ServiceInfo {
/**
* The constant serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* The Id.
*/
@Id
@KeySql(useGeneratedKeys = true)
private Long id;
/**
* The Service id.
*/
private Long serviceId;
/**
* The Service type.
*/
private ServiceType serviceType;
/**
* The Service bandwidth.
*/
private Long serviceBandwidth;
/**
* The Service ip.
*/
private String serviceIp;
}

View File

@ -128,6 +128,24 @@ CREATE TABLE `dispose_task`
COLLATE = utf8_general_ci
ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for service_group
-- ----------------------------
DROP TABLE IF EXISTS `service_group`;
CREATE TABLE `service_group`
(
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '业务ID唯一标识符',
`serviceId` int(11) UNSIGNED NOT NULL COMMENT '业务ID',
`serviceType` int(11) NOT NULL COMMENT '业务类型:\r\n0SEVER\r\n1WEB\r\n2DNS\r\n3GAME',
`serviceBandwidth` int(11) NOT NULL COMMENT '业务带宽单位M',
`serviceIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务IP地址逗号分割',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for user_account
-- ----------------------------

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dispose.mapper.ServiceGroupMapper">
<resultMap id="service_grp" type="com.dispose.pojo.entity.ServiceInfo">
<id column="id" property="id"/>
<id column = "serviceId" property="serviceId"/>
<result column="serviceType" property="serviceType" javaType="com.dispose.common.ServiceType"/>
<result column="serviceBandwidth" property="serviceBandwidth"/>
<result column="serviceIp" property="serviceIp"/>
</resultMap>
<select id="selectAll" resultMap="service_grp">
SELECT *
FROM service_group
</select>
<insert id="addServiceGroup" useGeneratedKeys="true" keyProperty="id"
parameterType="com.dispose.pojo.entity.ServiceInfo">
INSERT IGNORE INTO service_group(serviceId, serviceType, serviceBandwidth, serviceIp)
VALUES
<foreach collection="svrGrps" item="svg" separator=",">
(#{svg.deviceId}, #{svg.serviceType}, #{svg.serviceBandwidth}, #{svg.serviceIp})
</foreach>
</insert>
<delete id="delServiceGroupById">
DELETE
FROM service_group
WHERE service_group.id = #{id}
</delete>
<delete id="delServiceGroupByServiceId">
DELETE
FROM service_group
WHERE service_group.serviceId = #{serviceId}
</delete>
<!-- <select id="getDeviceDisposeCapacity" resultMap="dispose_capacity">-->
<!-- SELECT *-->
<!-- FROM dispose_capacity-->
<!-- WHERE dispose_capacity.deviceId = #{deviceId}-->
<!-- </select>-->
</mapper>

View File

@ -204,6 +204,24 @@ CREATE TABLE `user_account`
COLLATE = utf8_general_ci
ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for service_group
-- ----------------------------
DROP TABLE IF EXISTS `service_group`;
CREATE TABLE `service_group`
(
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '业务ID唯一标识符',
`serviceId` int(11) UNSIGNED NOT NULL COMMENT '业务ID',
`serviceType` int(11) NOT NULL COMMENT '业务类型:\r\n0SEVER\r\n1WEB\r\n2DNS\r\n3GAME',
`serviceBandwidth` int(11) NOT NULL COMMENT '业务带宽单位M',
`serviceIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务IP地址逗号分割',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of user_account
-- ----------------------------