aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ExpectationObjectMapper.xml
blob: 74a09040da5bde8a7411fe3b081ebcfeb179bf90 (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
<?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.ExpectationObjectMapper">


    <insert id="insertExpectationObject">
        <if test="expectationObject != null">
            insert into expectation_object(object_type, object_instance, expectation_id)
            values
            (#{expectationObject.objectType}, #{expectationObject.objectInstance}, #{expectationId})
        </if>
    </insert>

    <select id="selectExpectationObject" resultType="org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject">
        select object_type objectType, object_instance objectInstance
        from expectation_object
        where expectation_id = #{expectationId}
    </select>

    <select id="selectExpectationObjectId" resultType="java.lang.String">
        select object_id
        from expectation_object
        where expectation_id = #{expectationId}
    </select>

    <update id="updateExpectationObject">
        update expectation_object
        <trim prefix="set" suffixOverrides=",">
            <if test="expectationObject.objectType != null">object_type = #{expectationObject.objectType},</if>
            <if test="expectationObject.objectInstance != null">object_instance = #{expectationObject.objectInstance},</if>
        </trim>
        where expectation_id = #{expectationId}
    </update>

    <delete id="deleteExpectationObject">
        delete from expectation_object
        where expectation_id = #{expectationId}
    </delete>

    <select id="getExpectationIdByObjectInstance" resultType="java.lang.String">
        select expectation_id
        from expectation_object
        where object_instance = #{objectInstance}
    </select>

    <select id="getAllObjectInstances" resultType="java.lang.String">
        select object_instance
        from expectation_object
    </select>
</mapper>