aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ExpectationMapper.xml
blob: e97c9150b54736d29a6a43e13e5308b18c0769c4 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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.ExpectationMapper">


    <insert id="insertIntentExpectationList">
        <if test="intentExpectationList != null">
            insert into expectation(expectation_id, expectation_name, expectation_type, intent_id)
            values
            <foreach collection="intentExpectationList" index="index" item="item" separator=",">
                (#{item.expectationId}, #{item.expectationName}, #{item.expectationType}, #{intentId})
            </foreach>
        </if>
    </insert>

    <insert id="insertIntentExpectation">
        insert into expectation(expectation_id, expectation_name, expectation_type, intent_id)
        values (#{intentExpectation.expectationId}, #{intentExpectation.expectationName}, #{intentExpectation.expectationType}, #{intentId})
    </insert>

    <select id="selectIntentExpectationList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
        select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType
        from expectation
        where intent_id = #{intentId}
    </select>

    <select id="selectIntentExpectation" resultType="org.onap.usecaseui.intentanalysis.bean.models.Expectation">
        select expectation_id expectationId, expectation_name expectationName, expectation_type expectationType
        from expectation
        where expectation_id = #{expectationId}
    </select>

    <update id="updateIntentExpectation">
        update expectation
        <trim prefix="set" suffixOverrides=",">
            <if test="intentExpectation.expectationName != null">expectation_name = #{intentExpectation.expectationName},</if>
            <if test="intentExpectation.expectationType != null">expectation_type = #{intentExpectation.expectationType},</if>
        </trim>
        where expectation_id = #{intentExpectation.expectationId}
    </update>

    <delete id="deleteIntentExpectationList">
        delete
        from expectation
        where intent_id = #{intentId}
    </delete>

    <delete id="deleteIntentExpectation">
        delete
        from expectation
        where expectation_id = #{expectationId}
    </delete>

    <select id="getIntentIdByExpectationId" resultType="java.lang.String">
        select intent_id
        from expectation
        where expectation_id = #{expectationId}
          and expectation_type = #{expectationType}
    </select>
</mapper>