diff options
author | 2017-07-03 10:19:19 +0800 | |
---|---|---|
committer | 2017-07-03 10:19:19 +0800 | |
commit | 056dcab91efc64b5f9fc39825f9242e7fa0b9d05 (patch) | |
tree | d1af18cb6bfa6d3d61f0f77ff958d5a3ce7d6d06 /ResmanagementService/service/src/main/resources/mybatis/mysql | |
parent | d0ad118ba98d809ddc8eece49cf1fe1dfc83fc74 (diff) |
Upload nfvo resmanagement code
Change-Id: Ibe023d4b09e1105b84eb43153b4d4037cae691db
Signed-off-by: luxin <luxin7@huawei.com>
Diffstat (limited to 'ResmanagementService/service/src/main/resources/mybatis/mysql')
11 files changed, 2096 insertions, 0 deletions
diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/HostMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/HostMapper.xml new file mode 100644 index 0000000..850eef4 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/HostMapper.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Copyright 2016 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.HostMapper"> + <resultMap id="BaseResultMap" + type="org.openo.nfvo.resmanagement.service.entity.HostEntity"> + <id column="ID" property="id" jdbcType="VARCHAR" /> + <result column="NAME" property="name" jdbcType="VARCHAR" /> + <result column="CPU" property="cpu" jdbcType="VARCHAR" /> + <result column="MEMORY" property="memory" jdbcType="VARCHAR" /> + <result column="DISK" property="disk" jdbcType="VARCHAR" /> + <result column="VIM_ID" property="vimId" jdbcType="VARCHAR" /> + <result column="VIM_NAME" property="vimName" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List"> + ID, NAME, CPU, MEMORY, DISK, VIM_ID, VIM_NAME + </sql> + <select id="getHost" resultMap="BaseResultMap" parameterType="java.lang.String"> + select + <include refid="Base_Column_List" /> + from host + where ID = #{id,jdbcType=VARCHAR} + </select> + <select id="getHosts" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from host + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + <if test="vimId != null"> + AND VIM_ID = #{vimId,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteHost" parameterType="java.lang.String"> + delete from host + where ID = #{id,jdbcType=VARCHAR} + </delete> + <delete id="deleteHostByVimId" parameterType="java.lang.String"> + delete from host + where VIM_ID = #{vimId,jdbcType=VARCHAR} + </delete> + <insert id="addHost" + parameterType="org.openo.nfvo.resmanagement.service.entity.HostEntity"> + insert into host (ID, NAME, CPU, MEMORY, DISK, VIM_ID, VIM_NAME) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{cpu,jdbcType=VARCHAR}, + #{memory,jdbcType=VARCHAR}, #{disk,jdbcType=VARCHAR}, #{vimId,jdbcType=VARCHAR} + , #{vimName,jdbcType=VARCHAR}) + </insert> + <insert id="addHostSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.HostEntity"> + insert into host + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + ID, + </if> + <if test="name != null"> + NAME, + </if> + <if test="cpu != null"> + CPU, + </if> + <if test="memory != null"> + MEMORY, + </if> + <if test="disk != null"> + DISK, + </if> + <if test="vimId != null"> + VIM_ID, + </if> + <if test="vimName != null"> + VIM_NAME, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="cpu != null"> + #{cpu,jdbcType=VARCHAR}, + </if> + <if test="memory != null"> + #{memory,jdbcType=VARCHAR}, + </if> + <if test="disk != null"> + #{disk,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + #{vimName,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateHostSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.HostEntity"> + update host + <set> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="cpu != null"> + CPU = #{cpu,jdbcType=VARCHAR}, + </if> + <if test="memory != null"> + MEMORY = #{memory,jdbcType=VARCHAR}, + </if> + <if test="disk != null"> + DISK = #{disk,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + VIM_ID = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + </set> + <where> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR} + </if> + <if test="vimId != null"> + AND VIM_ID = #{vimId,jdbcType=VARCHAR} + </if> + </where> + </update> + <update id="updateHost" + parameterType="org.openo.nfvo.resmanagement.service.entity.HostEntity"> + update host + set NAME = #{name,jdbcType=VARCHAR}, + CPU = #{cpu,jdbcType=VARCHAR}, + MEMORY = #{memory,jdbcType=VARCHAR}, + DISK = #{disk,jdbcType=VARCHAR}, + VIM_ID = #{vimId,jdbcType=VARCHAR}, + VIM_NAME = #{vimName,jdbcType=VARCHAR} + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updateHostByVimId" + parameterType="org.openo.nfvo.resmanagement.service.entity.HostEntity"> + update host + <set> + <if test="id != null"> + ID = #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="cpu != null"> + CPU = #{cpu,jdbcType=VARCHAR}, + </if> + <if test="memory != null"> + MEMORY = #{memory,jdbcType=VARCHAR}, + </if> + <if test="disk != null"> + DISK = #{disk,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + VIM_ID = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + </set> + where VIM_ID = #{vimId,jdbcType=VARCHAR} + </update> +</mapper> diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/LocationMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/LocationMapper.xml new file mode 100644 index 0000000..b0ecba2 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/LocationMapper.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Copyright 2016 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.LocationMapper"> + <resultMap id="BaseResultMap" + type="org.openo.nfvo.resmanagement.service.entity.LocationEntity"> + + <id column="ID" property="id" jdbcType="VARCHAR" /> + <result column="COUNTRY" property="country" jdbcType="VARCHAR" /> + <result column="LOCATION" property="location" jdbcType="VARCHAR" /> + <result column="LATITUDE" property="latitude" jdbcType="VARCHAR" /> + <result column="LONGITUDE" property="longitude" jdbcType="VARCHAR" /> + <result column="DESCRIPTION" property="description" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List"> + ID, COUNTRY, LOCATION, LATITUDE, LONGITUDE, DESCRIPTION + </sql> + <select id="getLocation" resultMap="BaseResultMap" + parameterType="java.lang.String"> + select + <include refid="Base_Column_List" /> + from location + where ID = #{id,jdbcType=VARCHAR} + </select> + <select id="getCountry" resultType="java.lang.String"> + select distinct COUNTRY from location + </select> + <select id="getLocationByCountry" resultType="java.lang.String" + parameterType="java.util.Map"> + select distinct LOCATION from location + <where> + <if test="country != null"> + AND COUNTRY = #{country,jdbcType=VARCHAR} + </if> + </where> + </select> + <select id="getLocations" resultMap="BaseResultMap" + parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from location + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + <if test="location !=null"> + AND LOCATION = #{location,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteLocation" parameterType="java.lang.String"> + delete from location + where ID = #{id,jdbcType=VARCHAR} + </delete> + <insert id="addLocation" + parameterType="org.openo.nfvo.resmanagement.service.entity.LocationEntity"> + + insert into location (ID, COUNTRY, LOCATION, + LATITUDE, LONGITUDE, DESCRIPTION) + values (#{id,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, + #{location,jdbcType=VARCHAR}, + #{latitude,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}) + </insert> + <insert id="addLocationSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.LocationEntity"> + + insert into location + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + ID, + </if> + <if test="country != null"> + COUNTRY, + </if> + <if test="location != null"> + LOCATION, + </if> + <if test="latitude != null"> + LATITUDE, + </if> + <if test="longitude != null"> + LONGITUDE, + </if> + <if test="description != null"> + DESCRIPTION, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="country != null"> + #{country,jdbcType=VARCHAR}, + </if> + <if test="location != null"> + #{location,jdbcType=VARCHAR}, + </if> + <if test="latitude != null"> + #{latitude,jdbcType=VARCHAR}, + </if> + <if test="longitude != null"> + #{longitude,jdbcType=VARCHAR}, + </if> + <if test="description != null"> + #{description,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateLocationSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.LocationEntity"> + + update location + <set> + <if test="country != null"> + COUNTRY = #{country,jdbcType=VARCHAR}, + </if> + <if test="location != null"> + LOCATION = #{location,jdbcType=VARCHAR}, + </if> + <if test="latitude != null"> + LATITUDE = #{latitude,jdbcType=VARCHAR}, + </if> + <if test="longitude != null"> + LONGITUDE = #{longitude,jdbcType=VARCHAR}, + </if> + <if test="description != null"> + DESCRIPTION = #{description,jdbcType=VARCHAR}, + </if> + </set> + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updateLocation" + parameterType="org.openo.nfvo.resmanagement.service.entity.LocationEntity"> + + update location + set COUNTRY = #{country,jdbcType=VARCHAR}, + LOCATION = #{location,jdbcType=VARCHAR}, + LATITUDE = #{latitude,jdbcType=VARCHAR}, + LONGITUDE = #{longitude,jdbcType=VARCHAR}, + DESCRIPTION = #{description,jdbcType=VARCHAR} + where ID = #{id,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/NetworkMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/NetworkMapper.xml new file mode 100644 index 0000000..65e4d67 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/NetworkMapper.xml @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Copyright 2016 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.NetworkMapper"> + <resultMap id="BaseResultMap" + type="org.openo.nfvo.resmanagement.service.entity.NetworkEntity"> + <id column="ID" property="id" jdbcType="VARCHAR" /> + <result column="NAME" property="name" jdbcType="VARCHAR" /> + <result column="TENANT_ID" property="tenantId" jdbcType="VARCHAR" /> + <result column="VIM_ID" property="vimId" jdbcType="VARCHAR" /> + <result column="VIM_NAME" property="vimName" jdbcType="VARCHAR" /> + <result column="STATUS" property="status" jdbcType="VARCHAR" /> + <result column="PHYSICAL_NETWORK" property="physicalNetwork" + jdbcType="VARCHAR" /> + <result column="NETWORK_TYPE" property="networkType" jdbcType="VARCHAR" /> + <result column="SEGMENTATION_ID" property="segmentationId" + jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List"> + ID, NAME, TENANT_ID, VIM_ID, VIM_NAME, STATUS, + PHYSICAL_NETWORK, NETWORK_TYPE, SEGMENTATION_ID + </sql> + <select id="getNetwork" resultMap="BaseResultMap" parameterType="java.lang.String"> + select + <include refid="Base_Column_List" /> + from network + where ID = #{id,jdbcType=VARCHAR} + </select> + <select id="getNetworks" resultMap="BaseResultMap" + parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from network + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + <if test="vimId != null"> + AND VIM_ID = #{vimId,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteNetwork" parameterType="java.lang.String"> + delete from network + where ID = #{id,jdbcType=VARCHAR} + </delete> + <delete id="deleteNetworkByVimId" parameterType="java.lang.String"> + delete from network + where VIM_ID = #{vimId,jdbcType=VARCHAR} + </delete> + <insert id="addNetwork" + parameterType="org.openo.nfvo.resmanagement.service.entity.NetworkEntity"> + insert into network (ID, NAME, TENANT_ID, + VIM_ID, VIM_NAME, STATUS, + PHYSICAL_NETWORK, NETWORK_TYPE, SEGMENTATION_ID + ) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{tenantId,jdbcType=VARCHAR}, + #{vimId,jdbcType=VARCHAR}, #{vimName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, + #{physicalNetwork,jdbcType=VARCHAR}, #{networkType,jdbcType=VARCHAR}, + #{segmentationId,jdbcType=VARCHAR} + ) + </insert> + <insert id="addNetworkSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.NetworkEntity"> + insert into network + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + ID, + </if> + <if test="name != null"> + NAME, + </if> + <if test="tenantId != null"> + TENANT_ID, + </if> + <if test="vimId != null"> + VIM_ID, + </if> + <if test="vimName != null"> + VIM_NAME, + </if> + <if test="status != null"> + STATUS, + </if> + <if test="physicalNetwork != null"> + PHYSICAL_NETWORK, + </if> + <if test="networkType != null"> + NETWORK_TYPE, + </if> + <if test="segmentationId != null"> + SEGMENTATION_ID, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="tenantId != null"> + #{tenantId,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + #{vimName,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + #{status,jdbcType=VARCHAR}, + </if> + <if test="physicalNetwork != null"> + #{physicalNetwork,jdbcType=VARCHAR}, + </if> + <if test="networkType != null"> + #{networkType,jdbcType=VARCHAR}, + </if> + <if test="segmentationId != null"> + #{segmentationId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateNetworkSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.NetworkEntity"> + update network + <set> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="tenantId != null"> + TENANT_ID = #{tenantId,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + VIM_ID = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + STATUS = #{status,jdbcType=VARCHAR}, + </if> + <if test="physicalNetwork != null"> + PHYSICAL_NETWORK = #{physicalNetwork,jdbcType=VARCHAR}, + </if> + <if test="networkType != null"> + NETWORK_TYPE = #{networkType,jdbcType=VARCHAR}, + </if> + <if test="segmentationId != null"> + SEGMENTATION_ID = #{segmentationId,jdbcType=VARCHAR}, + </if> + </set> + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updateNetwork" + parameterType="org.openo.nfvo.resmanagement.service.entity.NetworkEntity"> + update network + set NAME = #{name,jdbcType=VARCHAR}, + TENANT_ID = #{tenantId,jdbcType=VARCHAR}, + VIM_ID = #{vimId,jdbcType=VARCHAR}, + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + STATUS = #{status,jdbcType=VARCHAR}, + PHYSICAL_NETWORK = #{physicalNetwork,jdbcType=VARCHAR}, + NETWORK_TYPE = #{networkType,jdbcType=VARCHAR}, + SEGMENTATION_ID = #{segmentationId,jdbcType=VARCHAR} + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updateNetworkByVimId" + parameterType="org.openo.nfvo.resmanagement.service.entity.NetworkEntity"> + update network + <set> + <if test="id != null"> + ID = #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="tenantId != null"> + TENANT_ID = #{tenantId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + STATUS = #{status,jdbcType=VARCHAR}, + </if> + <if test="physicalNetwork != null"> + PHYSICAL_NETWORK = #{physicalNetwork,jdbcType=VARCHAR}, + </if> + <if test="networkType != null"> + NETWORK_TYPE = #{networkType,jdbcType=VARCHAR}, + </if> + <if test="segmentationId != null"> + SEGMENTATION_ID = #{segmentationId,jdbcType=VARCHAR}, + </if> + </set> + where VIM_ID = #{vimId,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/PortMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/PortMapper.xml new file mode 100644 index 0000000..765dcfe --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/PortMapper.xml @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Copyright 2016 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.PortMapper"> + <resultMap id="BaseResultMap" + type="org.openo.nfvo.resmanagement.service.entity.PortEntity"> + <id column="ID" property="id" jdbcType="VARCHAR" /> + <result column="NAME" property="name" jdbcType="VARCHAR" /> + <result column="NWTWORK_ID" property="networkId" jdbcType="VARCHAR" /> + <result column="STATUS" property="status" jdbcType="VARCHAR" /> + <result column="TENANT_ID" property="tenantId" jdbcType="VARCHAR" /> + <result column="VIM_ID" property="vimId" jdbcType="VARCHAR" /> + <result column="VIM_NAME" property="vimName" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List"> + ID, NAME, NWTWORK_ID, STATUS, TENANT_ID, VIM_ID, VIM_NAME + </sql> + <select id="getPort" resultMap="BaseResultMap" parameterType="java.lang.String"> + select + <include refid="Base_Column_List" /> + from port + where ID = #{id,jdbcType=VARCHAR} + </select> + <select id="getPorts" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from port + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deletePort" parameterType="java.lang.String"> + delete from port + where ID = #{id,jdbcType=VARCHAR} + </delete> + <delete id="deletePortByVimId" parameterType="java.lang.String"> + delete from port + where VIM_ID = #{vimId,jdbcType=VARCHAR} + </delete> + <insert id="addPort" + parameterType="org.openo.nfvo.resmanagement.service.entity.PortEntity"> + insert into port (ID, NAME, NWTWORK_ID, STATUS, TENANT_ID, VIM_ID, + VIM_NAME) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{networkId,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR}, #{vimId,jdbcType=VARCHAR} + , #{vimName,jdbcType=VARCHAR}) + </insert> + <insert id="addPortSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.PortEntity"> + insert into port + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + ID, + </if> + <if test="name != null"> + NAME, + </if> + <if test="networkId != null"> + NWTWORK_ID, + </if> + <if test="status != null"> + STATUS, + </if> + <if test="tenantId != null"> + TENANT_ID, + </if> + <if test="vimId != null"> + VIM_ID, + </if> + <if test="vimName != null"> + VIM_NAME, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="networkId != null"> + #{networkId,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + #{status,jdbcType=VARCHAR}, + </if> + <if test="tenantId != null"> + #{tenantId,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + #{vimName,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updatePortSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.PortEntity"> + update port + <set> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="networkId != null"> + NWTWORK_ID = #{networkId,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + STATUS = #{status,jdbcType=VARCHAR}, + </if> + <if test="tenantId != null"> + TENANT_ID = #{tenantId,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + VIM_ID = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + </set> + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updatePort" + parameterType="org.openo.nfvo.resmanagement.service.entity.PortEntity"> + update port + set NAME = #{name,jdbcType=VARCHAR}, + NWTWORK_ID = #{networkId,jdbcType=VARCHAR}, + STATUS = #{status,jdbcType=VARCHAR}, + TENANT_ID = #{tenantId,jdbcType=VARCHAR}, + VIM_ID = #{vimId,jdbcType=VARCHAR}, + VIM_NAME = #{vimName,jdbcType=VARCHAR} + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updatePortByVimId" + parameterType="org.openo.nfvo.resmanagement.service.entity.PortEntity"> + update port + <set> + <if test="id != null"> + ID = #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="networkId != null"> + NWTWORK_ID = #{networkId,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + STATUS = #{status,jdbcType=VARCHAR}, + </if> + <if test="tenantId != null"> + TENANT_ID = #{tenantId,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + VIM_ID = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + </set> + where ID = #{id,jdbcType=VARCHAR} + </update> +</mapper> diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/SitesMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/SitesMapper.xml new file mode 100644 index 0000000..14f7b52 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/SitesMapper.xml @@ -0,0 +1,286 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Copyright 2016 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.SitesMapper"> + <resultMap id="BaseResultMap" + type="org.openo.nfvo.resmanagement.service.entity.SitesEntity"> + <id column="ID" property="id" jdbcType="VARCHAR" /> + <result column="NAME" property="name" jdbcType="VARCHAR" /> + <result column="LOCATION" property="location" jdbcType="VARCHAR" /> + <result column="COUNTRY" property="country" jdbcType="VARCHAR" /> + <result column="VIM_ID" property="vimId" jdbcType="VARCHAR" /> + <result column="VIM_NAME" property="vimName" jdbcType="VARCHAR" /> + <result column="STATUS" property="status" jdbcType="VARCHAR" /> + <result column="TOTAL_CPU" property="totalCPU" jdbcType="VARCHAR" /> + <result column="TOTAL_MEMORY" property="totalMemory" jdbcType="VARCHAR" /> + <result column="TOTAL_DISK" property="totalDisk" jdbcType="VARCHAR" /> + <result column="USED_CPU" property="usedCPU" jdbcType="VARCHAR" /> + <result column="USED_MEMORY" property="usedMemory" jdbcType="VARCHAR" /> + <result column="USED_DISK" property="usedDisk" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List"> + ID, NAME, LOCATION, COUNTRY, VIM_ID, VIM_NAME, STATUS, + TOTAL_CPU, + TOTAL_MEMORY, TOTAL_DISK, + USED_CPU, USED_MEMORY, USED_DISK + </sql> + <select id="getSite" resultMap="BaseResultMap" parameterType="java.lang.String"> + select + <include refid="Base_Column_List" /> + from site + where ID = #{id,jdbcType=VARCHAR} + </select> + <select id="getSites" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from site + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + <if test="name != null"> + AND NAME = #{name,jdbcType=VARCHAR} + </if> + <if test="location != null"> + AND LOCATION = #{location,jdbcType=VARCHAR} + </if> + <if test="vimId != null"> + AND VIM_ID = #{vimId,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteSite" parameterType="java.lang.String"> + delete from site + where ID = + #{id,jdbcType=VARCHAR} + </delete> + <insert id="addSite" + parameterType="org.openo.nfvo.resmanagement.service.entity.SitesEntity"> + insert into site (ID, NAME, LOCATION, + COUNTRY, VIM_ID, + VIM_NAME, STATUS,TOTAL_CPU, TOTAL_MEMORY, TOTAL_DISK, + USED_CPU, + USED_MEMORY, USED_DISK) + values (#{id,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, + #{location,jdbcType=VARCHAR}, + #{country,jdbcType=VARCHAR}, #{vimId,jdbcType=VARCHAR}, + #{vimName,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, + #{totalCPU,jdbcType=VARCHAR}, #{totalMemory,jdbcType=VARCHAR}, + #{totalDisk,jdbcType=VARCHAR}, + #{usedCPU,jdbcType=VARCHAR}, + #{usedMemory,jdbcType=VARCHAR}, + #{usedDisk,jdbcType=VARCHAR}) + </insert> + <insert id="addSiteSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.SitesEntity"> + insert into site + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + ID, + </if> + <if test="name != null"> + NAME, + </if> + <if test="location != null"> + LOCATION, + </if> + <if test="country != null"> + COUNTRY, + </if> + <if test="vimId != null"> + VIM_ID, + </if> + <if test="vimName != null"> + VIM_NAME, + </if> + <if test="status != null"> + STATUS, + </if> + <if test="totalCPU != null"> + TOTAL_CPU, + </if> + <if test="totalMemory != null"> + TOTAL_MEMORY, + </if> + <if test="totalDisk != null"> + TOTAL_DISK, + </if> + <if test="usedCPU != null"> + USED_CPU, + </if> + <if test="usedMemory != null"> + USED_MEMORY, + </if> + <if test="usedDisk != null"> + USED_DISK, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="location != null"> + #{location,jdbcType=VARCHAR}, + </if> + <if test="country != null"> + #{country,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + #{vimName,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + #{status,jdbcType=VARCHAR}, + </if> + <if test="totalCPU != null"> + #{totalCPU,jdbcType=VARCHAR}, + </if> + <if test="totalMemory != null"> + #{totalMemory,jdbcType=VARCHAR}, + </if> + <if test="totalDisk != null"> + #{totalDisk,jdbcType=VARCHAR}, + </if> + <if test="usedCPU != null"> + #{usedCPU,jdbcType=VARCHAR}, + </if> + <if test="usedMemory != null"> + #{usedMemory,jdbcType=VARCHAR}, + </if> + <if test="usedDisk != null"> + #{usedDisk,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateSiteSelective" + parameterType="org.openo.nfvo.resmanagement.service.entity.SitesEntity"> + update site + <set> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="location != null"> + LOCATION = #{location,jdbcType=VARCHAR}, + </if> + <if test="country != null"> + COUNTRY = #{country,jdbcType=VARCHAR}, + </if> + <if test="vimId != null"> + VIM_ID = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + STATUS = #{status,jdbcType=VARCHAR}, + </if> + <if test="totalCPU != null"> + TOTAL_CPU = #{totalCPU,jdbcType=VARCHAR}, + </if> + <if test="totalMemory != null"> + TOTAL_MEMORY = #{totalMemory,jdbcType=VARCHAR}, + </if> + <if test="totalDisk != null"> + TOTAL_DISK = #{totalDisk,jdbcType=VARCHAR}, + </if> + <if test="usedCPU != null"> + USED_CPU = #{usedCPU,jdbcType=VARCHAR}, + </if> + <if test="usedMemory != null"> + USED_MEMORY = #{usedMemory,jdbcType=VARCHAR}, + </if> + <if test="usedDisk != null"> + USED_DISK = #{usedDisk,jdbcType=VARCHAR}, + </if> + </set> + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updateSite" + parameterType="org.openo.nfvo.resmanagement.service.entity.SitesEntity"> + update site + set NAME = #{name,jdbcType=VARCHAR}, + LOCATION + = #{location,jdbcType=VARCHAR}, + COUNTRY = #{country,jdbcType=VARCHAR}, + VIM_ID = #{vimId,jdbcType=VARCHAR}, + VIM_NAME = + #{vimName,jdbcType=VARCHAR}, + STATUS = #{status,jdbcType=VARCHAR}, + TOTAL_CPU = #{totalCPU,jdbcType=VARCHAR}, + TOTAL_MEMORY = + #{totalMemory,jdbcType=VARCHAR}, + TOTAL_DISK = + #{totalDisk,jdbcType=VARCHAR}, + USED_CPU = #{usedCPU,jdbcType=VARCHAR}, + USED_MEMORY = #{usedMemory,jdbcType=VARCHAR}, + USED_DISK = + #{usedDisk,jdbcType=VARCHAR} + where ID = #{id,jdbcType=VARCHAR} + </update> + <update id="updateSiteByVimId" + parameterType="org.openo.nfvo.resmanagement.service.entity.SitesEntity"> + update site + <set> + <if test="id != null"> + ID = #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + NAME = #{name,jdbcType=VARCHAR}, + </if> + <if test="location != null"> + LOCATION = #{location,jdbcType=VARCHAR}, + </if> + <if test="country != null"> + COUNTRY = #{country,jdbcType=VARCHAR}, + </if> + <if test="vimName != null"> + VIM_NAME = #{vimName,jdbcType=VARCHAR}, + </if> + <if test="status != null"> + STATUS = #{status,jdbcType=VARCHAR}, + </if> + <if test="totalCPU != null"> + TOTAL_CPU = #{totalCPU,jdbcType=VARCHAR}, + </if> + <if test="totalMemory != null"> + TOTAL_MEMORY = #{totalMemory,jdbcType=VARCHAR}, + </if> + <if test="totalDisk != null"> + TOTAL_DISK = #{totalDisk,jdbcType=VARCHAR}, + </if> + <if test="usedCPU != null"> + USED_CPU = #{usedCPU,jdbcType=VARCHAR}, + </if> + <if test="usedMemory != null"> + USED_MEMORY = #{usedMemory,jdbcType=VARCHAR}, + </if> + <if test="usedDisk != null"> + USED_DISK = #{usedDisk,jdbcType=VARCHAR}, + </if> + </set> + where VIM_ID = #{vimId,jdbcType=VARCHAR} + </update> + +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/VimMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/VimMapper.xml new file mode 100644 index 0000000..e6f38ef --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/VimMapper.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +Copyright 2016 Huawei Technologies Co., Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.VimMapper"> + <resultMap id="BaseResultMap" + type="org.openo.nfvo.resmanagement.service.entity.VimEntity"> + <id column="ID" property="id" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List"> + ID + </sql> + <select id="getVim" resultMap="BaseResultMap" parameterType="java.lang.String"> + select + <include refid="Base_Column_List" /> + from vim + where ID = #{id,jdbcType=VARCHAR} + </select> + <select id="getVims" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from vim + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteVim" parameterType="java.lang.String"> + delete from vim + where ID = #{id,jdbcType=VARCHAR} + </delete> + <insert id="addVim" + parameterType="org.openo.nfvo.resmanagement.service.entity.VimEntity"> + insert into vim (ID) + values (#{id,jdbcType=VARCHAR}) + </insert> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/VirtualLinkMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/VirtualLinkMapper.xml new file mode 100644 index 0000000..b4d2394 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/VirtualLinkMapper.xml @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright 2016-2017, Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.VirtualLinkMapper" > + <resultMap id="BaseResultMap" type="org.openo.nfvo.resmanagement.service.entity.VirtualLinkEntity" > + <id column="id" property="id" jdbcType="VARCHAR" /> + <result column="name" property="name" jdbcType="VARCHAR" /> + <result column="backend_id" property="backendId" jdbcType="VARCHAR" /> + <result column="is_public" property="isPublic" jdbcType="VARCHAR" /> + <result column="dc_name" property="dcName" jdbcType="VARCHAR" /> + <result column="vim_id" property="vimId" jdbcType="VARCHAR" /> + <result column="vim_name" property="vimName" jdbcType="VARCHAR" /> + <result column="physicial_net" property="physicialNet" jdbcType="VARCHAR" /> + <result column="ns_id" property="nsId" jdbcType="VARCHAR" /> + <result column="ns_name" property="nsName" jdbcType="VARCHAR" /> + <result column="description" property="description" jdbcType="VARCHAR" /> + <result column="network_type" property="networkType" jdbcType="VARCHAR" /> + <result column="segmentation" property="segmentation" jdbcType="VARCHAR" /> + <result column="mtu" property="mtu" jdbcType="VARCHAR" /> + <result column="vlan_transparent" property="vlanTransparent" jdbcType="VARCHAR" /> + <result column="router_external" property="routerExternal" jdbcType="VARCHAR" /> + <result column="resource_provider_type" property="resourceProviderType" jdbcType="VARCHAR" /> + <result column="resource_provider_id" property="resourceProviderId" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List" > + id, name, backend_id, is_public, dc_name, vim_id, vim_name, physicial_net, ns_id, + ns_name, description, network_type, segmentation, mtu, vlan_transparent, router_external, + resource_provider_type, resource_provider_id + </sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from vl + where id = #{id,jdbcType=VARCHAR} + </select> + <select id="getVls" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from vl + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from vl + where id = #{id,jdbcType=VARCHAR} + </delete> + <insert id="insert" parameterType="org.openo.nfvo.resmanagement.service.entity.VirtualLinkEntity" > + insert into vl (id, name, backend_id, + is_public, dc_name, vim_id, + vim_name, physicial_net, ns_id, + ns_name, description, network_type, + segmentation, mtu, vlan_transparent, + router_external, resource_provider_type, resource_provider_id + ) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{backendId,jdbcType=VARCHAR}, + #{isPublic,jdbcType=VARCHAR}, #{dcName,jdbcType=VARCHAR}, #{vimId,jdbcType=VARCHAR}, + #{vimName,jdbcType=VARCHAR}, #{physicialNet,jdbcType=VARCHAR}, #{nsId,jdbcType=VARCHAR}, + #{nsName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{networkType,jdbcType=VARCHAR}, + #{segmentation,jdbcType=VARCHAR}, #{mtu,jdbcType=VARCHAR}, #{vlanTransparent,jdbcType=VARCHAR}, + #{routerExternal,jdbcType=VARCHAR}, #{resourceProviderType,jdbcType=VARCHAR}, #{resourceProviderId,jdbcType=VARCHAR} + ) + </insert> + <insert id="insertSelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VirtualLinkEntity" > + insert into vl + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="id != null" > + id, + </if> + <if test="name != null" > + name, + </if> + <if test="backendId != null" > + backend_id, + </if> + <if test="isPublic != null" > + is_public, + </if> + <if test="dcName != null" > + dc_name, + </if> + <if test="vimId != null" > + vim_id, + </if> + <if test="vimName != null" > + vim_name, + </if> + <if test="physicialNet != null" > + physicial_net, + </if> + <if test="nsId != null" > + ns_id, + </if> + <if test="nsName != null" > + ns_name, + </if> + <if test="description != null" > + description, + </if> + <if test="networkType != null" > + network_type, + </if> + <if test="segmentation != null" > + segmentation, + </if> + <if test="mtu != null" > + mtu, + </if> + <if test="vlanTransparent != null" > + vlan_transparent, + </if> + <if test="routerExternal != null" > + router_external, + </if> + <if test="resourceProviderType != null" > + resource_provider_type, + </if> + <if test="resourceProviderId != null" > + resource_provider_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="id != null" > + #{id,jdbcType=VARCHAR}, + </if> + <if test="name != null" > + #{name,jdbcType=VARCHAR}, + </if> + <if test="backendId != null" > + #{backendId,jdbcType=VARCHAR}, + </if> + <if test="isPublic != null" > + #{isPublic,jdbcType=VARCHAR}, + </if> + <if test="dcName != null" > + #{dcName,jdbcType=VARCHAR}, + </if> + <if test="vimId != null" > + #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null" > + #{vimName,jdbcType=VARCHAR}, + </if> + <if test="physicialNet != null" > + #{physicialNet,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + #{nsId,jdbcType=VARCHAR}, + </if> + <if test="nsName != null" > + #{nsName,jdbcType=VARCHAR}, + </if> + <if test="description != null" > + #{description,jdbcType=VARCHAR}, + </if> + <if test="networkType != null" > + #{networkType,jdbcType=VARCHAR}, + </if> + <if test="segmentation != null" > + #{segmentation,jdbcType=VARCHAR}, + </if> + <if test="mtu != null" > + #{mtu,jdbcType=VARCHAR}, + </if> + <if test="vlanTransparent != null" > + #{vlanTransparent,jdbcType=VARCHAR}, + </if> + <if test="routerExternal != null" > + #{routerExternal,jdbcType=VARCHAR}, + </if> + <if test="resourceProviderType != null" > + #{resourceProviderType,jdbcType=VARCHAR}, + </if> + <if test="resourceProviderId != null" > + #{resourceProviderId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VirtualLinkEntity" > + update vl + <set > + <if test="name != null" > + name = #{name,jdbcType=VARCHAR}, + </if> + <if test="backendId != null" > + backend_id = #{backendId,jdbcType=VARCHAR}, + </if> + <if test="isPublic != null" > + is_public = #{isPublic,jdbcType=VARCHAR}, + </if> + <if test="dcName != null" > + dc_name = #{dcName,jdbcType=VARCHAR}, + </if> + <if test="vimId != null" > + vim_id = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null" > + vim_name = #{vimName,jdbcType=VARCHAR}, + </if> + <if test="physicialNet != null" > + physicial_net = #{physicialNet,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + ns_id = #{nsId,jdbcType=VARCHAR}, + </if> + <if test="nsName != null" > + ns_name = #{nsName,jdbcType=VARCHAR}, + </if> + <if test="description != null" > + description = #{description,jdbcType=VARCHAR}, + </if> + <if test="networkType != null" > + network_type = #{networkType,jdbcType=VARCHAR}, + </if> + <if test="segmentation != null" > + segmentation = #{segmentation,jdbcType=VARCHAR}, + </if> + <if test="mtu != null" > + mtu = #{mtu,jdbcType=VARCHAR}, + </if> + <if test="vlanTransparent != null" > + vlan_transparent = #{vlanTransparent,jdbcType=VARCHAR}, + </if> + <if test="routerExternal != null" > + router_external = #{routerExternal,jdbcType=VARCHAR}, + </if> + <if test="resourceProviderType != null" > + resource_provider_type = #{resourceProviderType,jdbcType=VARCHAR}, + </if> + <if test="resourceProviderId != null" > + resource_provider_id = #{resourceProviderId,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=VARCHAR} + </update> + <update id="updateByPrimaryKey" parameterType="org.openo.nfvo.resmanagement.service.entity.VirtualLinkEntity" > + update vl + set name = #{name,jdbcType=VARCHAR}, + backend_id = #{backendId,jdbcType=VARCHAR}, + is_public = #{isPublic,jdbcType=VARCHAR}, + dc_name = #{dcName,jdbcType=VARCHAR}, + vim_id = #{vimId,jdbcType=VARCHAR}, + vim_name = #{vimName,jdbcType=VARCHAR}, + physicial_net = #{physicialNet,jdbcType=VARCHAR}, + ns_id = #{nsId,jdbcType=VARCHAR}, + ns_name = #{nsName,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + network_type = #{networkType,jdbcType=VARCHAR}, + segmentation = #{segmentation,jdbcType=VARCHAR}, + mtu = #{mtu,jdbcType=VARCHAR}, + vlan_transparent = #{vlanTransparent,jdbcType=VARCHAR}, + router_external = #{routerExternal,jdbcType=VARCHAR}, + resource_provider_type = #{resourceProviderType,jdbcType=VARCHAR}, + resource_provider_id = #{resourceProviderId,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/VmMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/VmMapper.xml new file mode 100644 index 0000000..dc2376c --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/VmMapper.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright 2016-2017, Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.VmMapper" > + <resultMap id="BaseResultMap" type="org.openo.nfvo.resmanagement.service.entity.VmEntity" > + <id column="vm_id" property="vmId" jdbcType="VARCHAR" /> + <result column="vm_name" property="vmName" jdbcType="VARCHAR" /> + <result column="vm_status" property="vmStatus" jdbcType="VARCHAR" /> + <result column="vnf_instance_id" property="vnfInstanceId" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List" > + vm_id, vm_name, vm_status, vnf_instance_id + </sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from vm + where vm_id = #{vmId,jdbcType=VARCHAR} + </select> + <select id="getVms" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from vm + <where> + <if test="vmId != null"> + AND vm_id = #{vmId,jdbcType=VARCHAR} + </if> + <if test="vnfInstanceId != null"> + AND vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from vm + where vm_id = #{vmId,jdbcType=VARCHAR} + </delete> + <delete id="deleteByVnfId" parameterType="java.lang.String" > + delete from vm + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </delete> + <insert id="insert" parameterType="org.openo.nfvo.resmanagement.service.entity.VmEntity" > + insert into vm (vm_id, vm_name, vm_status, + vnf_instance_id) + values (#{vmId,jdbcType=VARCHAR}, #{vmName,jdbcType=VARCHAR}, #{vmStatus,jdbcType=VARCHAR}, + #{vnfInstanceId,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VmEntity" > + insert into vm + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="vmId != null" > + vm_id, + </if> + <if test="vmName != null" > + vm_name, + </if> + <if test="vmStatus != null" > + vm_status, + </if> + <if test="vnfInstanceId != null" > + vnf_instance_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="vmId != null" > + #{vmId,jdbcType=VARCHAR}, + </if> + <if test="vmName != null" > + #{vmName,jdbcType=VARCHAR}, + </if> + <if test="vmStatus != null" > + #{vmStatus,jdbcType=VARCHAR}, + </if> + <if test="vnfInstanceId != null" > + #{vnfInstanceId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VmEntity" > + update vm + <set > + <if test="vmName != null" > + vm_name = #{vmName,jdbcType=VARCHAR}, + </if> + <if test="vmStatus != null" > + vm_status = #{vmStatus,jdbcType=VARCHAR}, + </if> + <if test="vnfInstanceId != null" > + vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR}, + </if> + </set> + where vm_id = #{vmId,jdbcType=VARCHAR} + </update> + <update id="updateByPrimaryKey" parameterType="org.openo.nfvo.resmanagement.service.entity.VmEntity" > + update vm + set vm_name = #{vmName,jdbcType=VARCHAR}, + vm_status = #{vmStatus,jdbcType=VARCHAR}, + vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + where vm_id = #{vmId,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfInfoMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfInfoMapper.xml new file mode 100644 index 0000000..135ccc1 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfInfoMapper.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright 2016-2017, Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.VnfInfoMapper" > + <resultMap id="BaseResultMap" type="org.openo.nfvo.resmanagement.service.entity.VnfInfoEntity" > + <id column="vnf_instance_id" property="vnfInstanceId" jdbcType="VARCHAR" /> + <result column="ns_id" property="nsId" jdbcType="VARCHAR" /> + <result column="vnfm_id" property="vnfmId" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List" > + vnf_instance_id, ns_id, vnfm_id + </sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from vnfinfo + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </select> + <select id="getVnfInfos" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from vnf + <where> + <if test="vnfInstanceId != null"> + AND vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from vnfinfo + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </delete> + <insert id="insert" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfInfoEntity" > + insert into vnfinfo (vnf_instance_id, ns_id, vnfm_id + ) + values (#{vnfInstanceId,jdbcType=VARCHAR}, #{nsId,jdbcType=VARCHAR}, #{vnfmId,jdbcType=VARCHAR} + ) + </insert> + <insert id="insertSelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfInfoEntity" > + insert into vnfinfo + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="vnfInstanceId != null" > + vnf_instance_id, + </if> + <if test="nsId != null" > + ns_id, + </if> + <if test="vnfmId != null" > + vnfm_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="vnfInstanceId != null" > + #{vnfInstanceId,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + #{nsId,jdbcType=VARCHAR}, + </if> + <if test="vnfmId != null" > + #{vnfmId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfInfoEntity" > + update vnfinfo + <set > + <if test="nsId != null" > + ns_id = #{nsId,jdbcType=VARCHAR}, + </if> + <if test="vnfmId != null" > + vnfm_id = #{vnfmId,jdbcType=VARCHAR}, + </if> + </set> + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </update> + <update id="updateByPrimaryKey" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfInfoEntity" > + update vnfinfo + set ns_id = #{nsId,jdbcType=VARCHAR}, + vnfm_id = #{vnfmId,jdbcType=VARCHAR} + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfMapper.xml new file mode 100644 index 0000000..cd187c3 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfMapper.xml @@ -0,0 +1,319 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright 2016-2017, Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.VnfMapper" > + <resultMap id="BaseResultMap" type="org.openo.nfvo.resmanagement.service.entity.VnfEntity" > + <id column="id" property="id" jdbcType="VARCHAR" /> + <result column="vnf_instance_id" property="vnfInstanceId" jdbcType="VARCHAR" /> + <result column="vnf_instance_name" property="vnfInstanceName" jdbcType="VARCHAR" /> + <result column="ns_id" property="nsId" jdbcType="VARCHAR" /> + <result column="ns_name" property="nsName" jdbcType="VARCHAR" /> + <result column="vnfm_id" property="vnfmId" jdbcType="VARCHAR" /> + <result column="vnfm_name" property="vnfmName" jdbcType="VARCHAR" /> + <result column="vnf_package_name" property="vnfPackageName" jdbcType="VARCHAR" /> + <result column="vnf_descriptor_name" property="vnfDescriptorName" jdbcType="VARCHAR" /> + <result column="vim_id" property="vimId" jdbcType="VARCHAR" /> + <result column="vim_name" property="vimName" jdbcType="VARCHAR" /> + <result column="vim_tenant" property="vimTenant" jdbcType="VARCHAR" /> + <result column="job_id" property="jobId" jdbcType="VARCHAR" /> + <result column="vnf_status" property="vnfStatus" jdbcType="VARCHAR" /> + <result column="vnf_type" property="vnfType" jdbcType="VARCHAR" /> + <result column="max_vm" property="maxVm" jdbcType="INTEGER" /> + <result column="max_cpu" property="maxCpu" jdbcType="INTEGER" /> + <result column="max_disk" property="maxDisk" jdbcType="INTEGER" /> + <result column="max_ram" property="maxRam" jdbcType="INTEGER" /> + <result column="max_shd" property="maxShd" jdbcType="INTEGER" /> + <result column="max_net" property="maxNet" jdbcType="INTEGER" /> + <result column="name" property="name" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List" > + id, vnf_instance_id, vnf_instance_name, ns_id, ns_name, vnfm_id, vnfm_name, vnf_package_name, + vnf_descriptor_name, vim_id, vim_name, vim_tenant, job_id, vnf_status, vnf_type, + max_vm, max_cpu, max_disk, max_ram, max_shd, max_net, name + </sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from vnf + where id = #{id,jdbcType=VARCHAR} + </select> + <select id="getVnfs" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from vnf + <where> + <if test="id != null"> + AND ID = #{id,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from vnf + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </delete> + <insert id="insert" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfEntity" > + insert into vnf (id, vnf_instance_id, vnf_instance_name, + ns_id, ns_name, vnfm_id, + vnfm_name, vnf_package_name, vnf_descriptor_name, + vim_id, vim_name, vim_tenant, + job_id, vnf_status, vnf_type, + max_vm, max_cpu, max_disk, + max_ram, max_shd, max_net, + name) + values (#{id,jdbcType=VARCHAR}, #{vnfInstanceId,jdbcType=VARCHAR}, #{vnfInstanceName,jdbcType=VARCHAR}, + #{nsId,jdbcType=VARCHAR}, #{nsName,jdbcType=VARCHAR}, #{vnfmId,jdbcType=VARCHAR}, + #{vnfmName,jdbcType=VARCHAR}, #{vnfPackageName,jdbcType=VARCHAR}, #{vnfDescriptorName,jdbcType=VARCHAR}, + #{vimId,jdbcType=VARCHAR}, #{vimName,jdbcType=VARCHAR}, #{vimTenant,jdbcType=VARCHAR}, + #{jobId,jdbcType=VARCHAR}, #{vnfStatus,jdbcType=VARCHAR}, #{vnfType,jdbcType=VARCHAR}, + #{maxVm,jdbcType=INTEGER}, #{maxCpu,jdbcType=INTEGER}, #{maxDisk,jdbcType=INTEGER}, + #{maxRam,jdbcType=INTEGER}, #{maxShd,jdbcType=INTEGER}, #{maxNet,jdbcType=INTEGER}, + #{name,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfEntity" > + insert into vnf + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="id != null" > + id, + </if> + <if test="vnfInstanceId != null" > + vnf_instance_id, + </if> + <if test="vnfInstanceName != null" > + vnf_instance_name, + </if> + <if test="nsId != null" > + ns_id, + </if> + <if test="nsName != null" > + ns_name, + </if> + <if test="vnfmId != null" > + vnfm_id, + </if> + <if test="vnfmName != null" > + vnfm_name, + </if> + <if test="vnfPackageName != null" > + vnf_package_name, + </if> + <if test="vnfDescriptorName != null" > + vnf_descriptor_name, + </if> + <if test="vimId != null" > + vim_id, + </if> + <if test="vimName != null" > + vim_name, + </if> + <if test="vimTenant != null" > + vim_tenant, + </if> + <if test="jobId != null" > + job_id, + </if> + <if test="vnfStatus != null" > + vnf_status, + </if> + <if test="vnfType != null" > + vnf_type, + </if> + <if test="maxVm != null" > + max_vm, + </if> + <if test="maxCpu != null" > + max_cpu, + </if> + <if test="maxDisk != null" > + max_disk, + </if> + <if test="maxRam != null" > + max_ram, + </if> + <if test="maxShd != null" > + max_shd, + </if> + <if test="maxNet != null" > + max_net, + </if> + <if test="name != null" > + name, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="id != null" > + #{id,jdbcType=VARCHAR}, + </if> + <if test="vnfInstanceId != null" > + #{vnfInstanceId,jdbcType=VARCHAR}, + </if> + <if test="vnfInstanceName != null" > + #{vnfInstanceName,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + #{nsId,jdbcType=VARCHAR}, + </if> + <if test="nsName != null" > + #{nsName,jdbcType=VARCHAR}, + </if> + <if test="vnfmId != null" > + #{vnfmId,jdbcType=VARCHAR}, + </if> + <if test="vnfmName != null" > + #{vnfmName,jdbcType=VARCHAR}, + </if> + <if test="vnfPackageName != null" > + #{vnfPackageName,jdbcType=VARCHAR}, + </if> + <if test="vnfDescriptorName != null" > + #{vnfDescriptorName,jdbcType=VARCHAR}, + </if> + <if test="vimId != null" > + #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null" > + #{vimName,jdbcType=VARCHAR}, + </if> + <if test="vimTenant != null" > + #{vimTenant,jdbcType=VARCHAR}, + </if> + <if test="jobId != null" > + #{jobId,jdbcType=VARCHAR}, + </if> + <if test="vnfStatus != null" > + #{vnfStatus,jdbcType=VARCHAR}, + </if> + <if test="vnfType != null" > + #{vnfType,jdbcType=VARCHAR}, + </if> + <if test="maxVm != null" > + #{maxVm,jdbcType=INTEGER}, + </if> + <if test="maxCpu != null" > + #{maxCpu,jdbcType=INTEGER}, + </if> + <if test="maxDisk != null" > + #{maxDisk,jdbcType=INTEGER}, + </if> + <if test="maxRam != null" > + #{maxRam,jdbcType=INTEGER}, + </if> + <if test="maxShd != null" > + #{maxShd,jdbcType=INTEGER}, + </if> + <if test="maxNet != null" > + #{maxNet,jdbcType=INTEGER}, + </if> + <if test="name != null" > + #{name,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfEntity" > + update vnf + <set > + <if test="vnfInstanceId != null" > + vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR}, + </if> + <if test="vnfInstanceName != null" > + vnf_instance_name = #{vnfInstanceName,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + ns_id = #{nsId,jdbcType=VARCHAR}, + </if> + <if test="nsName != null" > + ns_name = #{nsName,jdbcType=VARCHAR}, + </if> + <if test="vnfmId != null" > + vnfm_id = #{vnfmId,jdbcType=VARCHAR}, + </if> + <if test="vnfmName != null" > + vnfm_name = #{vnfmName,jdbcType=VARCHAR}, + </if> + <if test="vnfPackageName != null" > + vnf_package_name = #{vnfPackageName,jdbcType=VARCHAR}, + </if> + <if test="vnfDescriptorName != null" > + vnf_descriptor_name = #{vnfDescriptorName,jdbcType=VARCHAR}, + </if> + <if test="vimId != null" > + vim_id = #{vimId,jdbcType=VARCHAR}, + </if> + <if test="vimName != null" > + vim_name = #{vimName,jdbcType=VARCHAR}, + </if> + <if test="vimTenant != null" > + vim_tenant = #{vimTenant,jdbcType=VARCHAR}, + </if> + <if test="jobId != null" > + job_id = #{jobId,jdbcType=VARCHAR}, + </if> + <if test="vnfStatus != null" > + vnf_status = #{vnfStatus,jdbcType=VARCHAR}, + </if> + <if test="vnfType != null" > + vnf_type = #{vnfType,jdbcType=VARCHAR}, + </if> + <if test="maxVm != null" > + max_vm = #{maxVm,jdbcType=INTEGER}, + </if> + <if test="maxCpu != null" > + max_cpu = #{maxCpu,jdbcType=INTEGER}, + </if> + <if test="maxDisk != null" > + max_disk = #{maxDisk,jdbcType=INTEGER}, + </if> + <if test="maxRam != null" > + max_ram = #{maxRam,jdbcType=INTEGER}, + </if> + <if test="maxShd != null" > + max_shd = #{maxShd,jdbcType=INTEGER}, + </if> + <if test="maxNet != null" > + max_net = #{maxNet,jdbcType=INTEGER}, + </if> + <if test="name != null" > + name = #{name,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=VARCHAR} + </update> + <update id="updateByPrimaryKey" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfEntity" > + update vnf + set vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR}, + vnf_instance_name = #{vnfInstanceName,jdbcType=VARCHAR}, + ns_id = #{nsId,jdbcType=VARCHAR}, + ns_name = #{nsName,jdbcType=VARCHAR}, + vnfm_id = #{vnfmId,jdbcType=VARCHAR}, + vnfm_name = #{vnfmName,jdbcType=VARCHAR}, + vnf_package_name = #{vnfPackageName,jdbcType=VARCHAR}, + vnf_descriptor_name = #{vnfDescriptorName,jdbcType=VARCHAR}, + vim_id = #{vimId,jdbcType=VARCHAR}, + vim_name = #{vimName,jdbcType=VARCHAR}, + vim_tenant = #{vimTenant,jdbcType=VARCHAR}, + job_id = #{jobId,jdbcType=VARCHAR}, + vnf_status = #{vnfStatus,jdbcType=VARCHAR}, + vnf_type = #{vnfType,jdbcType=VARCHAR}, + max_vm = #{maxVm,jdbcType=INTEGER}, + max_cpu = #{maxCpu,jdbcType=INTEGER}, + max_disk = #{maxDisk,jdbcType=INTEGER}, + max_ram = #{maxRam,jdbcType=INTEGER}, + max_shd = #{maxShd,jdbcType=INTEGER}, + max_net = #{maxNet,jdbcType=INTEGER}, + name = #{name,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file diff --git a/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfStatusMapper.xml b/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfStatusMapper.xml new file mode 100644 index 0000000..08a5101 --- /dev/null +++ b/ResmanagementService/service/src/main/resources/mybatis/mysql/VnfStatusMapper.xml @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Copyright 2016-2017, Huawei Technologies Co., Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.openo.nfvo.resmanagement.service.mapper.VnfStatusMapper" > + <resultMap id="BaseResultMap" type="org.openo.nfvo.resmanagement.service.entity.VnfStatusEntity" > + <id column="vnf_instance_id" property="vnfInstanceId" jdbcType="VARCHAR" /> + <result column="job_id" property="jobId" jdbcType="VARCHAR" /> + <result column="ns_id" property="nsId" jdbcType="VARCHAR" /> + <result column="vnfm_id" property="vnfmId" jdbcType="VARCHAR" /> + <result column="response_descriptor" property="responseDescriptor" jdbcType="VARCHAR" /> + <result column="status" property="status" jdbcType="VARCHAR" /> + <result column="progress" property="progress" jdbcType="VARCHAR" /> + <result column="status_description" property="statusDescription" jdbcType="VARCHAR" /> + <result column="error_code" property="errorCode" jdbcType="VARCHAR" /> + <result column="response_id" property="responseId" jdbcType="VARCHAR" /> + <result column="response_history_list" property="responseHistoryList" jdbcType="VARCHAR" /> + <result column="add_vm" property="addVm" jdbcType="VARCHAR" /> + <result column="del_vm" property="delVm" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Base_Column_List" > + vnf_instance_id, job_id, ns_id, vnfm_id, response_descriptor, status, progress, status_description, + error_code, response_id, response_history_list, add_vm, del_vm + </sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from vnfstatus + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </select> + <select id="getVnfStatuss" resultMap="BaseResultMap" parameterType="java.util.Map"> + select + <include refid="Base_Column_List" /> + from vnfstatus + <where> + <if test="vnfInstanceId != null"> + AND vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </if> + </where> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from vnfstatus + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </delete> + <insert id="insert" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfStatusEntity" > + insert into vnfstatus (vnf_instance_id, job_id, ns_id, + vnfm_id, response_descriptor, status, + progress, status_description, error_code, + response_id, response_history_list, add_vm, + del_vm) + values (#{vnfInstanceId,jdbcType=VARCHAR}, #{jobId,jdbcType=VARCHAR}, #{nsId,jdbcType=VARCHAR}, + #{vnfmId,jdbcType=VARCHAR}, #{responseDescriptor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, + #{progress,jdbcType=VARCHAR}, #{statusDescription,jdbcType=VARCHAR}, #{errorCode,jdbcType=VARCHAR}, + #{responseId,jdbcType=VARCHAR}, #{responseHistoryList,jdbcType=VARCHAR}, #{addVm,jdbcType=VARCHAR}, + #{delVm,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfStatusEntity" > + insert into vnfstatus + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="vnfInstanceId != null" > + vnf_instance_id, + </if> + <if test="jobId != null" > + job_id, + </if> + <if test="nsId != null" > + ns_id, + </if> + <if test="vnfmId != null" > + vnfm_id, + </if> + <if test="responseDescriptor != null" > + response_descriptor, + </if> + <if test="status != null" > + status, + </if> + <if test="progress != null" > + progress, + </if> + <if test="statusDescription != null" > + status_description, + </if> + <if test="errorCode != null" > + error_code, + </if> + <if test="responseId != null" > + response_id, + </if> + <if test="responseHistoryList != null" > + response_history_list, + </if> + <if test="addVm != null" > + add_vm, + </if> + <if test="delVm != null" > + del_vm, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="vnfInstanceId != null" > + #{vnfInstanceId,jdbcType=VARCHAR}, + </if> + <if test="jobId != null" > + #{jobId,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + #{nsId,jdbcType=VARCHAR}, + </if> + <if test="vnfmId != null" > + #{vnfmId,jdbcType=VARCHAR}, + </if> + <if test="responseDescriptor != null" > + #{responseDescriptor,jdbcType=VARCHAR}, + </if> + <if test="status != null" > + #{status,jdbcType=VARCHAR}, + </if> + <if test="progress != null" > + #{progress,jdbcType=VARCHAR}, + </if> + <if test="statusDescription != null" > + #{statusDescription,jdbcType=VARCHAR}, + </if> + <if test="errorCode != null" > + #{errorCode,jdbcType=VARCHAR}, + </if> + <if test="responseId != null" > + #{responseId,jdbcType=VARCHAR}, + </if> + <if test="responseHistoryList != null" > + #{responseHistoryList,jdbcType=VARCHAR}, + </if> + <if test="addVm != null" > + #{addVm,jdbcType=VARCHAR}, + </if> + <if test="delVm != null" > + #{delVm,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfStatusEntity" > + update vnfstatus + <set > + <if test="jobId != null" > + job_id = #{jobId,jdbcType=VARCHAR}, + </if> + <if test="nsId != null" > + ns_id = #{nsId,jdbcType=VARCHAR}, + </if> + <if test="vnfmId != null" > + vnfm_id = #{vnfmId,jdbcType=VARCHAR}, + </if> + <if test="responseDescriptor != null" > + response_descriptor = #{responseDescriptor,jdbcType=VARCHAR}, + </if> + <if test="status != null" > + status = #{status,jdbcType=VARCHAR}, + </if> + <if test="progress != null" > + progress = #{progress,jdbcType=VARCHAR}, + </if> + <if test="statusDescription != null" > + status_description = #{statusDescription,jdbcType=VARCHAR}, + </if> + <if test="errorCode != null" > + error_code = #{errorCode,jdbcType=VARCHAR}, + </if> + <if test="responseId != null" > + response_id = #{responseId,jdbcType=VARCHAR}, + </if> + <if test="responseHistoryList != null" > + response_history_list = #{responseHistoryList,jdbcType=VARCHAR}, + </if> + <if test="addVm != null" > + add_vm = #{addVm,jdbcType=VARCHAR}, + </if> + <if test="delVm != null" > + del_vm = #{delVm,jdbcType=VARCHAR}, + </if> + </set> + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </update> + <update id="updateByPrimaryKey" parameterType="org.openo.nfvo.resmanagement.service.entity.VnfStatusEntity" > + update vnfstatus + set job_id = #{jobId,jdbcType=VARCHAR}, + ns_id = #{nsId,jdbcType=VARCHAR}, + vnfm_id = #{vnfmId,jdbcType=VARCHAR}, + response_descriptor = #{responseDescriptor,jdbcType=VARCHAR}, + status = #{status,jdbcType=VARCHAR}, + progress = #{progress,jdbcType=VARCHAR}, + status_description = #{statusDescription,jdbcType=VARCHAR}, + error_code = #{errorCode,jdbcType=VARCHAR}, + response_id = #{responseId,jdbcType=VARCHAR}, + response_history_list = #{responseHistoryList,jdbcType=VARCHAR}, + add_vm = #{addVm,jdbcType=VARCHAR}, + del_vm = #{delVm,jdbcType=VARCHAR} + where vnf_instance_id = #{vnfInstanceId,jdbcType=VARCHAR} + </update> +</mapper>
\ No newline at end of file |