dangsn
2023-08-02 54f35ae7866dac5c497372b68d03309c7eae9424
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?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="com.vci.ubcs.omd.mapper.BtmTypeMapper">
 
 
    <resultMap id="BaseResultMap" type="com.vci.ubcs.omd.entity.BtmType">
        <id column="oid" jdbcType="VARCHAR" property="oid" />
        <result column="id" jdbcType="VARCHAR" property="id" />
        <result column="name" jdbcType="VARCHAR" property="name" />
        <result column="description" jdbcType="VARCHAR" property="description" />
        <result column="table_name" jdbcType="VARCHAR" property="tableName" />
        <result column="revision_rule_id" jdbcType="VARCHAR" property="revisionRuleId" />
        <result column="revision_rule_name" jdbcType="VARCHAR" property="revisionRuleName" />
        <result column="revision_sep" jdbcType="VARCHAR" property="revisionSep" />
        <result column="revision_flag" jdbcType="VARCHAR" property="revisionFlag" />
        <result column="input_revision_flag" jdbcType="VARCHAR" property="inputRevisionFlag" />
        <result column="secret_flag" jdbcType="VARCHAR" property="secretFlag" />
        <result column="abstract_flag" jdbcType="VARCHAR" property="abstractFlag" />
        <result column="impl_class" jdbcType="VARCHAR" property="implClass" />
        <result column="shape" jdbcType="VARCHAR" property="shape" />
        <result column="life_cycle_flag" jdbcType="VARCHAR" property="lifeCycleFlag" />
        <result column="life_cycle_id" jdbcType="VARCHAR" property="lifeCycleId" />
        <result column="life_cycle_name" jdbcType="VARCHAR" property="lifeCycleName" />
        <result column="version_rule" jdbcType="VARCHAR" property="versionRule" />
        <result column="sub_life_cycle_id" jdbcType="VARCHAR" property="subLifeCycleId" />
        <result column="sub_life_cycle_name" jdbcType="VARCHAR" property="subLifeCycleName" />
        <result column="view_flag" jdbcType="VARCHAR" property="viewFlag" />
        <result column="view_create_sql" jdbcType="VARCHAR" property="viewCreateSql" />
        <result column="btm_name" property="btmName" jdbcType="VARCHAR" />
        <result column="owner" property="owner" jdbcType="VARCHAR" />
        <result column="creator" jdbcType="VARCHAR" property="creator" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="last_modifier" jdbcType="VARCHAR" property="lastModifier" />
        <result column="last_modify_time" jdbcType="TIMESTAMP" property="lastModifyTime" />
        <result column="ts" jdbcType="TIMESTAMP" property="ts" />
        <result column="biz_domain" jdbcType="VARCHAR" property="bizDomain" />
        <result column="consistence" jdbcType="VARCHAR" property="consistence" />
    </resultMap>
 
    <sql id="base_query_column">
        oid, id, name, description, table_name, revision_rule_id, revision_rule_name,revision_flag,
    revision_sep, input_revision_flag, secret_flag, abstract_flag, impl_class, shape,life_cycle_flag, life_cycle_id,life_cycle_name,
    version_rule,sub_life_cycle_id,sub_life_cycle_name, view_flag, view_create_sql,btm_name, owner, creator, create_time, last_modifier,
    last_modify_time, ts,biz_domain,consistence
    </sql>
    <sql id="tableName">
        pl_omd_btm_type
    </sql>
    <insert id="batchInsert" useGeneratedKeys="false">
        insert into <include refid="tableName"/> (
            <include refid="base_query_column"/>
        )
        <foreach collection="records" item="item" separator="union all">
            (
            select #{item.oid,jdbcType=VARCHAR},
                   #{item.id,jdbcType=VARCHAR},
                   #{item.name,jdbcType=VARCHAR},
            #{item.description,jdbcType=VARCHAR},
            #{item.tableName,jdbcType=VARCHAR},
            #{item.revisionRuleId,jdbcType=VARCHAR},
            #{item.revisionRuleName,jdbcType=VARCHAR},
            #{item.revisionFlag,jdbcType=VARCHAR},
            #{item.revisionSep,jdbcType=VARCHAR},
            #{item.inputRevisionFlag,jdbcType=VARCHAR},
            #{item.secretFlag,jdbcType=VARCHAR},
            #{item.abstractFlag,jdbcType=VARCHAR},
            #{item.implClass,jdbcType=VARCHAR},
            #{item.shape,jdbcType=VARCHAR},
            #{item.lifeCycleFlag,jdbcType=VARCHAR},
            #{item.lifeCycleId,jdbcType=VARCHAR},
            #{item.lifeCycleName,jdbcType=VARCHAR},
            #{item.versionRule,jdbcType=VARCHAR},
            #{item.subLifeCycleId,jdbcType=VARCHAR},
            #{item.subLifeCycleName,jdbcType=VARCHAR},
            #{item.viewFlag,jdbcType=VARCHAR},
            #{item.viewCreateSql,jdbcType=VARCHAR},
            #{item.btmName,jdbcType=VARCHAR },
            #{item.owner,jdbcType=VARCHAR },
            #{item.creator,jdbcType=VARCHAR},
            #{item.createTime,jdbcType=TIMESTAMP},
            #{item.lastModifier,jdbcType=VARCHAR},
            #{item.lastModifyTime,jdbcType=TIMESTAMP},
            #{item.ts,jdbcType=TIMESTAMP},
            #{item.bizDomain,jdbcType=VARCHAR},
            #{item.consistence,jdbcType=VARCHAR}
            from dual
            )
        </foreach>
    </insert>
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
        delete from <include refid="tableName"/>
        where OID = #{oid,jdbcType=VARCHAR}
    </delete>
 
    <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
        select <include refid="base_query_column"/>
        from <include refid="tableName" />
        where OID = #{oid,jdbcType=VARCHAR}
    </select>
 
    <select id="selectByPrimaryKeys" resultMap="BaseResultMap">
        select <include refid="base_query_column" />
        from <include refid="tableName" />
        where OID in ( ${oids,jdbcType=VARCHAR})
    </select>
 
    <select id="selectByPrimaryKeyCollection" resultMap="BaseResultMap">
        select <include refid="base_query_column" />
        from <include refid="tableName" />
        <where>
            <foreach collection="oids" item="item" index="arrayindex" open=" OID in ( " close=")" >
                #{item,jdbcType=VARCHAR}
                <if test="(arrayindex != oids.size() -1)">
                    ,
                </if>
            </foreach>
        </where>
    </select>
 
    <select id="selectByIdCollection" resultMap="BaseResultMap">
        select <include refid="base_query_column" />
        from <include refid="tableName" />
        <where>
            <foreach collection="ids" item="item" index="arrayindex" open=" lower(ID) in ( " close=")" >
                lower(#{item,jdbcType=VARCHAR})
                <if test="(arrayindex != ids.size() -1)">
                    ,
                </if>
            </foreach>
        </where>
    </select>
 
    <select id="selectAll" resultMap="BaseResultMap">
        select <include refid="base_query_column"/>
        from <include refid="tableName" />
    </select>
 
    <update id="updateByPrimaryKey" parameterType="com.vci.ubcs.omd.entity.BtmType">
        update <include refid="tableName"/>
        set id = #{id,jdbcType=VARCHAR},
            name = #{name,jdbcType=VARCHAR},
            description = #{description,jdbcType=VARCHAR},
            table_name = #{tableName,jdbcType=VARCHAR},
            revision_rule_id = #{revisionRuleId,jdbcType=VARCHAR},
            revision_flag = #{revisionFlag,jdbcType=VARCHAR},
            revision_rule_name = #{revisionRuleName,jdbcType=VARCHAR},
            revision_sep = #{revisionSep,jdbcType=VARCHAR},
            input_revision_flag = #{inputRevisionFlag,jdbcType=VARCHAR},
            secret_flag = #{secretFlag,jdbcType=VARCHAR},
            abstract_flag = #{abstractFlag,jdbcType=VARCHAR},
            impl_class = #{implClass,jdbcType=VARCHAR},
            shape = #{shape,jdbcType=VARCHAR},
            life_cycle_flag = #{lifeCycleFlag,jdbcType=VARCHAR},
            life_cycle_id = #{lifeCycleId,jdbcType=VARCHAR},
            life_cycle_name = #{lifeCycleName,jdbcType=VARCHAR},
            version_rule = #{versionRule,jdbcType=VARCHAR},
            sub_life_cycle_id = #{subLifeCycleId,jdbcType=VARCHAR},
            sub_life_cycle_name = #{subLifeCycleName,jdbcType=VARCHAR},
            view_flag = #{viewFlag,jdbcType=VARCHAR},
            view_create_sql = #{viewCreateSql,jdbcType=VARCHAR},
            last_modifier = #{lastModifier,jdbcType=VARCHAR},
            last_modify_time = #{lastModifyTime,jdbcType=TIMESTAMP},
            ts = #{ts,jdbcType=TIMESTAMP},
            biz_domain = #{bizDomain,jdbcType=VARCHAR},
            consistence = #{consistence,jdbcType=VARCHAR}
        where OID = #{oid,jdbcType=VARCHAR}
    </update>
 
 
    <select id="selectNameByOid" resultType="java.lang.String">
        select NAME from <include refid="tableName" />
        where OID = #{oid,jdbcType=VARCHAR}
    </select>
    <select id="selectNameById" resultType="java.lang.String">
        select NAME from <include refid="tableName" />
        where ID = #{id,jdbcType=VARCHAR}
    </select>
 
 
    <select id="selectByAttributeOid" resultMap="BaseResultMap">
        select <include refid="base_query_column"/>
        from <include refid="tableName" /> where oid in (
        select DISTINCT PKBTMTYPE from <include refid="tableName"/>ATTRIBUTE
        where lower(ATTRIBUTEID) in (select id from vcibt_ATTRIBUTE where oid = #{pkAttribute,jdbcType=VARCHAR} ) )
    </select>
 
 
    <select id="selectByRevisionRuleOid" resultMap="BaseResultMap">
        select <include refid="base_query_column"/>
        from <include refid="tableName" /> where REVISIONRULEID in
        (select DISTINCT  id from  vcibt_REVISIONRULE where oid = #{pkRevisionRule,jdbcType=VARCHAR} )
    </select>
 
 
    <select id="selectByLifeCycleOid" resultMap="BaseResultMap">
        select <include refid="base_query_column"/>
        from <include refid="tableName" /> where LIFECYCLEID in
        (select DISTINCT  id from  vcibt_LIFECYCLE where oid = #{pkLifeCycle,jdbcType=VARCHAR} )
    </select>
 
    <delete id="batchDeleteByOids" >
        delete from <include refid="tableName" />
        <where>
            <foreach collection="oids" item="item" index="arrayindex" open=" oid in ( " close=")" >
                #{item,jdbcType=VARCHAR}
                <if test="(arrayindex != oids.size() -1)">
                    ,
                </if>
            </foreach>
        </where>
    </delete>
 
 
 
 
</mapper>