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
41
42
43
44
45
46
47
48
|
<?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.StateMapper">
<select id="selectStateByExpectation" resultType="org.onap.usecaseui.intentanalysis.bean.models.State">
select state_id stateId, state_name stateName, expectation_id expectationId,
is_satisfied isSatisfied, condition
from state
where expectation_id = #{expectationId}
</select>
<insert id="insertStateList" parameterType="java.util.ArrayList">
insert into state(state_id, state_name, expectation_id, is_satisfied, condition)
values
<foreach collection="stateList" index="index" item="item" separator=",">
(#{item.stateId}, #{item.stateName}, #{expectationId}, #{item.isSatisfied}, #{item.condition})
</foreach>
</insert>
<delete id="deleteStateByExpectationId">
delete from state
where expectation_id = #{expectationId}
</delete>
<insert id="insertState">
insert into state(state_id, state_name, expectation_id, is_satisfied, condition)
values (#{state.stateId}, #{state.stateName}, #{expectationId}, #{state.isSatisfied}, #{state.condition})
</insert>
<update id="updateState" parameterType="java.util.List">
update state
<trim prefix="set" suffixOverrides=",">
<if test="stateName != null">state_name = #{stateName},</if>
<if test="isSatisfied != null">is_satisfied = #{isSatisfied},</if>
<if test="condition != null">condition = #{condition},</if>
</trim>
where state_id = #{stateId}
</update>
<delete id="deleteStateById">
delete
from state
where state_id = #{stateId}
</delete>
</mapper>
|