summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
diff options
context:
space:
mode:
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>