<?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.BtmTypeAttributeMapper">
|
|
<resultMap id="base_result_map" type="com.vci.ubcs.omd.entity.BtmTypeAttribute">
|
<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="pk_btm_type" jdbcType="VARCHAR" property="pkBtmType"/>
|
<result column="attribute_length" jdbcType="DECIMAL" property="attributeLength"/>
|
<result column="attr_data_type" jdbcType="VARCHAR" property="attrDataType"/>
|
<result column="nullable_flag" jdbcType="VARCHAR" property="nullableFlag"/>
|
<result column="default_value" jdbcType="VARCHAR" property="defaultValue"/>
|
<result column="precision_length" jdbcType="DECIMAL" property="precisionLength"/>
|
<result column="scale_length" property="scaleLength" jdbcType="DECIMAL"/>
|
<result column="range" jdbcType="VARCHAR" property="range"/>
|
<result column="refer_btm_type_id" jdbcType="VARCHAR" property="referBtmTypeId"/>
|
<result column="refer_btm_type_name" jdbcType="VARCHAR" property="referBtmTypeName"/>
|
<result column="enum_id" jdbcType="VARCHAR" property="enumId"/>
|
<result column="enum_name" jdbcType="VARCHAR" property="enumName"/>
|
<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"/>
|
</resultMap>
|
|
<sql id="base_query_column">
|
oid, id, name, description, pk_btm_type, attribute_length, attr_data_type, nullable_flag,
|
default_value, precision_length, scale_length, range, refer_btm_type_id, refer_btm_type_name,
|
enum_id, enum_name, btm_name, owner, creator, create_time, last_modifier, last_modify_time, ts
|
</sql>
|
|
<sql id="tableName">
|
pl_omd_btm_type_attribute
|
</sql>
|
<sql id="btmTypeTableName">
|
pl_omd_btm_type
|
</sql>
|
<update id="batchUpdate" parameterType="java.util.List">
|
BEGIN
|
<foreach collection="records" item="item" index="index" separator=";">
|
update <include refid="tableName"/> set
|
id = #{item.id,jdbcType=VARCHAR},
|
name = #{item.name,jdbcType=VARCHAR},
|
description = #{item.description,jdbcType=VARCHAR},
|
pk_btm_type = #{item.pkBtmType,jdbcType=VARCHAR},
|
attribute_length = #{item.attributeLength,jdbcType=DECIMAL},
|
attr_data_type = #{item.attrDataType,jdbcType=VARCHAR},
|
nullable_flag = #{item.nullableFlag,jdbcType=VARCHAR},
|
default_value = #{item.defaultValue,jdbcType=VARCHAR},
|
precision_length = #{item.precisionLength,jdbcType=DECIMAL},
|
scale_length = #{item.scaleLength,jdbcType=DECIMAL},
|
range = #{item.range,jdbcType=VARCHAR},
|
refer_btm_type_id = #{item.referBtmTypeId,jdbcType=VARCHAR},
|
refer_btm_type_name = #{item.referBtmTypeName,jdbcType=VARCHAR},
|
enum_id = #{item.enumId,jdbcType=VARCHAR},
|
enum_name = #{item.enumName,jdbcType=VARCHAR},
|
btm_name = #{item.btmName,jdbcType=VARCHAR},
|
owner = #{item.owner,jdbcType=VARCHAR},
|
creator = #{item.creator,jdbcType=VARCHAR},
|
create_time = #{item.createTime,jdbcType=TIMESTAMP},
|
last_modifier = #{item.lastModifier,jdbcType=VARCHAR},
|
last_modify_time = #{item.lastModifyTime,jdbcType=TIMESTAMP},
|
ts = #{item.ts,jdbcType=TIMESTAMP}
|
where oid = #{item.oid,jdbcType=VARCHAR}
|
</foreach>
|
;END;
|
</update>
|
<delete id="batchDelete">
|
delete from
|
<include refid="tableName"/>
|
<where>
|
<foreach collection="records" item="item" index="arrayindex" open="oid in (" close=")">
|
#{item,jdbcType=VARCHAR}
|
<if test="(arrayindex != records.size() -1)">
|
,
|
</if>
|
</foreach>
|
</where>
|
</delete>
|
<select id="selectByBtmTypeIdAndAttributeIds" resultType="com.vci.ubcs.omd.entity.BtmTypeAttribute">
|
select <include refid="base_query_column"/>
|
from <include refid="tableName" />
|
where PKBTMTYPE = (select oid from <include refid="btmTypeTableName"/> where lower(id) = lower(#{btmTypeId,jdbcType=VARCHAR}) )
|
<if test="ids.size() > 0">
|
and
|
<foreach collection="ids" item="item" index="arrayindex" open=" lower(ID) in ( " close=")" >
|
lower(#{item,jdbcType=VARCHAR})
|
<if test="(arrayindex != ids.size() -1)">
|
,
|
</if>
|
</foreach>
|
</if>
|
</select>
|
<select id="selectByBtmTypeIds" resultType="com.vci.ubcs.omd.entity.BtmTypeAttribute">
|
select DISTINCT <include refid="base_query_column" />
|
from <include refid="tableName" />
|
where PKBTMTYPE IN (
|
select oid from <include refid="btmTypeTableName"/> 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>
|
)
|
order by id asc
|
</select>
|
|
</mapper>
|