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

    <insert id="insertConditionList">
        <if test="conditionList != null">
            insert into condition(condition_id, condition_name, operator_type, condition_value)
            values
            <foreach collection="conditionList" index="index" item="item" separator=",">
                (#{item.conditionId}, #{item.conditionName}, #{item.operatorType}, #{item.conditionValue})
            </foreach>
        </if>
    </insert>

    <insert id="insertConditionParentList">
        <if test="conditionList != null">
            insert into condition_mapping(condition_id, parent_type, parent_id)
            values
            <foreach collection="conditionList" index="index" item="item" separator=",">
                (#{item.conditionId}, #{parentType}, #{parentId})
            </foreach>
        </if>
    </insert>

<!--    这里的查询有问题-->
    <select id="selectConditionByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition">
        select condition_id conditionId, condition_name conditiontName, operator_type operatorType
        from condition
        where condition_id = #{parentId}
    </select>

</mapper>