diff options
author | hekeguang <hekeguang@chinamobile.com> | 2022-08-22 21:16:25 +0800 |
---|---|---|
committer | hekeguang <hekeguang@chinamobile.com> | 2022-08-22 21:16:44 +0800 |
commit | 6433005256513ec2943ee2ea52f2844711e4d62f (patch) | |
tree | 779e80ca6f3e812a6d1c4fecb7ce577f6ab9fe88 /intentanalysis/src | |
parent | 235aa1c823235f98ee9564e717e77ca068c2b1f1 (diff) |
Add database code.
Issue-ID: USECASEUI-696
Change-Id: I1c8ce807ca1f2aaeebc8646d8a14df9f4b27a436
Signed-off-by: hekeguang <hekeguang@chinamobile.com>
Diffstat (limited to 'intentanalysis/src')
5 files changed, 70 insertions, 9 deletions
diff --git a/intentanalysis/src/main/resources/intent-analysis-init.sql b/intentanalysis/src/main/resources/intent-analysis-init.sql index 3e34576..727e0c6 100644 --- a/intentanalysis/src/main/resources/intent-analysis-init.sql +++ b/intentanalysis/src/main/resources/intent-analysis-init.sql @@ -19,15 +19,12 @@ create table if not exists expectation_object( create table if not exists expectation_target( target_id varchar(255) primary key, target_name varchar(255), - target_condition varchar(255), expectation_id varchar(255) ); create table if not exists context( context_id varchar(255) primary key, - context_name varchar(255), - context_type varchar(255), - context_condition varchar(255) + context_name varchar(255) ); create table if not exists context_mapping( @@ -50,3 +47,24 @@ create table if not exists state( condition varchar(255), expectation_id varchar(255) ); + +create table if not exists condition( + condition_id varchar(255) primary key, + condition_name varchar(255), + operator_type varchar(255), + condition_value varchar(255) +); + +create table if not exists condition_mapping( + condition_id varchar(255) primary key, + parent_type varchar(255), + parent_id varchar(255) + ); + +create table if not exists intent_management_function_reg_info{ + imfr_info_id varchar(255) primary key, + imfr_info_description varchar(255), + support_model varchar(255), + handle_name varchar(255), + intent_function_type varchar(255) + };
\ No newline at end of file diff --git a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml new file mode 100644 index 0000000..d77c06a --- /dev/null +++ b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml @@ -0,0 +1,30 @@ +<?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"> + insert into condition(condition_id, condition_name, operator_type, condition_value) + values + <foreach collection="contextList" index="index" item="item" separator=","> + (#{item.conditionId}, #{item.conditionName}, #{item.operatorType}, #{item.conditionValue}) + </foreach> + </insert> + + <insert id="insertConditionParentList"> + 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.Context"> + select condition_id conditionId, condition_name conditiontName, operator_type operatorType + from condition + where condition_id = #{parentId} + </select> + +</mapper>
\ No newline at end of file diff --git a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml index 450721d..56569e4 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/ContextMapper.xml @@ -6,10 +6,10 @@ <insert id="insertContextList"> - insert into context(context_id, context_name, context_type, context_condition) + insert into context(context_id, context_name) values <foreach collection="contextList" index="index" item="item" separator=","> - (#{item.contextId}, #{item.contextName}, #{item.contextType}, #{item.contextCondition}) + (#{item.contextId}, #{item.contextName}) </foreach> </insert> @@ -22,7 +22,7 @@ </insert> <select id="selectContextByParentId" resultType="org.onap.usecaseui.intentanalysis.bean.models.Context"> - select context_id contextId, context_name contextName, context_type contextType, context_condition contextCondition + select context_id contextId, context_name contextName from context where intent_id = #{parentId} </select> diff --git a/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml index 0a915bf..89648b5 100644 --- a/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml +++ b/intentanalysis/src/main/resources/mybatis/sql/ExpectationTargetMapper.xml @@ -6,9 +6,9 @@ <insert id="insertExpectationTarget"> - insert into expectation_target(target_id, target_name, target_condition, expectation_id) + insert into expectation_target(target_id, target_name, expectation_id) values - (#{expectationTarget.targetId}, #{expectationTarget.targetName}, #{expectationTarget.targetCondition}, #{expectationId}) + (#{expectationTarget.targetId}, #{expectationTarget.targetName}, #{expectationId}) </insert> </mapper> diff --git a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml new file mode 100644 index 0000000..8f6cd3c --- /dev/null +++ b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml @@ -0,0 +1,13 @@ +<?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.IMFRegInfoMapper"> + + <insert id="insertIMFRegInfoRegInfo"> + insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_model,handle_name,intent_function_type) + values + (#{imfregInfo.id}, #{imfregInfo.description}, #{imfregInfo.supportArea},#{imfregInfo.handleName},#{imfregInfo.intentFunctionType}) + </insert> + +</mapper> |