aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentInstance.java40
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java45
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentInstanceMapper.java32
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentReportMapper.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentInstanceService.java29
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentReportService.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentInstanceServiceImpl.java87
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java22
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java13
-rw-r--r--intentanalysis/src/main/resources/intent-analysis-init.sql5
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/IntentInstanceMapper.xml25
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/IntentReportMapper.xml6
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-init.sql5
13 files changed, 310 insertions, 7 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentInstance.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentInstance.java
new file mode 100644
index 0000000..4ef3683
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentInstance.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.onap.usecaseui.intentanalysis.bean.models;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class IntentInstance {
+ private String intentInstanceId;
+
+ private String intentId;
+
+ private List<FulfillmentInfo> fulfillmentInfos;
+
+ private List<String> intentReportIds;
+
+ public IntentInstance() {
+ }
+
+ public IntentInstance(String intentInstanceId, String intentId) {
+ this.intentInstanceId = intentInstanceId;
+ this.intentId = intentId;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java
new file mode 100644
index 0000000..201cc77
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentInstanceController.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.onap.usecaseui.intentanalysis.controller;
+
+import lombok.extern.log4j.Log4j2;
+import org.onap.usecaseui.intentanalysis.bean.models.ResultHeader;
+import org.onap.usecaseui.intentanalysis.bean.models.ServiceResult;
+import org.onap.usecaseui.intentanalysis.service.IntentInstanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import static org.onap.usecaseui.intentanalysis.common.ResponseConsts.RSEPONSE_SUCCESS;
+
+@Log4j2
+@RestController
+@RequestMapping("/intent/instance")
+public class IntentInstanceController {
+ @Autowired
+ private IntentInstanceService intentInstanceService;
+
+ @GetMapping(value = "/{intentInstanceId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ServiceResult getIntentById(
+ @PathVariable("intentInstanceId") String intentInstanceId) {
+ return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "Get Intent Instance Success"),
+ intentInstanceService.getIntentInstance(intentInstanceId));
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentInstanceMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentInstanceMapper.java
new file mode 100644
index 0000000..b5305ec
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentInstanceMapper.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.onap.usecaseui.intentanalysis.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentInstance;
+
+@Mapper
+public interface IntentInstanceMapper {
+ int insertIntentInstance(@Param(value = "intentInstance") IntentInstance intentInstance);
+
+ String selectIntentInstanceByIntentId(@Param(value = "intentId") String intentId);
+
+ int deleteIntentInstances(@Param(value = "intentId") String intentId);
+
+ IntentInstance selectIntentInstance(@Param(value = "intentInstanceId") String intentInstanceId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentReportMapper.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentReportMapper.java
index 99ce7fe..4290a53 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentReportMapper.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/mapper/IntentReportMapper.java
@@ -19,7 +19,11 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.onap.usecaseui.intentanalysis.bean.models.IntentReport;
+import java.util.List;
+
@Mapper
public interface IntentReportMapper {
int insertIntentReport(@Param(value = "intentReport") IntentReport intentReport);
+
+ List<String> getIntentReportIds(@Param(value = "intentReference") String intentReference);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentInstanceService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentInstanceService.java
new file mode 100644
index 0000000..f6788c1
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentInstanceService.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.onap.usecaseui.intentanalysis.service;
+
+import org.onap.usecaseui.intentanalysis.bean.models.IntentInstance;
+
+public interface IntentInstanceService {
+ void createIntentInstance(IntentInstance intentInstance);
+
+ String queryIntentInstanceId(String intentId);
+
+ void deleteIntentInstance(String intentId);
+
+ IntentInstance getIntentInstance(String intentInstanceId);
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentReportService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentReportService.java
index 63b5d51..8180bc2 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentReportService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/IntentReportService.java
@@ -18,8 +18,12 @@ package org.onap.usecaseui.intentanalysis.service;
import org.onap.usecaseui.intentanalysis.bean.models.ServiceResult;
+import java.util.List;
+
public interface IntentReportService {
ServiceResult getIntentReportByIntentId(String intentId);
void saveIntentReportByIntentId(String intentId);
+
+ List<String> getIntentReportIds(String intentReference);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentInstanceServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentInstanceServiceImpl.java
new file mode 100644
index 0000000..d7f9f18
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentInstanceServiceImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * 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.
+ */
+
+package org.onap.usecaseui.intentanalysis.service.impl;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentInfo;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentInstance;
+import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
+import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
+import org.onap.usecaseui.intentanalysis.mapper.IntentInstanceMapper;
+import org.onap.usecaseui.intentanalysis.service.FulfillmentInfoService;
+import org.onap.usecaseui.intentanalysis.service.IntentInstanceService;
+import org.onap.usecaseui.intentanalysis.service.IntentReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+@Service
+@Slf4j
+public class IntentInstanceServiceImpl implements IntentInstanceService {
+ @Autowired
+ private IntentInstanceMapper intentInstanceMapper;
+
+ @Autowired
+ private FulfillmentInfoService fulfillmentInfoService;
+
+ @Autowired
+ private IntentReportService intentReportService;
+
+ @Override
+ public void createIntentInstance(IntentInstance intentInstance) {
+ int num = intentInstanceMapper.insertIntentInstance(intentInstance);
+ if (num < 1) {
+ String msg = "Failed to insert intent instance to database.";
+ log.error(msg);
+ throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
+ }
+ }
+
+ @Override
+ public String queryIntentInstanceId(String intentId) {
+ String intentInstanceId = intentInstanceMapper.selectIntentInstanceByIntentId(intentId);
+ if (StringUtils.isEmpty(intentInstanceId)) {
+ log.error("get intentInstanceId is failed,intentId is {}", intentId);
+ }
+ return intentInstanceId;
+ }
+
+ @Override
+ public void deleteIntentInstance(String intentId) {
+ int num = intentInstanceMapper.deleteIntentInstances(intentId);
+ if (num < 1) {
+ log.error("delete intent instance is failed,intentId is {}", intentId);
+ }
+ }
+
+ @Override
+ public IntentInstance getIntentInstance(String intentInstanceId) {
+ IntentInstance intentInstance = intentInstanceMapper.selectIntentInstance(intentInstanceId);
+ if (intentInstance == null) {
+ log.error("get intentInstance is empty,intentInstanceId is {}", intentInstanceId);
+ return null;
+ }
+ FulfillmentInfo fulfillmentInfo = fulfillmentInfoService.getFulfillmentInfo(intentInstance.getIntentId());
+ intentInstance.setFulfillmentInfos(Collections.singletonList(fulfillmentInfo));
+ List<String> intentReportIds = intentReportService.getIntentReportIds(intentInstance.getIntentInstanceId());
+ intentInstance.setIntentReportIds(intentReportIds);
+ return intentInstance;
+ }
+}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
index c443f9e..d4c0f88 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentReportServiceImpl.java
@@ -27,6 +27,7 @@ import org.onap.usecaseui.intentanalysis.mapper.IntentReportFulfillmentInfoMappe
import org.onap.usecaseui.intentanalysis.mapper.IntentReportMapper;
import org.onap.usecaseui.intentanalysis.mapper.ObjectInstanceMapper;
import org.onap.usecaseui.intentanalysis.service.FulfillmentInfoService;
+import org.onap.usecaseui.intentanalysis.service.IntentInstanceService;
import org.onap.usecaseui.intentanalysis.service.IntentReportService;
import org.onap.usecaseui.intentanalysis.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,9 @@ public class IntentReportServiceImpl implements IntentReportService {
@Autowired
private IntentReportMapper intentReportMapper;
+ @Autowired
+ private IntentInstanceService intentInstanceService;
+
@Override
@Transactional(rollbackFor = DataBaseException.class)
public ServiceResult getIntentReportByIntentId(String intentId) {
@@ -68,7 +72,7 @@ public class IntentReportServiceImpl implements IntentReportService {
fulfillmentInfo.setObjectInstances(getInstances(intentId));
IntentReport intentReport = new IntentReport();
intentReport.setIntentReportId(CommonUtil.getUUid());
- intentReport.setIntentReference("intentReference");
+ intentReport.setIntentReference(intentInstanceService.queryIntentInstanceId(intentId));
intentReport.setFulfillmentInfos(Collections.singletonList(fulfillmentInfo));
intentReport.setReportTime(CommonUtil.getTime());
@@ -77,6 +81,11 @@ public class IntentReportServiceImpl implements IntentReportService {
intentReport);
}
+ /**
+ * Generate intention reports on a regular basis and save them in the database
+ *
+ * @param intentId intentId
+ */
@Override
@Transactional(rollbackFor = DataBaseException.class)
public void saveIntentReportByIntentId(String intentId) {
@@ -87,11 +96,20 @@ public class IntentReportServiceImpl implements IntentReportService {
}
IntentReport intentReport = new IntentReport();
intentReport.setIntentReportId(CommonUtil.getUUid());
- intentReport.setIntentReference("intentReference");
+ intentReport.setIntentReference(intentInstanceService.queryIntentInstanceId(intentId));
intentReport.setReportTime(CommonUtil.getTime());
saveIntentReport(intentReport, fulfillmentInfo);
}
+ @Override
+ public List<String> getIntentReportIds(String intentReference) {
+ List<String> intentReportIds = intentReportMapper.getIntentReportIds(intentReference);
+ if (CollectionUtils.isEmpty(intentReportIds)) {
+ log.error("get intentReportId is empty,intentReference is {}", intentReference);
+ }
+ return intentReportIds;
+ }
+
private FulfillmentInfo getFulfillmentInfo(String intentId) {
FulfillmentInfo fulfillmentInfo = fulfillmentInfoService.getFulfillmentInfo(intentId);
log.info("fulfillmentInfo is {}", fulfillmentInfo);
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
index a04f909..bc1ab30 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
@@ -16,7 +16,6 @@
package org.onap.usecaseui.intentanalysis.service.impl;
-
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -26,13 +25,15 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.onap.usecaseui.intentanalysis.bean.models.Condition;
import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentInstance;
import org.onap.usecaseui.intentanalysis.mapper.ConditionMapper;
import org.onap.usecaseui.intentanalysis.mapper.ContextMapper;
import org.onap.usecaseui.intentanalysis.mapper.ObjectInstanceMapper;
+import org.onap.usecaseui.intentanalysis.service.IntentInstanceService;
+import org.onap.usecaseui.intentanalysis.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
@@ -42,7 +43,6 @@ import org.onap.usecaseui.intentanalysis.service.ExpectationService;
import org.onap.usecaseui.intentanalysis.service.FulfillmentInfoService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
-
@Service
@Slf4j
public class IntentServiceImpl implements IntentService {
@@ -56,8 +56,6 @@ public class IntentServiceImpl implements IntentService {
@Autowired
private ContextService contextService;
- private ContextParentType contextParentType;
-
@Autowired
private FulfillmentInfoService fulfillmentInfoService;
@@ -73,6 +71,9 @@ public class IntentServiceImpl implements IntentService {
@Autowired
private ConditionMapper conditionMapper;
+ @Autowired
+ private IntentInstanceService intentInstanceService;
+
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Intent createIntent(Intent intent) {
@@ -84,6 +85,7 @@ public class IntentServiceImpl implements IntentService {
expectationService.createIntentExpectationList(intent.getIntentExpectations(), intent.getIntentId());
contextService.createContextList(intent.getIntentContexts(), intent.getIntentId());
fulfillmentInfoService.createFulfillmentInfo(intent.getIntentFulfillmentInfo(), intent.getIntentId());
+ intentInstanceService.createIntentInstance(new IntentInstance(CommonUtil.getUUid(), intent.getIntentId()));
log.info("Successfully created intent to database.");
return intent;
}
@@ -146,6 +148,7 @@ public class IntentServiceImpl implements IntentService {
contextService.deleteContextList(intentId);
expectationService.deleteIntentExpectationList(intentId);
objectInstanceMapper.deleteObjectInstances(intentId);
+ intentInstanceService.deleteIntentInstance(intentId);
if (intentMapper.deleteIntent(intentId) < 1) {
String msg = "Failed to delete intent to database.";
log.error(msg);
diff --git a/intentanalysis/src/main/resources/intent-analysis-init.sql b/intentanalysis/src/main/resources/intent-analysis-init.sql
index 61ea45b..00bf2cf 100644
--- a/intentanalysis/src/main/resources/intent-analysis-init.sql
+++ b/intentanalysis/src/main/resources/intent-analysis-init.sql
@@ -101,3 +101,8 @@ create table if not exists object_instance(
parent_id varchar(255),
object_instance varchar(255)
);
+
+create table if not exists intent_instance(
+ intent_instance_id varchar(255) primary key,
+ intent_id varchar(255)
+ );
diff --git a/intentanalysis/src/main/resources/mybatis/sql/IntentInstanceMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IntentInstanceMapper.xml
new file mode 100644
index 0000000..3534e78
--- /dev/null
+++ b/intentanalysis/src/main/resources/mybatis/sql/IntentInstanceMapper.xml
@@ -0,0 +1,25 @@
+<?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="org.onap.usecaseui.intentanalysis.mapper.IntentInstanceMapper">
+ <insert id="insertIntentInstance">
+ insert into intent_instance(intent_instance_id,intent_id)
+ values (#{intentInstance.intentInstanceId},#{intentInstance.intentId});
+ </insert>
+
+ <select id="selectIntentInstanceByIntentId" resultType="java.lang.String">
+ select intent_instance_id from intent_instance
+ where intent_id = #{intentId}
+ </select>
+
+ <delete id="deleteIntentInstances">
+ delete from intent_instance where intent_id = #{intentId}
+ </delete>
+
+ <select id="selectIntentInstance"
+ resultType="org.onap.usecaseui.intentanalysis.bean.models.IntentInstance">
+ select intent_instance_id intentInstanceId,intent_id intentId from intent_instance
+ where intent_instance_id = #{intentInstanceId}
+ </select>
+</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/IntentReportMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IntentReportMapper.xml
index 02a571b..078ea9b 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/IntentReportMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/IntentReportMapper.xml
@@ -8,4 +8,10 @@
insert into intent_report(intent_report_id, intent_reference,report_time)
values (#{intentReport.intentReportId},#{intentReport.intentReference},to_timestamp(#{intentReport.reportTime},'yyyy-MM-dd HH24:mi:ss'))
</insert>
+
+ <select id="getIntentReportIds" resultType="java.lang.String">
+ select intent_report_id
+ from intent_report
+ where intent_reference = #{intentReference}
+ </select>
</mapper>
diff --git a/intentanalysis/src/test/resources/intentdb-test-init.sql b/intentanalysis/src/test/resources/intentdb-test-init.sql
index c3abda1..05ea854 100644
--- a/intentanalysis/src/test/resources/intentdb-test-init.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-init.sql
@@ -117,4 +117,9 @@ create table if not exists intent_report_fulfillment_info(
create table if not exists object_instance(
parent_id varchar(255),
object_instance varchar(255)
+ );
+
+create table if not exists intent_instance(
+ intent_instance_id varchar(255) primary key,
+ intent_id varchar(255)
); \ No newline at end of file