summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
diff options
context:
space:
mode:
authorzhangfan345 <zhangfan345@huawei.com>2022-08-30 10:47:22 +0800
committerguanyu zhu <zhuguanyu5@huawei.com>2022-08-30 12:20:27 +0000
commit6331fc23cbe8321150fbcf0f176a1106e3982aa0 (patch)
tree94d8e38425d30e120f91596e82eb28d766490e9e /intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
parenta6a29c67cbb22b9b120d08fe5310a45a16d987c6 (diff)
Update intent module and CRUD APIs
Issue-ID: USECASEUI-710 Signed-off-by: zhangfan345 <zhangfan345@huawei.com> Change-Id: I3e53e952b3554235e324b87adef2a997bae82d2a Signed-off-by: zhangfan345 <zhangfan345@huawei.com>
Diffstat (limited to 'intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml')
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml45
1 files changed, 35 insertions, 10 deletions
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
index 975bd03..ff04551 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
@@ -6,19 +6,44 @@
<insert id="insertContextList">
- <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 into context(context_id, context_name, parent_id)
+ values
+ <foreach collection="contextList" index="index" item="item" separator=",">
+ (#{item.contextId}, #{item.contextName}, #{parentId})
+ </foreach>
</insert>
- <select id="selectContextByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context">
- select context_id contextId, context_name contextName, context_condition contextCondition
+ <select id="selectContextList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context">
+ select context_id contextId, context_name contextName
from context
where parent_id = #{parentId}
</select>
-</mapper> \ No newline at end of file
+ <select id="selectContext" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context">
+ select context_id contextId, context_name contextName
+ from context
+ where context_id = #{contextId}
+ </select>
+
+ <insert id="insertContext">
+ insert into context(context_id, context_name, parent_id)
+ values
+ (#{context.contextId}, #{context.contextName}, #{parentId})
+ </insert>
+
+ <update id="updateContext">
+ update context
+ <trim prefix="set" suffixOverrides=",">
+ <if test="context.contextName != null">context_name = #{context.contextName},</if>
+ </trim>
+ where context_id = #{context.contextId}
+ </update>
+
+ <delete id="deleteContext">
+ DELETE FROM context WHERE context_id = #{context.contextId}
+ </delete>
+
+ <delete id="deleteContextList">
+ DELETE FROM context WHERE parent_id = #{parentId}
+ </delete>
+</mapper>