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