数据资产后台实现 试验5 把sql语句添加完成

etl-xin
xiaohuang 2024-04-24 19:38:32 +08:00
parent a833b6eb9c
commit d7c5e05a4d
3 changed files with 136 additions and 13 deletions

View File

@ -3,6 +3,8 @@ package com.muyu.etl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.Structure; import com.muyu.etl.domain.Structure;
import java.util.List;
/** /**
* StructureMapper * StructureMapper
* *
@ -17,6 +19,12 @@ public interface StructureMapper extends BaseMapper<Structure> {
public Structure selectStructureById(Long id); public Structure selectStructureById(Long id);
/**
*
*/
public List<Structure> selectStructureList(Structure structure);
/** /**
* *
*/ */

View File

@ -4,8 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.etl.mapper.BasicConfigInfoMapper"> <mapper namespace="com.muyu.etl.mapper.BasicConfigInfoMapper">
<resultMap type="com.muyu.etl.domain.BasicConfigInfo" <resultMap type="com.muyu.etl.domain.BasicConfigInfo" id="BasicConfigInfoResult">
id="BasicConfigInfoResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="dataResourceName" column="data_resource_name" /> <result property="dataResourceName" column="data_resource_name" />
<result property="dataSourcesSystemName" column="data_sources_system_name" /> <result property="dataSourcesSystemName" column="data_sources_system_name" />
@ -22,19 +21,10 @@
</resultMap> </resultMap>
<sql id="selectBasicConfigInfoVo"> <sql id="selectBasicConfigInfoVo">
select id, data_resource_name,username,password, select id, data_resource_name,username,password, data_sources_system_name, host, port, database_type, database_name, init_link_num, max_link_num, max_wait_time, max_wait_times,connection_params, remark from basic_config_info
data_sources_system_name,
host, port, database_type,
database_name,
init_link_num,
max_link_num, max_wait_time,
max_wait_times,connection_params,
remark from basic_config_info
</sql> </sql>
<select id="selectBasicConfigInfoList" <select id="selectBasicConfigInfoList" parameterType="com.muyu.etl.domain.BasicConfigInfo" resultMap="BasicConfigInfoResult">
parameterType="com.muyu.etl.domain.BasicConfigInfo"
resultMap="BasicConfigInfoResult">
<include refid="selectBasicConfigInfoVo"/> <include refid="selectBasicConfigInfoVo"/>
<where> <where>
<if test="dataResourceName != null and dataResourceName != ''"> and data_resource_name like concat('%', #{dataResourceName}, '%')</if> <if test="dataResourceName != null and dataResourceName != ''"> and data_resource_name like concat('%', #{dataResourceName}, '%')</if>

View File

@ -2,5 +2,130 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.etl.mapper.StructureMapper"> <mapper namespace="com.muyu.etl.mapper.StructureMapper">
<resultMap type="com.muyu.etl.domain.Structure" id="StructureResult">
<result property="id" column="id" />
<result property="tableId" column="table_id" />
<result property="columnName" column="column_name" />
<result property="columnRemark" column="column_remark" />
<result property="isPrimary" column="is_primary" />
<result property="columnType" column="column_type" />
<result property="javaType" column="java_type" />
<result property="columnLength" column="column_length" />
<result property="columnDecimals" column="column_decimals" />
<result property="isNull" column="is_null" />
<result property="defaultValue" column="default_value" />
<result property="isDictionary" column="is_dictionary" />
<result property="dictionaryTable" column="dictionary_table" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectStructureVo">
select id, table_id, column_name, column_remark, is_primary, column_type, java_type, column_length, column_decimals, is_null, default_value, is_dictionary, dictionary_table, remark, create_by, create_time, update_by, update_time from structure
</sql>
<select id="selectStructureList"
parameterType="com.muyu.etl.domain.Structure" resultMap="StructureResult">
<include refid="selectStructureVo"/>
<where>
<if test="tableId != null "> and table_id = #{tableId}</if>
<if test="columnName != null and columnName != ''"> and column_name like concat('%', #{columnName}, '%')</if>
<if test="columnRemark != null and columnRemark != ''"> and column_remark = #{columnRemark}</if>
<if test="isPrimary != null and isPrimary != ''"> and is_primary = #{isPrimary}</if>
<if test="columnType != null and columnType != ''"> and column_type = #{columnType}</if>
<if test="javaType != null and javaType != ''"> and java_type = #{javaType}</if>
<if test="columnLength != null and columnLength != ''"> and column_length = #{columnLength}</if>
<if test="columnDecimals != null and columnDecimals != ''"> and column_decimals = #{columnDecimals}</if>
<if test="isNull != null and isNull != ''"> and is_null = #{isNull}</if>
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
<if test="isDictionary != null and isDictionary != ''"> and is_dictionary = #{isDictionary}</if>
<if test="dictionaryTable != null and dictionaryTable != ''"> and dictionary_table = #{dictionaryTable}</if>
</where>
</select>
<select id="selectStructureById" parameterType="Long" resultMap="StructureResult">
<include refid="selectStructureVo"/>
where id = #{id}
</select>
<insert id="insertStructure" parameterType="com.muyu.etl.domain.Structure" useGeneratedKeys="true" keyProperty="id">
insert into structure
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableId != null">table_id,</if>
<if test="columnName != null">column_name,</if>
<if test="columnRemark != null">column_remark,</if>
<if test="isPrimary != null and isPrimary != ''">is_primary,</if>
<if test="columnType != null and columnType != ''">column_type,</if>
<if test="javaType != null and javaType != ''">java_type,</if>
<if test="columnLength != null and columnLength != ''">column_length,</if>
<if test="columnDecimals != null and columnDecimals != ''">column_decimals,</if>
<if test="isNull != null">is_null,</if>
<if test="defaultValue != null and defaultValue != ''">default_value,</if>
<if test="isDictionary != null">is_dictionary,</if>
<if test="dictionaryTable != null">dictionary_table,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tableId != null">#{tableId},</if>
<if test="columnName != null">#{columnName},</if>
<if test="columnRemark != null">#{columnRemark},</if>
<if test="isPrimary != null and isPrimary != ''">#{isPrimary},</if>
<if test="columnType != null and columnType != ''">#{columnType},</if>
<if test="javaType != null and javaType != ''">#{javaType},</if>
<if test="columnLength != null and columnLength != ''">#{columnLength},</if>
<if test="columnDecimals != null and columnDecimals != ''">#{columnDecimals},</if>
<if test="isNull != null">#{isNull},</if>
<if test="defaultValue != null and defaultValue != ''">#{defaultValue},</if>
<if test="isDictionary != null">#{isDictionary},</if>
<if test="dictionaryTable != null">#{dictionaryTable},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateStructure" parameterType="com.muyu.etl.domain.Structure">
update structure
<trim prefix="SET" suffixOverrides=",">
<if test="tableId != null">table_id = #{tableId},</if>
<if test="columnName != null">column_name = #{columnName},</if>
<if test="columnRemark != null">column_remark = #{columnRemark},</if>
<if test="isPrimary != null and isPrimary != ''">is_primary = #{isPrimary},</if>
<if test="columnType != null and columnType != ''">column_type = #{columnType},</if>
<if test="javaType != null and javaType != ''">java_type = #{javaType},</if>
<if test="columnLength != null and columnLength != ''">column_length = #{columnLength},</if>
<if test="columnDecimals != null and columnDecimals != ''">column_decimals = #{columnDecimals},</if>
<if test="isNull != null">is_null = #{isNull},</if>
<if test="defaultValue != null and defaultValue != ''">default_value = #{defaultValue},</if>
<if test="isDictionary != null">is_dictionary = #{isDictionary},</if>
<if test="dictionaryTable != null">dictionary_table = #{dictionaryTable},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">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>
</trim>
where id = #{id}
</update>
<delete id="deleteStructureById" parameterType="Long">
delete from structure where id = #{id}
</delete>
<delete id="deleteStructureByIds" parameterType="String">
delete from structure where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper> </mapper>