diff options
author | zhangfan345 <zhangfan345@huawei.com> | 2022-08-30 10:47:22 +0800 |
---|---|---|
committer | guanyu zhu <zhuguanyu5@huawei.com> | 2022-08-30 12:20:27 +0000 |
commit | 6331fc23cbe8321150fbcf0f176a1106e3982aa0 (patch) | |
tree | 94d8e38425d30e120f91596e82eb28d766490e9e /intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml | |
parent | a6a29c67cbb22b9b120d08fe5310a45a16d987c6 (diff) |
Update intent module and CRUD APIs
Issue-ID: USECASEUI-710
Signed-off-by: zhangfan345 <zhangfan345@huawei.com>
Change-Id: I3e53e952b3554235e324b87adef2a997bae82d2a
Signed-off-by: zhangfan345 <zhangfan345@huawei.com>
Diffstat (limited to 'intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml')
-rw-r--r-- | intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml index 7f4b24a..012dfca 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml @@ -5,30 +5,55 @@ <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 into condition(condition_id, condition_name, operator_type, condition_value, parent_id) + values + <foreach collection="conditionList" index="index" item="item" separator=","> + (#{item.conditionId}, #{item.conditionName}, #{item.operator}, #{item.conditionValue}, #{parentId}) + </foreach> </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 into condition_mapping(condition_id, parent_type, parent_id) + values + <foreach collection="conditionList" index="index" item="item" separator=","> + (#{item.conditionId}, #{parentType}, #{parentId}) + </foreach> </insert> -<!-- 这里的查询有问题--> - <select id="selectConditionByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition"> - select condition_id conditionId, condition_name conditiontName, operator_type operatorType + <insert id="insertCondition"> + insert into condition(condition_id, condition_name, operator_type, condition_value, parent_id) + values + (#{condition.conditionId}, #{condition.conditionName}, #{condition.operator}, #{condition.conditionValue}, #{parentId}) + </insert> + <!-- 这里的查询有问题--> + <select id="selectConditionList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition"> + select condition_id conditionId, condition_name conditionName, operator_type operator, condition_value conditionValue + from condition + where parent_id = #{parentId} + </select> + + <select id="selectCondition" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition"> + select condition_id conditionId, condition_name conditionName, operator_type operator, condition_value conditionValue from condition - where condition_id = #{parentId} + where condition_id = #{conditionId} </select> -</mapper>
\ No newline at end of file + <update id="updateCondition"> + update condition + <trim prefix="set" suffixOverrides=","> + <if test="condition.conditionName != null">condition_name = #{condition.conditionName},</if> + <if test="condition.operator != null">operator_type = #{condition.operator},</if> + <if test="condition.conditionValue != null">condition_value = #{condition.conditionValue},</if> + </trim> + where condition_id = #{condition.conditionId} + </update> + + <delete id="deleteCondition"> + DELETE FROM condition WHERE condition_id = #{condition.conditionId} + </delete> + + <delete id="deleteConditionList"> + DELETE FROM condition WHERE parent_id = #{parentId} + </delete> + +</mapper> |