summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql
diff options
context:
space:
mode:
authorzhangfan345 <zhangfan345@huawei.com>2022-07-30 10:38:41 +0800
committerFan Zhang <zhangfan345@huawei.com>2022-08-02 06:19:11 +0000
commit731c8ac3faac6b00bc39bdf2e3a0b6a511f94431 (patch)
tree0cf0a8f46018deacbff703d4e1456e8233c8f9ff /intentanalysis/src/main/resources/mybatis/sql
parenta51fa2e8573a8463109e7c8b1ed6938c9488fb21 (diff)
Add update function in intent service
Signed-off-by: zhangfan345 <zhangfan345@huawei.com> Issue-ID: USECASEUI-706 Change-Id: I0f027fd8b8876e1b24cbb40ecc50bacc20fa9837
Diffstat (limited to 'intentanalysis/src/main/resources/mybatis/sql')
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml22
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml1
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml23
3 files changed, 43 insertions, 3 deletions
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
index 720bdd5..3b0923f 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
@@ -12,7 +12,7 @@
where intent_id = #{intentId}
</select>
- <insert id="insertExpectation">
+ <insert id="insertExpectationList">
insert into expectation(expectation_id, expectation_name, target_moi, intent_id)
values
<foreach collection="expectationList" index="index" item="item" separator=",">
@@ -25,4 +25,24 @@
where intent_id = #{intentId}
</delete>
+ <update id="updateExpectation">
+ 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>
+
+ <insert id="insertExpectation">
+ insert into expectation(expectation_id, expectation_name, target_moi, intent_id)
+ values (#{expectation.expectationId}, #{expectation.expectationName}, #{expectation.targetMOI}, #{intentId})
+ </insert>
+
+ <delete id="deleteExpectationById">
+ delete
+ from expectation
+ where expectation_id = #{expectationId}
+ </delete>
+
</mapper> \ No newline at end of file
diff --git a/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
index 335ba6d..5e2847b 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
@@ -21,7 +21,6 @@
<update id="updateIntent" parameterType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
update intent
<trim prefix="set" suffixOverrides=",">
- <if test="intentId != null">intent_id = #{intentId},</if>
<if test="intentName != null">intent_name = #{intentName},</if>
</trim>
where intent_id = #{intentId}
diff --git a/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml
index 4850870..9e30981 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/StateMapper.xml
@@ -11,7 +11,7 @@
where expectation_id = #{expectationId}
</select>
- <insert id="insertState" parameterType="java.util.ArrayList">
+ <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=",">
@@ -24,4 +24,25 @@
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})
+ </insert>
+
+ <update id="updateState" parameterType="java.util.List">
+ update state
+ <trim prefix="set" suffixOverrides=",">
+ <if test="stateName != null">state_name = #{stateName},</if>
+ <if test="isSatisfied != null">is_satisfied = #{isSatisfied},</if>
+ <if test="condition != null">condition = #{condition},</if>
+ </trim>
+ where state_id = #{stateId}
+ </update>
+
+ <delete id="deleteStateById">
+ delete
+ from state
+ where state_id = #{stateId}
+ </delete>
+
</mapper> \ No newline at end of file