diff --git a/src/main/java/com/dispose/common/DisposeDeviceType.java b/src/main/java/com/dispose/common/DisposeDeviceType.java index afa2fbfb..7a93db61 100644 --- a/src/main/java/com/dispose/common/DisposeDeviceType.java +++ b/src/main/java/com/dispose/common/DisposeDeviceType.java @@ -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. */ diff --git a/src/main/java/com/dispose/common/ServiceType.java b/src/main/java/com/dispose/common/ServiceType.java new file mode 100644 index 00000000..2c316137 --- /dev/null +++ b/src/main/java/com/dispose/common/ServiceType.java @@ -0,0 +1,68 @@ +package com.dispose.common; + +/** + * The enum Service type. + * + * @author + */ +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; + } +} diff --git a/src/main/java/com/dispose/mapper/ServiceGroupMapper.java b/src/main/java/com/dispose/mapper/ServiceGroupMapper.java new file mode 100644 index 00000000..a6dad4db --- /dev/null +++ b/src/main/java/com/dispose/mapper/ServiceGroupMapper.java @@ -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 + */ +public interface ServiceGroupMapper { + /** + * Select all list. + * + * @return the list + */ + List selectAll(); + + /** + * Add service group int. + * + * @param svrGrps the svr grps + * @return the int + */ + int addServiceGroup(@Param("svrGrps") List 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); +} diff --git a/src/main/java/com/dispose/pojo/entity/ServiceInfo.java b/src/main/java/com/dispose/pojo/entity/ServiceInfo.java new file mode 100644 index 00000000..973789c5 --- /dev/null +++ b/src/main/java/com/dispose/pojo/entity/ServiceInfo.java @@ -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 + */ +@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; +} diff --git a/src/main/resources/db/schema.sql b/src/main/resources/db/schema.sql index b3e85c69..752ed366 100644 --- a/src/main/resources/db/schema.sql +++ b/src/main/resources/db/schema.sql @@ -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\n0:SEVER\r\n1:WEB\r\n2:DNS\r\n3:GAME', + `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 -- ---------------------------- diff --git a/src/main/resources/mappers/ServiceGroup.xml b/src/main/resources/mappers/ServiceGroup.xml new file mode 100644 index 00000000..ea3e1630 --- /dev/null +++ b/src/main/resources/mappers/ServiceGroup.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + INSERT IGNORE INTO service_group(serviceId, serviceType, serviceBandwidth, serviceIp) + VALUES + + (#{svg.deviceId}, #{svg.serviceType}, #{svg.serviceBandwidth}, #{svg.serviceIp}) + + + + + DELETE + FROM service_group + WHERE service_group.id = #{id} + + + + DELETE + FROM service_group + WHERE service_group.serviceId = #{serviceId} + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/test_db/unit_test.sql b/src/main/resources/test_db/unit_test.sql index 595e5178..80d93e4a 100644 --- a/src/main/resources/test_db/unit_test.sql +++ b/src/main/resources/test_db/unit_test.sql @@ -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\n0:SEVER\r\n1:WEB\r\n2:DNS\r\n3:GAME', + `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 -- ----------------------------