summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
blob: 56569e4eb42e6003164b29ace6e661918080102a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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.ContextMapper">


    <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>
    </insert>

    <select id="selectContextByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context">
        select context_id contextId, context_name contextName
        from context
        where intent_id = #{parentId}
    </select>

</mapper>