171 lines
8.9 KiB
XML
171 lines
8.9 KiB
XML
<?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.muyu.etl.mapper.AssetModelMapper">
|
|
|
|
<resultMap type="com.muyu.etl.domain.AssetModel" id="AssetModelResult">
|
|
<result property="id" column="id" />
|
|
<result property="dataAssetId" column="data_asset_id" />
|
|
<result property="name" column="name" />
|
|
<result property="comment" column="comment" />
|
|
<result property="isPrimaryKey" column="is_primary_key" />
|
|
<result property="type" column="type" />
|
|
<result property="mappingType" column="mapping_type" />
|
|
<result property="length" column="length" />
|
|
<result property="decimalPlaces" column="decimal_places" />
|
|
<result property="isNull" column="is_null" />
|
|
<result property="isDict" column="is_dict" />
|
|
<result property="defaultValue" column="default_value" />
|
|
<result property="dictKey" column="dict_key" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAssetModelVo">
|
|
select id, data_asset_id, name, comment, is_primary_key, type, mapping_type, length, decimal_places, is_null, is_dict,default_value, dict_key, create_by, create_time, update_by, update_time, remark from asset_model
|
|
</sql>
|
|
|
|
<select id="selectAssetModelList" parameterType="com.muyu.etl.domain.AssetModel" resultMap="AssetModelResult">
|
|
<include refid="selectAssetModelVo"/>
|
|
<where>
|
|
<if test="dataAssetId != null "> and data_asset_id = #{dataAssetId}</if>
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
|
<if test="isPrimaryKey != null and isPrimaryKey != ''"> and is_primary_key = #{isPrimaryKey}</if>
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
<if test="mappingType != null and mappingType != ''"> and mapping_type = #{mappingType}</if>
|
|
<if test="length != null and length != ''"> and length = #{length}</if>
|
|
<if test="decimalPlaces != null and decimalPlaces != ''"> and decimal_places = #{decimalPlaces}</if>
|
|
<if test="isNull != null and isNull != ''"> and is_null = #{isNull}</if>
|
|
<if test="isDict != null and isDict != ''"> and is_dict = #{isDict}</if>
|
|
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
|
|
<if test="dictKey != null and dictKey != ''"> and dict_key = #{dictKey}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectAssetModelById" parameterType="Long" resultMap="AssetModelResult">
|
|
<include refid="selectAssetModelVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertAssetModel" parameterType="com.muyu.etl.domain.AssetModel" useGeneratedKeys="true" keyProperty="id">
|
|
insert into asset_model
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="dataAssetId != null">data_asset_id,</if>
|
|
<if test="name != null">name,</if>
|
|
<if test="comment != null">comment,</if>
|
|
<if test="isPrimaryKey != null">is_primary_key,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="mappingType != null">mapping_type,</if>
|
|
<if test="length != null">length,</if>
|
|
<if test="decimalPlaces != null">decimal_places,</if>
|
|
<if test="isNull != null">is_null,</if>
|
|
<if test="isDict != null">is_dict,</if>
|
|
<if test="defaultValue != null">default_value,</if>
|
|
<if test="dictKey != null">dict_key,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="dataAssetId != null">#{dataAssetId},</if>
|
|
<if test="name != null">#{name},</if>
|
|
<if test="comment != null">#{comment},</if>
|
|
<if test="isPrimaryKey != null">#{isPrimaryKey},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="mappingType != null">#{mappingType},</if>
|
|
<if test="length != null">#{length},</if>
|
|
<if test="decimalPlaces != null">#{decimalPlaces},</if>
|
|
<if test="isNull != null">#{isNull},</if>
|
|
<if test="isDict != null">#{isDict},</if>
|
|
<if test="defaultValue != null">#{defaultValue},</if>
|
|
<if test="dictKey != null">#{dictKey},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
<insert id="batchInsert" parameterType="com.muyu.etl.domain.AssetModel" >
|
|
insert into `asset_model`
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
`data_asset_id`,
|
|
`name`,
|
|
comment,
|
|
is_primary_key,
|
|
`type`,
|
|
mapping_type,
|
|
`length`,
|
|
decimal_places,
|
|
is_null,
|
|
is_dict,
|
|
default_value,
|
|
dict_key,
|
|
create_by,
|
|
create_time,
|
|
</trim>
|
|
values
|
|
<foreach collection="tableAssets" item="item" separator=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="item.dataAssetId != null">#{item.dataAssetId},</if>
|
|
<if test="item.name != null">#{item.name},</if>
|
|
<if test="item.comment != null">#{item.comment},</if>
|
|
<if test="item.isPrimaryKey != null">#{item.isPrimaryKey},</if>
|
|
<if test="item.type != null">#{item.type},</if>
|
|
<if test="item.mappingType != null">#{item.mappingType},</if>
|
|
<if test="item.length != null">#{item.length},</if>
|
|
<if test="item.decimalPlaces != null">#{item.decimalPlaces},</if>
|
|
<if test="item.isNull != null">#{item.isNull},</if>
|
|
<if test="item.isDict != null">#{item.isDict},</if>
|
|
<if test="item.defaultValue != null">#{item.defaultValue},</if>
|
|
<if test="item.dictKey != null">#{item.dictKey},</if>
|
|
<if test="item.createBy != null and item.createBy != ''">#{item.createBy},</if>
|
|
<if test="item.createTime != null">#{item.createTime},</if>
|
|
</trim>
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
<update id="updateAssetModel" parameterType="com.muyu.etl.domain.AssetModel">
|
|
update asset_model
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="dataAssetId != null">data_asset_id = #{dataAssetId},</if>
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="comment != null">comment = #{comment},</if>
|
|
<if test="isPrimaryKey != null">is_primary_key = #{isPrimaryKey},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="mappingType != null">mapping_type = #{mappingType},</if>
|
|
<if test="length != null">length = #{length},</if>
|
|
<if test="decimalPlaces != null">decimal_places = #{decimalPlaces},</if>
|
|
<if test="isNull != null">is_null = #{isNull},</if>
|
|
<if test="isDict != null">is_dict = #{isDict},</if>
|
|
<if test="defaultValue != null">default_value = #{defaultValue},</if>
|
|
<if test="dictKey != null">dict_key = #{dictKey},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteAssetModelById" parameterType="Long">
|
|
delete from asset_model where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAssetModelByIds" parameterType="String">
|
|
delete from asset_model where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|