summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/main/resources/mybatis')
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml24
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml26
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml28
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml20
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml16
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml11
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml13
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml25
8 files changed, 98 insertions, 65 deletions
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
index 8a39762..7f4b24a 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
@@ -5,19 +5,23 @@
<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ConditionMapper">
<insert id="insertConditionList">
- insert into condition(condition_id, condition_name, operator_type, condition_value)
- values
- <foreach collection="contextList" index="index" item="item" separator=",">
- (#{item.conditionId}, #{item.conditionName}, #{item.operatorType}, #{item.conditionValue})
- </foreach>
+ <if test="conditionList != null">
+ insert into condition(condition_id, condition_name, operator_type, condition_value)
+ values
+ <foreach collection="conditionList" index="index" item="item" separator=",">
+ (#{item.conditionId}, #{item.conditionName}, #{item.operatorType}, #{item.conditionValue})
+ </foreach>
+ </if>
</insert>
<insert id="insertConditionParentList">
- insert into condition_mapping(condition_id, parent_type, parent_id)
- values
- <foreach collection="conditionList" index="index" item="item" separator=",">
- (#{item.conditionId}, #{parentType}, #{parentId})
- </foreach>
+ <if test="conditionList != null">
+ insert into condition_mapping(condition_id, parent_type, parent_id)
+ values
+ <foreach collection="conditionList" index="index" item="item" separator=",">
+ (#{item.conditionId}, #{parentType}, #{parentId})
+ </foreach>
+ </if>
</insert>
<!-- 这里的查询有问题-->
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
index 56569e4..975bd03 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
@@ -6,25 +6,19 @@
<insert id="insertContextList">
- insert into context(context_id, context_name)
- values
- <foreach collection="contextList" index="index" item="item" separator=",">
- (#{item.contextId}, #{item.contextName})
- </foreach>
- </insert>
-
- <insert id="insertContextParentList">
- insert into context_mapping(context_id, parent_type, parent_id)
- values
- <foreach collection="contextList" index="index" item="item" separator=",">
- (#{item.contextId}, #{parentType}, #{parentId})
- </foreach>
+ <if test="contextList != null">
+ insert into context(context_id, context_name, parent_id)
+ values
+ <foreach collection="contextList" index="index" item="item" separator=",">
+ (#{item.contextId}, #{item.contextName}, #{parentId})
+ </foreach>
+ </if>
</insert>
<select id="selectContextByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context">
- select context_id contextId, context_name contextName
+ select context_id contextId, context_name contextName, context_condition contextCondition
from context
- where intent_id = #{parentId}
+ where parent_id = #{parentId}
</select>
-</mapper>
+</mapper> \ No newline at end of file
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
index 98aa3dd..24d574b 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
@@ -5,12 +5,14 @@
<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.ExpectationMapper">
- <insert id="insertIntentExpectations">
- insert into expectation(expectation_id, expectation_name, expectation_type, intent_id)
- values
- <foreach collection="intentExpectations" index="index" item="item" separator=",">
- (#{item.expectationId}, #{item.expectationName}, #{item.expectationType}, #{intentId})
- </foreach>
+ <insert id="insertIntentExpectationList">
+ <if test="intentExpectationList != null">
+ insert into expectation(expectation_id, expectation_name, expectation_type, intent_id)
+ values
+ <foreach collection="intentExpectationList" index="index" item="item" separator=",">
+ (#{item.expectationId}, #{item.expectationName}, #{item.expectationType}, #{intentId})
+ </foreach>
+ </if>
</insert>
<insert id="insertIntentExpectation">
@@ -18,9 +20,9 @@
values (#{expectation.expectationId}, #{expectation.expectationName}, #{expectation.expectationType}, #{intentId})
</insert>
- <select id="selectIntentExpectationsByIntentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
- select expectation_id expectationId, expectation_name expectationName,
- target_moi targetMOI, intent_id intentId
+ <select id="selectIntentExpectationListByIntentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
+ select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType,
+ intent_id intentId
from expectation
where intent_id = #{intentId}
</select>
@@ -29,13 +31,13 @@
update expectation
<trim prefix="set" suffixOverrides=",">
<if test="expectationName != null">expectation_name = #{expectationName},</if>
- <if test="targetMOI != null">target_moi = #{targetMOI},</if>
</trim>
where expectation_id = #{expectationId}
</update>
- <delete id="deleteIntentExpectationsByIntentId">
- delete from expectation
+ <delete id="deleteIntentExpectationListByIntentId">
+ delete
+ from expectation
where intent_id = #{intentId}
</delete>
@@ -45,4 +47,4 @@
where expectation_id = #{expectationId}
</delete>
-</mapper>
+</mapper> \ No newline at end of file
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml
index d67b9bf..b158eb2 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml
@@ -6,9 +6,23 @@
<insert id="insertExpectationObject">
- insert into expectation_object(expectation_id, object_type, object_instance)
- values
- (#{expectationId}, #{expectationObject.objectType}, #{expectationObject.objectInstance})
+ <if test="expectationObject != null">
+ insert into expectation_object(object_type, object_instance, expectation_id)
+ values
+ (#{expectationObject.objectType}, #{expectationObject.objectInstance}, #{expectationId})
+ </if>
</insert>
+ <select id="selectIntentExpectationObjectByExpectationId" resultType="org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject">
+ select object_type objectType, object_instance objectInstance
+ from expectation_object
+ where expectation_id = #{expectationId}
+ </select>
+
+ <select id="selectExpectationObjectId" resultType="java.lang.String">
+ select object_id
+ from expectation_object
+ where expectation_id = #{expectationId}
+ </select>
+
</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml
index 89648b5..1910912 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml
@@ -6,9 +6,17 @@
<insert id="insertExpectationTarget">
- insert into expectation_target(target_id, target_name, expectation_id)
- values
- (#{expectationTarget.targetId}, #{expectationTarget.targetName}, #{expectationId})
+ <if test="expectationTarget != null">
+ insert into expectation_target(target_id, target_name, target_condition, expectation_id)
+ values
+ (#{expectationTarget.targetId}, #{expectationTarget.targetName}, #{expectationTarget.targetCondition}, #{expectationId})
+ </if>
</insert>
-</mapper>
+ <select id="selectIntentExpectationTargetListByExpectationId" resultType="org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget">
+ select target_id targetId, target_name targetName, target_condition targetCondition
+ from expectation_target
+ where expectation_id = #{expectationId}
+ </select>
+
+</mapper> \ No newline at end of file
diff --git a/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml
index e5a9668..2290703 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/FulfilmentInfoMapper.xml
@@ -6,14 +6,17 @@
<insert id="insertFulfilmentInfo">
- insert into fulfilment_info(fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason)
- values (#{parentId}, #{fulfilmentInfo.fulfilmentStatus}, #{fulfilmentInfo.notFulfilledState}, #{fulfilmentInfo.notFulfilledReason})
+ <if test="fulfilmentInfo != null">
+ insert into fulfilment_info(fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason)
+ values (#{parentId}, #{fulfilmentInfo.fulfilmentStatus}, #{fulfilmentInfo.notFulfilledState}, #{fulfilmentInfo.notFulfilledReason})
+ </if>
</insert>
<select id="selectFulfilmentInfoById" resultType="org.onap.usecaseui.intentanalysis.bean.models.FulfilmentInfo">
select fulfilment_info_status fulfilmentStatus, not_fulfilled_state notFulfilledState,
- not_fulfilled_reason notFulfilledReason from fulfilment_info
- where parent_id = #{parentId}
+ not_fulfilled_reason notFulfilledReason
+ from fulfilment_info
+ where fulfilment_info_id = #{parentId}
</select>
</mapper>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
index 9d6029f..643c193 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
@@ -5,17 +5,19 @@
<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.IntentMapper">
<select id="selectIntentById" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
- select intent_id intentId, intent_name intentName from intent
+ select intent_id intentId, intent_name intentName
+ from intent
where intent_id = #{intentId}
</select>
- <select id="selectIntents" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
- select intent_id intentId, intent_name intentName from intent
+ <select id="selectIntentList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
+ select intent_id intentId, intent_name intentName
+ from intent
</select>
<insert id="insertIntent" >
insert into Intent(intent_id, intent_name)
- values(#{intentId}, #{intentName})
+ values(#{intent.intentId}, #{intent.intentName})
</insert>
<update id="updateIntent" parameterType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
@@ -27,7 +29,8 @@
</update>
<delete id="deleteIntentById" parameterType="string">
- delete from intent
+ delete
+ from intent
where intent_id = #{intentId}
</delete>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml
index 9e30981..d103015 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml
@@ -5,28 +5,33 @@
<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.StateMapper">
<select id="selectStateByExpectation" resultType="org.onap.usecaseui.intentanalysis.bean.models.State">
- select state_id stateId, state_name stateName, expectation_id expectationId,
- is_satisfied isSatisfied, condition
+ select state_id stateId, state_name stateName, condition,
+ is_satisfied isSatisfied
from state
where expectation_id = #{expectationId}
</select>
<insert id="insertStateList" parameterType="java.util.ArrayList">
- insert into state(state_id, state_name, expectation_id, is_satisfied, condition)
- values
- <foreach collection="stateList" index="index" item="item" separator=",">
- (#{item.stateId}, #{item.stateName}, #{expectationId}, #{item.isSatisfied}, #{item.condition})
- </foreach>
+ <if test="stateList != null">
+ insert into state(state_id, state_name, expectation_id, is_satisfied, condition)
+ values
+ <foreach collection="stateList" index="index" item="item" separator=",">
+ (#{item.stateId}, #{item.stateName}, #{expectationId}, #{item.isSatisfied}, #{item.condition})
+ </foreach>
+ </if>
</insert>
<delete id="deleteStateByExpectationId">
- delete from state
+ delete
+ from state
where expectation_id = #{expectationId}
</delete>
<insert id="insertState">
- insert into state(state_id, state_name, expectation_id, is_satisfied, condition)
- values (#{state.stateId}, #{state.stateName}, #{expectationId}, #{state.isSatisfied}, #{state.condition})
+ <if test="state != null">
+ insert into state(state_id, state_name, expectation_id, is_satisfied, condition)
+ values (#{state.stateId}, #{state.stateName}, #{expectationId}, #{state.isSatisfied}, #{state.condition})
+ </if>
</insert>
<update id="updateState" parameterType="java.util.List">