2 * Copyright 2016-2017, Nokia Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.vfc.nfvo.driver.vnfm.svnfm.db.mapper;
19 import java.util.List;
21 import org.apache.ibatis.annotations.Delete;
22 import org.apache.ibatis.annotations.Insert;
23 import org.apache.ibatis.annotations.Mapper;
24 import org.apache.ibatis.annotations.Result;
25 import org.apache.ibatis.annotations.Results;
26 import org.apache.ibatis.annotations.Select;
27 import org.apache.ibatis.annotations.Update;
28 import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmJobExecutionInfo;
31 public interface VnfmJobExecutionMapper {
32 @Select("SELECT * FROM vnfm_job_execution_info")
34 @Result(property = "jobId", column = "job_id"),
35 @Result(property = "vnfmExecutionId", column = "vnfm_execution_id"),
36 @Result(property = "vnfInstanceId", column = "vnf_instance_id"),
37 @Result(property = "vnfmInterfceName", column = "vnfm_interface_name"),
38 @Result(property = "status", column = "status"),
39 @Result(property = "operateStartTime", column = "operate_start_time"),
40 @Result(property = "operateEndTime", column = "operate_end_time")
42 List<VnfmJobExecutionInfo> getAll();
44 @Select("SELECT * FROM vnfm_job_execution_info WHERE job_id = #{jobId}")
46 @Result(property = "jobId", column = "job_id"),
47 @Result(property = "vnfmExecutionId", column = "vnfm_execution_id"),
48 @Result(property = "vnfInstanceId", column = "vnf_instance_id"),
49 @Result(property = "vnfmInterfceName", column = "vnfm_interface_name"),
50 @Result(property = "status", column = "status"),
51 @Result(property = "operateStartTime", column = "operate_start_time"),
52 @Result(property = "operateEndTime", column = "operate_end_time")
54 VnfmJobExecutionInfo findOne(Long jobId);
56 @Insert("INSERT INTO vnfm_job_execution_info(vnfm_execution_id,vnf_instance_id,vnfm_interface_name,status,operate_start_time, operate_end_time) VALUES(#{vnfmExecutionId}, #{vnfInstanceId}, #{vnfmInterfceName}, #{status}, #{operateStartTime}, #{operateEndTime})")
57 void insert(VnfmJobExecutionInfo user);
59 @Update("UPDATE vnfm_job_execution_info SET vnfm_execution_id=#{vnfmExecutionId},vnf_instance_id=#{vnfInstanceId},vnfm_interface_name=#{vnfmInterfceName},status=#{status},operate_start_time=#{operateStartTime}, operate_end_time=#{operateEndTime} WHERE job_id =#{jobId}")
60 void update(VnfmJobExecutionInfo user);
62 @Delete("DELETE FROM vnfm_job_execution_info WHERE id =#{id}")
65 @Select("select * from vnfm_job_execution_info where job_id = (select max(job_id) from vnfm_job_execution_info)")
67 @Result(property = "jobId", column = "job_id"),
68 @Result(property = "vnfmExecutionId", column = "vnfm_execution_id"),
69 @Result(property = "vnfInstanceId", column = "vnf_instance_id"),
70 @Result(property = "vnfmInterfceName", column = "vnfm_interface_name"),
71 @Result(property = "status", column = "status"),
72 @Result(property = "operateStartTime", column = "operate_start_time"),
73 @Result(property = "operateEndTime", column = "operate_end_time")
75 VnfmJobExecutionInfo findNewestJobInfo();