aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml
blob: 450721d9942ab8de2d1658f7d39fed0207911d60 (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, context_type, context_condition)
        values
        <foreach collection="contextList" index="index" item="item" separator=",">
            (#{item.contextId}, #{item.contextName}, #{item.contextType}, #{item.contextCondition})
        </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, context_type contextType, context_condition contextCondition
        from context
        where intent_id = #{parentId}
    </select>

</mapper>