diff options
author | luxin <luxin7@huawei.com> | 2017-07-03 10:19:19 +0800 |
---|---|---|
committer | luxin <luxin7@huawei.com> | 2017-07-03 10:19:19 +0800 |
commit | 056dcab91efc64b5f9fc39825f9242e7fa0b9d05 (patch) | |
tree | d1af18cb6bfa6d3d61f0f77ff958d5a3ce7d6d06 /ResmanagementService/service/src/main/resources/mybatis/mysql/VmMapper.xml | |
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/VmMapper.xml')
-rw-r--r-- | ResmanagementService/service/src/main/resources/mybatis/mysql/VmMapper.xml | 114 |
1 files changed, 114 insertions, 0 deletions
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 |