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

    <select id="selectIntent" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
        select intent_id intentId, intent_name intentName from intent
        where intent_id = #{intentId}
    </select>

    <select id="selectIntentList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
        select intent_id intentId, intent_name intentName from intent
    </select>

    <insert id="insertIntent">
        insert into Intent(intent_id, intent_name)
        values(#{intent.intentId}, #{intent.intentName})
    </insert>

    <update id="updateIntent" parameterType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
        update intent
        <trim prefix="set" suffixOverrides=",">
            <if test="intent.intentName != null">intent_name = #{intent.intentName},</if>
        </trim>
        where intent_id = #{intent.intentId}
    </update>

    <delete id="deleteIntent" parameterType="string">
        delete
        from intent
        where intent_id = #{intentId}
    </delete>

    <select id="getIntentByName" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
        select intent_id intentId, intent_name intentName from intent
        where intent_name like  "%"#{intent.intentName}"%"
    </select>

</mapper>