summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml
blob: 31625c8dc82d7901b5b64ab348f625e8ded2748c (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.ExpectationTargetMapper">


    <insert id="insertExpectationTarget">
        insert into expectation_target(target_id, target_name, expectation_id)
        values
            (#{expectationTarget.targetId}, #{expectationTarget.targetName},  #{expectationId})
    </insert>

    <insert id="insertExpectationTargetList">
        insert into expectation_target(target_id, target_name, expectation_id)
        values
        <foreach collection="expectationTargetList" index="index" item="item" separator=",">
            (#{item.targetId}, #{item.targetName}, #{expectationId})
        </foreach>
    </insert>

    <select id="selectExpectationTargetList" resultType="org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget">
        select target_id targetId, target_name targetName
        from expectation_target
        where expectation_id = #{expectationId}
    </select>

    <select id="selectExpectationTarget" resultType="org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget">
        select target_id targetId, target_name targetName
        from expectation_target
        where target_id = #{expectationTargetId}
    </select>

    <update id="updateExpectationTarget">
        update expectation_target
        <trim prefix="set" suffixOverrides=",">
            <if test="expectationTarget.targetName != null">target_name = #{expectationTarget.targetName},</if>
        </trim>
        where target_id = #{expectationTargetId}
    </update>

    <delete id="deleteExpectationTarget">
        delete from expectation_target
        where target_id = #{expectationTargetId}
    </delete>

    <delete id="deleteExpectationTargetList">
        delete from expectation_target
        where expectation_id= #{expectationId}
    </delete>

</mapper>