aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/resources/mybatis/sql/IntentMapper.xml
blob: 9d6029f918974a62b02910600edebbcc78d8302b (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
<?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="selectIntentById" resultType="org.onap.usecaseui.intentanalysis.bean.models.Intent">
        select intent_id intentId, intent_name intentName from intent
        where intent_id = #{intentId}
    </select>

    <select id="selectIntents" 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(#{intentId}, #{intentName})
    </insert>

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

    <delete id="deleteIntentById" 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  "%"#{intentName}"%"
    </select>

</mapper>