init
This commit is contained in:
26
visual/custom-query/src/main/resources/bootstrap-dev.yml
Normal file
26
visual/custom-query/src/main/resources/bootstrap-dev.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.7.127.189:38848
|
||||
namespace: clay
|
||||
dubbo:
|
||||
registry:
|
||||
parameters:
|
||||
namespace: dubbo-clay
|
||||
code:
|
||||
java:
|
||||
class-path: E:\home\clay\code\
|
||||
seata:
|
||||
service:
|
||||
grouplist:
|
||||
seata-server: 192.168.31.102:8091
|
||||
registry:
|
||||
nacos:
|
||||
namespace: clay
|
||||
config:
|
||||
apollo:
|
||||
namespace: clay
|
||||
|
||||
22
visual/custom-query/src/main/resources/bootstrap-pro.yml
Normal file
22
visual/custom-query/src/main/resources/bootstrap-pro.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos.fateverse.svc.cluster.local:8848
|
||||
code:
|
||||
java:
|
||||
class-path: /home/clay/code/
|
||||
|
||||
|
||||
seata:
|
||||
service:
|
||||
grouplist:
|
||||
seata-server: seataio.fateverse.svc.cluster.local:8091
|
||||
registry:
|
||||
nacos:
|
||||
namespace: pro
|
||||
config:
|
||||
apollo:
|
||||
namespace: seata-pro
|
||||
77
visual/custom-query/src/main/resources/bootstrap.yml
Normal file
77
visual/custom-query/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,77 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 5005
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: custom-query
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 162.14.111.170:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
namespace: ${spring.profiles.active}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
namespace: ${spring.profiles.active}
|
||||
shared-configs:
|
||||
- data-id: application-${spring.profiles.active}.yaml
|
||||
refresh: true
|
||||
# alibaba:
|
||||
# seata:
|
||||
# application-id: default_tx_group
|
||||
|
||||
encrypt:
|
||||
secretKey: 1234567890abcdef
|
||||
|
||||
dubbo:
|
||||
application:
|
||||
name: dubbo-${spring.application.name}
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
parameters:
|
||||
namespace: dubbo-${spring.profiles.active}
|
||||
|
||||
seata:
|
||||
application-id: ${spring.application.name}
|
||||
tx-service-group: default_tx_group
|
||||
service:
|
||||
grouplist:
|
||||
seata-server: 10.7.127.185:8091
|
||||
registry:
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
group: SEATA_GROUP
|
||||
namespace: dev
|
||||
config:
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
group: SEATA_GROUP
|
||||
namespace: seata-config
|
||||
client:
|
||||
undo:
|
||||
log-serialization: kryo
|
||||
data-validation: true
|
||||
rm:
|
||||
report-retry-count: 5
|
||||
table-meta-check-enable: false
|
||||
@@ -0,0 +1,93 @@
|
||||
<?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="cn.fateverse.query.mapper.DataAdapterMapper">
|
||||
|
||||
<resultMap id="DataAdapterResult" type="cn.fateverse.query.entity.DataAdapter">
|
||||
<id column="adapter_id" property="adapterId"/>
|
||||
<result column="adapter_name" property="adapterName"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="code" property="code"/>
|
||||
<result column="source" property="source"/>
|
||||
<result column="mock_data" property="mockData"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDataAdapterVo">
|
||||
select adapter_id, data_source_id, adapter_name, `type`, code, `source`, mock_data, create_by, create_time, update_by, update_time
|
||||
from data_adapter
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectList" resultMap="DataAdapterResult">
|
||||
<include refid="selectDataAdapterVo"/>
|
||||
<where>
|
||||
<if test="adapterName != null and adapterName != ''"> and adapter_name like concat('%', #{adapterName}, '%')</if>
|
||||
<if test="type != null"> and `type` = #{type}</if>
|
||||
<if test="source != null "> and `source` = #{source}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="DataAdapterResult">
|
||||
<include refid="selectDataAdapterVo"/>
|
||||
where adapter_id = #{adapterId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" >
|
||||
insert into data_adapter
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">data_source_id,</if>
|
||||
<if test="adapterName != null">adapter_name,</if>
|
||||
<if test="type != null">`type`,</if>
|
||||
<if test="code != null">code,</if>
|
||||
<if test="source != null">`source`,</if>
|
||||
<if test="mockData != null">mock_data,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">#{dataSourceId},</if>
|
||||
<if test="adapterName != null">#{adapterName},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="source != null">#{source},</if>
|
||||
<if test="mockData != null">#{mockData},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update data_adapter
|
||||
<set>
|
||||
<if test="dataSourceId != null">data_source_id = #{dataSourceId},</if>
|
||||
<if test="adapterName != null">adapter_name = #{adapterName},</if>
|
||||
<if test="type != null">`type` = #{type},</if>
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="source != null">`source` = #{source},</if>
|
||||
<if test="mockData != null">mock_data = #{mockData},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where adapter_id = #{adapterId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from data_adapter
|
||||
where adapter_id = #{adapterId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatchByIdList" parameterType="Long">
|
||||
delete from data_adapter
|
||||
where adapter_id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="adapterId">
|
||||
#{adapterId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,112 @@
|
||||
<?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="cn.fateverse.query.mapper.DataSourceManageMapper">
|
||||
|
||||
<resultMap id="QueryDataSourceResult" type="cn.fateverse.query.entity.DataSourceManage">
|
||||
<id column="id" property="id"/>
|
||||
<result column="ds_name" property="dsName"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="host" property="host"/>
|
||||
<result column="port" property="port"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="db_name" property="dbName"/>
|
||||
<result column="config_type" property="configType"/>
|
||||
<result column="url" property="url"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectQueryDataSourceVo">
|
||||
select id, ds_name, username, `password`, `host`, `port`, args, params, type, db_name, config_type, url, remark, create_by, create_time, update_by, update_time from data_source_manage
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectList" resultMap="QueryDataSourceResult">
|
||||
<include refid="selectQueryDataSourceVo"/>
|
||||
<where>
|
||||
<if test="dsName != null and dsName != ''"> and ds_name like concat('%', #{dsName}, '%')</if>
|
||||
<if test="dbName != null and dbName != ''"> and db_name like concat('%', #{dbName}, '%')</if>
|
||||
<if test="configType != null "> and config_type = #{configType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="QueryDataSourceResult">
|
||||
<include refid="selectQueryDataSourceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insert" >
|
||||
insert into data_source_manage
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dsName != null">ds_name,</if>
|
||||
<if test="username != null">username,</if>
|
||||
<if test="password != null">`password`,</if>
|
||||
<if test="host != null">`host`,</if>
|
||||
<if test="port != null">`port`,</if>
|
||||
<if test="args != null and args != ''">args,</if>
|
||||
<if test="params != null and params != ''">params,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="dbName != null">db_name,</if>
|
||||
<if test="configType != null">config_type,</if>
|
||||
<if test="url != null">url,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dsName != null">#{dsName},</if>
|
||||
<if test="username != null">#{username},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="host != null">#{host},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="args != null and args != ''">#{args},</if>
|
||||
<if test="params != null and params != ''">#{params},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="dbName != null">#{dbName},</if>
|
||||
<if test="configType != null">#{configType},</if>
|
||||
<if test="url != null">#{url},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update data_source_manage
|
||||
<set>
|
||||
<if test="dsName != null">ds_name = #{dsName},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="password != null">`password` = #{password},</if>
|
||||
<if test="host != null">`host` = #{host},</if>
|
||||
<if test="port != null">`port` = #{port},</if>
|
||||
<if test="args != null and args != ''">args = #{args},</if>
|
||||
<if test="params != null and params != ''">params = #{params},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="dbName != null">db_name = #{dbName},</if>
|
||||
<if test="configType != null">config_type = #{configType},</if>
|
||||
<if test="url != null">url = #{url},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from data_source_manage
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatchByIdList" parameterType="Long">
|
||||
delete from data_source_manage
|
||||
where id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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="cn.fateverse.query.mapper.DynamicEchartsMapper">
|
||||
|
||||
<resultMap id="DynamicEchartsResult" type="cn.fateverse.query.entity.DynamicEcharts">
|
||||
<id column="echarts_id" property="echartsId"/>
|
||||
<result column="adapter_id" property="adapterId"/>
|
||||
<result column="echarts_name" property="echartsName"/>
|
||||
<result column="echarts_config" property="echartsConfig"/>
|
||||
<result column="publish" property="publish"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDynamicEchartsVo">
|
||||
select echarts_id, adapter_id, echarts_name, echarts_config, publish, remark, create_by, create_time, update_by, update_time from dynamic_echarts
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectList" resultMap="DynamicEchartsResult">
|
||||
<include refid="selectDynamicEchartsVo"/>
|
||||
<where>
|
||||
<if test="echartsName != null and echartsName != ''"> and echarts_name like concat('%', #{echartsName}, '%')</if>
|
||||
<if test="publish != null "> and publish = #{publish}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="DynamicEchartsResult">
|
||||
<include refid="selectDynamicEchartsVo"/>
|
||||
where echarts_id = #{echartsId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" >
|
||||
insert into dynamic_echarts
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="adapterId != null">adapter_id,</if>
|
||||
<if test="echartsName != null">echarts_name,</if>
|
||||
<if test="echartsConfig != null">echarts_config,</if>
|
||||
<if test="publish != null">publish,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="adapterId != null">#{adapterId},</if>
|
||||
<if test="echartsName != null">#{echartsName},</if>
|
||||
<if test="echartsConfig != null">#{echartsConfig},</if>
|
||||
<if test="publish != null">#{publish},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update dynamic_echarts
|
||||
<set>
|
||||
<if test="adapterId != null">adapter_id = #{adapterId},</if>
|
||||
<if test="echartsName != null">echarts_name = #{echartsName},</if>
|
||||
<if test="echartsConfig != null">echarts_config = #{echartsConfig},</if>
|
||||
<if test="publish != null">publish = #{publish},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where echarts_id = #{echartsId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from dynamic_echarts
|
||||
where echarts_id = #{echartsId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatchByIdList" parameterType="Long">
|
||||
delete from dynamic_echarts
|
||||
where echarts_id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="echartsId">
|
||||
#{echartsId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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="cn.fateverse.query.mapper.TableColumnMapper">
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into query_table_column (table_id, column_name, column_comment, column_type, pk, `use`, sort, create_by, create_time) VALUES
|
||||
<foreach collection="list" separator="," item="item">
|
||||
(
|
||||
#{item.tableId},
|
||||
#{item.columnName},
|
||||
#{item.columnComment},
|
||||
#{item.columnType},
|
||||
#{item.pk},
|
||||
#{item.use},
|
||||
#{item.sort},
|
||||
#{item.createBy},
|
||||
#{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate">
|
||||
update query_table_column
|
||||
<set>
|
||||
<trim prefix="column_comment = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.columnComment != null">
|
||||
when column_id = #{item.columnId} then #{item.columnComment}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`use` = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.use != null">
|
||||
when column_id = #{item.columnId} then #{item.use}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</set>
|
||||
where column_id in
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.columnId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<update id="syncUpdate">
|
||||
update query_table_column
|
||||
<set>
|
||||
<trim prefix="column_comment = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.columnComment != null">
|
||||
when column_id = #{item.columnId} then #{item.columnComment}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="column_type = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.columnType != null">
|
||||
when column_id = #{item.columnId} then #{item.columnType}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pk = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.pk != null">
|
||||
when column_id = #{item.columnId} then #{item.pk}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</set>
|
||||
where column_id in
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.columnId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from query_table_column where column_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
<delete id="deleteByTableId">
|
||||
delete from query_table_column where table_id = #{tableId}
|
||||
</delete>
|
||||
<select id="selectByTableId" resultType="cn.fateverse.query.entity.TableColumn">
|
||||
select column_id, table_id, column_name, column_comment, column_type, pk, `use`, sort, create_by, create_time, update_by, update_time
|
||||
from query_table_column where table_id = #{tableId}
|
||||
</select>
|
||||
|
||||
<select id="selectByTableIds" resultType="cn.fateverse.query.entity.TableColumn">
|
||||
select column_id, table_id, column_name, column_comment, column_type, pk, `use`, sort, create_by, create_time, update_by, update_time
|
||||
from query_table_column where `use` = 1
|
||||
and table_id in
|
||||
<foreach collection="list" item="tableId" open="(" separator="," close=")">
|
||||
#{tableId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
106
visual/custom-query/src/main/resources/mapper/TableMapper.xml
Normal file
106
visual/custom-query/src/main/resources/mapper/TableMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?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="cn.fateverse.query.mapper.TableMapper">
|
||||
|
||||
<sql id="tableSql">
|
||||
select table_id, data_source_id, data_source_type, table_name, table_comment, create_by, create_time, update_by, update_time
|
||||
from query_table
|
||||
</sql>
|
||||
|
||||
<select id="selectById" resultType="cn.fateverse.query.entity.Table">
|
||||
<include refid="tableSql"/>
|
||||
where table_id = #{tableId}
|
||||
</select>
|
||||
|
||||
<select id="selectTableNameByDataSourceId" resultType="java.lang.String">
|
||||
select table_name
|
||||
from query_table
|
||||
where data_source_id = #{dataSourceId}
|
||||
</select>
|
||||
|
||||
<select id="selectListByDataSourceId" resultType="cn.fateverse.query.entity.Table">
|
||||
<include refid="tableSql"/>
|
||||
where data_source_id = #{dataSourceId}
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultType="cn.fateverse.query.entity.Table">
|
||||
<include refid="tableSql"/>
|
||||
<where>
|
||||
<if test="dataSourceId != null ">
|
||||
and data_source_id = #{dataSourceId}
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
and lower(`table_name`) like lower(concat('%', #{tableName}, '%'))
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
and lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||
</if>
|
||||
<if test="dataSourceType != null">
|
||||
and data_source_type = #{dataSourceType}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and create_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCountByDataSourceIds" resultType="cn.fateverse.query.entity.DataSourceManageCount">
|
||||
SELECT dsm.id as data_source_id,COUNT(*) as count, dsm.ds_name as data_source_name
|
||||
FROM query_table qt
|
||||
LEFT JOIN data_source_manage dsm on qt.data_source_id = dsm.id
|
||||
where dsm.id in
|
||||
<foreach collection="list" item="dataSourceId" open="(" separator="," close=")">
|
||||
#{dataSourceId}
|
||||
</foreach>
|
||||
GROUP BY dsm.id
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="tableId" keyColumn="table_id">
|
||||
insert into query_table
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tableName != null">table_name,</if>
|
||||
<if test="dataSourceId != null">data_source_id,</if>
|
||||
<if test="dataSourceType != null ">data_source_type,</if>
|
||||
<if test="tableComment != null and tableComment != ''">table_comment,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="tableName != null">#{tableName},</if>
|
||||
<if test="dataSourceId != null">#{dataSourceId},</if>
|
||||
<if test="dataSourceType != null ">#{dataSourceType},</if>
|
||||
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update query_table
|
||||
<set>
|
||||
<if test="tableName != null and tableName != ''">table_name = #{tableName},</if>
|
||||
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where table_id = #{tableId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from query_table where table_id = #{tableId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
delete from query_table where table_id in
|
||||
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
||||
#{tableId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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="cn.fateverse.query.mapper.TableRelationalMappingMapper">
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into table_relational_mapping (main_id, child_id, main_key, child_key, type) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.mainId},#{item.childId},#{item.mainKey},#{item.childKey},#{item.type})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectByMainId"
|
||||
resultType="cn.fateverse.query.entity.TableRelationalMapping">
|
||||
select main_id, child_id, main_key, child_key, type
|
||||
from table_relational_mapping where main_id = #{mainId}
|
||||
</select>
|
||||
|
||||
<select id="selectByMainIds" resultType="cn.fateverse.query.entity.TableRelationalMapping">
|
||||
select main_id, child_id, main_key, child_key, type from table_relational_mapping
|
||||
where main_id in
|
||||
<foreach collection="list" open="(" separator="," close=")" item="mainId">
|
||||
#{mainId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByMainId">
|
||||
delete from table_relational_mapping where main_id = #{mainId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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="cn.fateverse.query.mapper.TableRoleMapper">
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into table_role (table_id, role_id) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.tableId},#{item.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectByTableId" resultType="cn.fateverse.query.entity.TableRole">
|
||||
select table_id, role_id from table_role where table_id = #{tableId}
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteByTableId">
|
||||
delete from table_role where table_id = #{tableId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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="cn.fateverse.query.mapper.UniColumnMapper">
|
||||
|
||||
<select id="selectByQueryId" resultType="cn.fateverse.query.entity.UniColumn">
|
||||
select id, query_id, prop, label, display_type, display_param, sort
|
||||
from uni_column
|
||||
where query_id = #{queryId}
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert">
|
||||
insert into uni_column (query_id, prop, label, display_type, display_param, sort) values
|
||||
<foreach collection="list" separator="," item="column">
|
||||
(#{column.queryId},#{column.prop},#{column.label},#{column.displayType},#{column.displayParam},#{column.sort})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate">
|
||||
update uni_con
|
||||
<set>
|
||||
<trim prefix="prop = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.prop != null">
|
||||
when column_id = #{item.columnId} then #{item.prop}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="label = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.label != null">
|
||||
when column_id = #{item.columnId} then #{item.label}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="display_type = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.displayType != null">
|
||||
when column_id = #{item.columnId} then #{item.displayType}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="display_param = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.displayParam != null">
|
||||
when column_id = #{item.columnId} then #{item.displayParam}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="sort = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.dictType != null">
|
||||
when column_id = #{item.columnId} then #{column.sort}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</set>
|
||||
where id in
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="batchDeleteByQueryId">
|
||||
delete from uni_column where query_id = #{queryId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from uni_column where id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
115
visual/custom-query/src/main/resources/mapper/UniConMapper.xml
Normal file
115
visual/custom-query/src/main/resources/mapper/UniConMapper.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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="cn.fateverse.query.mapper.UniConMapper">
|
||||
<sql id="selectSql">
|
||||
select uc_id,
|
||||
uq_id,
|
||||
uc_name,
|
||||
uc_key,
|
||||
uc_con,
|
||||
uc_mock,
|
||||
uc_describe,
|
||||
uc_type,
|
||||
type,
|
||||
sort
|
||||
from uni_con
|
||||
</sql>
|
||||
|
||||
<select id="selectByQueryId" resultType="cn.fateverse.query.entity.UniCon">
|
||||
<include refid="selectSql"/>
|
||||
where uq_id = #{queryId}
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="selectByQueryIdAndUcIdList" resultType="cn.fateverse.query.entity.UniCon">
|
||||
<include refid="selectSql"/>
|
||||
where uq_id = #{queryId}
|
||||
and uc_id in
|
||||
<foreach collection="list" item="ucId" open="(" separator="," close=")">
|
||||
#{ucId}
|
||||
</foreach>
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="ucId" keyColumn="uc_id">
|
||||
insert into uni_con (uq_id, uc_name, uc_key, uc_con, uc_mock, uc_describe, uc_type, type) VALUES
|
||||
<foreach collection="list" separator="," item="con">
|
||||
(#{con.uqId}, #{con.ucName}, #{con.ucKey}, #{con.ucCon}, #{con.ucMock}, #{con.ucDescribe}, #{con.ucType}, #{con.type} )
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate">
|
||||
update uni_con
|
||||
<set>
|
||||
<trim prefix="uc_name = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.ucName != null">
|
||||
when column_id = #{item.columnId} then #{item.ucName}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="uc_key = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.ucKey != null">
|
||||
when column_id = #{item.columnId} then #{item.ucKey}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="uc_con = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.ucCon != null">
|
||||
when column_id = #{item.columnId} then #{item.ucCon}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="uc_mock = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.ucMock != null">
|
||||
when column_id = #{item.columnId} then #{item.ucMock}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="uc_describe = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.ucDescribe != null">
|
||||
when column_id = #{item.columnId} then #{item.ucDescribe}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="uc_type = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.ucType != null">
|
||||
when column_id = #{item.columnId} then #{item.ucType}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="type = case" suffix="end,">
|
||||
<foreach collection="list" separator=" " item="item">
|
||||
<if test="item.type != null">
|
||||
when column_id = #{item.columnId} then #{item.type}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</set>
|
||||
where uc_id in
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.ucId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="batchDelete">
|
||||
delete from uni_con where uq_id = #{queryId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchRemove">
|
||||
delete from uni_con where uq_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
115
visual/custom-query/src/main/resources/mapper/UniQueryMapper.xml
Normal file
115
visual/custom-query/src/main/resources/mapper/UniQueryMapper.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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="cn.fateverse.query.mapper.UniQueryMapper">
|
||||
|
||||
<resultMap id="UniQueryResult" type="cn.fateverse.query.entity.UniQuery">
|
||||
<id column="id" property="id"/>
|
||||
<result column="data_source_id" property="dataSourceId"/>
|
||||
<result column="menu_id" property="menuId"/>
|
||||
<result column="uq_name" property="uqName"/>
|
||||
<result column="uq_sql" property="uqSql"/>
|
||||
<result column="uq_describe" property="uqDescribe"/>
|
||||
<result column="publish" property="publish"/>
|
||||
<result column="preview" property="preview"/>
|
||||
<result column="top_json" property="topJson"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUniQueryVo">
|
||||
select id, data_source_id, menu_id, uq_name, select_key, table_info, relevance, uq_sql, uq_describe, publish, single, preview, type, create_by, create_time, update_by, update_time
|
||||
from uni_query
|
||||
</sql>
|
||||
|
||||
<sql id="selectUniQueryDetailsVo">
|
||||
select id, data_source_id, menu_id, uq_name, select_key, table_info, relevance, uq_sql, uq_describe, publish, single, preview, top_json, type, create_by, create_time, update_by, update_time
|
||||
from uni_query
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultMap="UniQueryResult">
|
||||
<include refid="selectUniQueryVo"/>
|
||||
<where>
|
||||
<if test="uqName != null and uqName != ''">and uq_name like concat('%', #{uqName}, '%')</if>
|
||||
<if test="publish != null ">and publish = #{publish}</if>
|
||||
<if test="preview != null ">and preview = #{preview}</if>
|
||||
<if test="dataSourceId != null ">and data_source_id = #{dataSourceId}</if>
|
||||
<if test="type != null ">and type = #{type}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="UniQueryResult">
|
||||
<include refid="selectUniQueryDetailsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectSampleById" resultType="cn.fateverse.query.entity.UniQuery">
|
||||
<include refid="selectUniQueryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
insert into uni_query
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">data_source_id,</if>
|
||||
<if test="uqName != null">uq_name,</if>
|
||||
<if test="uqDescribe != null">uq_describe,</if>
|
||||
<if test="publish != null">publish,</if>
|
||||
<if test="single != null">single,</if>
|
||||
<if test="preview != null">preview,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceId != null">#{dataSourceId},</if>
|
||||
<if test="uqName != null">#{uqName},</if>
|
||||
<if test="uqDescribe != null">#{uqDescribe},</if>
|
||||
<if test="publish != null">#{publish},</if>
|
||||
<if test="single != null">#{single},</if>
|
||||
<if test="preview != null">#{preview},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update uni_query
|
||||
<set>
|
||||
<if test="menuId != null">menu_id = #{menuId},</if>
|
||||
<if test="uqName != null">uq_name = #{uqName},</if>
|
||||
<if test="uqSql != null">uq_sql = #{uqSql},</if>
|
||||
<if test="uqDescribe != null">uq_describe = #{uqDescribe},</if>
|
||||
<if test="selectKey != null">select_key = #{selectKey},</if>
|
||||
<if test="tableInfo != null">table_info = #{tableInfo},</if>
|
||||
<if test="relevance != null">relevance = #{relevance},</if>
|
||||
<if test="publish != null">publish = #{publish},</if>
|
||||
<if test="single != null">single = #{single},</if>
|
||||
<if test="preview != null">preview = #{preview},</if>
|
||||
<if test="topJson != null">top_json = #{topJson},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from uni_query
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatchByIdList" parameterType="Long">
|
||||
delete from uni_query
|
||||
where id in
|
||||
<foreach collection="list" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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="cn.fateverse.query.mapper.DynamicDataSourceMapper">
|
||||
|
||||
<resultMap type="cn.fateverse.query.entity.Table" id="TableResult">
|
||||
<result property="tableName" column="table_name" />
|
||||
<result property="tableComment" column="table_comment" />
|
||||
<result property="dataSourceType" column="data_source_type" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="cn.fateverse.query.entity.DynamicTable" id="DynamicTableResult">
|
||||
<result property="tableName" column="table_name" />
|
||||
<result property="tableComment" column="table_comment" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="cn.fateverse.query.entity.TableColumn" id="TableColumnResult">
|
||||
<id property="columnId" column="column_id" />
|
||||
<result property="tableId" column="table_id" />
|
||||
<result property="columnName" column="column_name" />
|
||||
<result property="columnComment" column="column_comment" />
|
||||
<result property="columnType" column="column_type" />
|
||||
<result property="pk" column="pk" />
|
||||
<result property="sort" column="sort" />
|
||||
<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>
|
||||
</mapper>
|
||||
@@ -0,0 +1,148 @@
|
||||
<?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="cn.fateverse.query.mapper.dynamic.MariaDynamicDataSourceMapper">
|
||||
|
||||
<sql id="uniQueryWhere">
|
||||
<where>
|
||||
1 = 1
|
||||
<foreach collection="select.uniCons" item="uniCon">
|
||||
<if test="uniCon.ucMock != null and uniCon.ucMock != '' and uniCon.ucType == 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat('%', #{uniCon.ucMock}, '%')</if>
|
||||
</if>
|
||||
<if test="uniCon.ucMock != null and uniCon.ucType != 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat('%', #{uniCon.ucMock}, '%')</if>
|
||||
<if test="uniCon.ucCon == 'BETWEEN'">and ${uniCon.ucKey} between #{uniCon.begin} and #{uniCon.end}
|
||||
</if>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="checkSource" resultType="java.lang.Integer">
|
||||
select 1
|
||||
from dual
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<include refid="uniQueryWhere"/>
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(0) from ${select.tableInfo}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<include refid="uniQueryWhere"/>
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(1) from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="uniQuerySql" resultType="java.util.Map">
|
||||
${select.selectSql}
|
||||
<include refid="uniQueryWhere"/>
|
||||
<if test="page != null">
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="uniQuerySqlCount" resultType="java.lang.Long">
|
||||
${select.selectSql}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectTableList" resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.DynamicTableResult">
|
||||
select table_name, table_comment, create_time, update_time
|
||||
from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and table_name like concat('%', #{query.tableName}, '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and table_comment like concat('%', #{table.tableComment}, '%')
|
||||
</if>
|
||||
<if test="table.startTime != null and table.endTime != null"><!-- 开始时间检索 -->
|
||||
and create_time between #{table.startTime} and #{table.endTime}
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="selectTableListCount" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and table_name like concat('%', #{table.tableName}, '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and table_comment like concat('%', #{table.tableComment}, '%')
|
||||
</if>
|
||||
<if test="table.startTime != null and table.endTime != null"><!-- 开始时间检索 -->
|
||||
and create_time between #{table.startTime} and #{table.endTime}
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableListByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableResult">
|
||||
select table_name, table_comment, create_time, update_time, 'MYSQL' as data_source_type
|
||||
from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
and table_name in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableColumnsByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableColumnResult">
|
||||
select table_name as remark, column_name, (case when column_key = 'PRI' then 1 else 0 end) as pk,
|
||||
ordinal_position as sort, column_comment, column_type
|
||||
from information_schema.columns
|
||||
where table_schema = (select database()) and table_name in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
order by ordinal_position
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?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="cn.fateverse.query.mapper.dynamic.MySqlDynamicDataSourceMapper">
|
||||
|
||||
<sql id="uniQueryWhere">
|
||||
<where>
|
||||
1 = 1
|
||||
<foreach collection="select.uniCons" item="uniCon">
|
||||
<if test="uniCon.ucMock != null and uniCon.ucMock != '' and uniCon.ucType == 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat('%', #{uniCon.ucMock}, '%')</if>
|
||||
</if>
|
||||
<if test="uniCon.ucMock != null and uniCon.ucType != 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat('%', #{uniCon.ucMock}, '%')</if>
|
||||
<if test="uniCon.ucCon == 'BETWEEN'">and ${uniCon.ucKey} between #{uniCon.begin} and #{uniCon.end}
|
||||
</if>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="checkSource" resultType="java.lang.Integer">
|
||||
select 1 from dual
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<include refid="uniQueryWhere"/>
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(0) from ${select.tableInfo}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<include refid="uniQueryWhere"/>
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(1) from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="uniQuerySql" resultType="java.util.Map">
|
||||
${select.selectSql}
|
||||
<include refid="uniQueryWhere"/>
|
||||
<if test="page != null">
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="uniQuerySqlCount" resultType="java.lang.Long">
|
||||
${select.selectSql}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectTableList" resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.DynamicTableResult">
|
||||
select table_name, table_comment, create_time, update_time
|
||||
from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and table_name like concat('%', #{query.tableName}, '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and table_comment like concat('%', #{table.tableComment}, '%')
|
||||
</if>
|
||||
<if test="table.startTime != null and table.endTime != null"><!-- 开始时间检索 -->
|
||||
and create_time between #{table.startTime} and #{table.endTime}
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
limit #{page.startNum},#{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="selectTableListCount" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and table_name like concat('%', #{table.tableName}, '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and table_comment like concat('%', #{table.tableComment}, '%')
|
||||
</if>
|
||||
<if test="table.startTime != null and table.endTime != null"><!-- 开始时间检索 -->
|
||||
and create_time between #{table.startTime} and #{table.endTime}
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableListByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableResult">
|
||||
select table_name, table_comment, create_time, update_time, 'MYSQL' as data_source_type
|
||||
from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
and table_name in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableColumnsByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableColumnResult">
|
||||
select table_name as remark, column_name, (case when column_key = 'PRI' then 1 else 0 end) as pk,
|
||||
ordinal_position as sort, column_comment, column_type
|
||||
from information_schema.columns
|
||||
where table_schema = (select database()) and table_name in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
order by ordinal_position
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,156 @@
|
||||
<?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="cn.fateverse.query.mapper.dynamic.OracleDynamicDataSourceMapper">
|
||||
|
||||
<sql id="uniQueryWhere">
|
||||
<foreach collection="select.uniCons" item="uniCon">
|
||||
<if test="uniCon.ucMock != null and uniCon.ucMock != '' and uniCon.ucType == 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat(concat('%', #{uniCon.ucMock}),
|
||||
'%')
|
||||
</if>
|
||||
</if>
|
||||
<if test="uniCon.ucMock != null and uniCon.ucType != 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat(concat('%', #{uniCon.ucMock}),
|
||||
'%')
|
||||
</if>
|
||||
<if test="uniCon.ucCon == 'BETWEEN'">and ${uniCon.ucKey} between #{uniCon.begin} and #{uniCon.end}
|
||||
</if>
|
||||
</if>
|
||||
</foreach>
|
||||
</sql>
|
||||
|
||||
<select id="checkSource" resultType="java.lang.Integer">
|
||||
select 1 from dual
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<where>
|
||||
rownum between #{page.startNum} and #{page.endNum}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(1) from ${select.tableInfo}
|
||||
<where>
|
||||
<include refid="uniQueryWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="uniMultiListQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<where>
|
||||
rownum between #{page.startNum} and #{page.endNum}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(1) from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<where>
|
||||
<include refid="uniQueryWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTableList" resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.DynamicTableResult">
|
||||
select ut.table_name,utc.comments as table_comment,ut.last_analyzed as update_time
|
||||
from user_tables ut
|
||||
left join user_tab_comments utc on ut.table_name = utc.table_name
|
||||
<where>
|
||||
rownum between #{page.startNum} and #{page.endNum}
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and ut.table_name like concat(concat('%', #{table.tableName}), '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and utc.comments like concat(concat('%', #{table.tableComment}, '%'))
|
||||
</if>
|
||||
<if test="table.startTime != null and table.endTime != null"><!-- 开始时间检索 -->
|
||||
and update_time between #{table.startTime} and #{table.endTime}
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and ut.table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTableListCount" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from user_tables ut
|
||||
left join user_tab_comments utc on ut.table_name = utc.table_name
|
||||
<where>
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and ut.table_name like concat(concat('%', #{table.tableName}), '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and utc.comments) like concat(concat('%', #{table.tableComment}), '%')
|
||||
</if>
|
||||
<if test="table.startTime != null and table.endTime != null"><!-- 开始时间检索 -->
|
||||
and update_time between #{table.startTime} and #{table.endTime}
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and ut.table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableListByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableResult">
|
||||
select ut.table_name,utc.comments as table_comment,ut.last_analyzed as update_time,'ORACLE' as data_source_type
|
||||
from user_tables ut
|
||||
left join user_tab_comments utc on ut.table_name = utc.table_name
|
||||
where ut.table_name in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableColumnsByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableColumnResult">
|
||||
select distinct utc.column_name,
|
||||
utc.table_name as remark,
|
||||
CONCAT(CONCAT(CONCAT(lower(utc.data_type),'('), utc.data_length),')') as column_type,
|
||||
utc.data_scale as column_scale,
|
||||
utc.column_id as sort,
|
||||
(case when uc.constraint_type = 'P' then '1' else '0' end) as pk ,
|
||||
ucc.comments as column_comment
|
||||
from user_tab_columns utc
|
||||
inner join user_col_comments ucc on ucc.column_name = utc.column_name and ucc.table_name = utc.table_name
|
||||
left join user_cons_columns uccs on uccs.column_name = utc.column_name
|
||||
left join user_constraints uc on uc.constraint_name = uccs.constraint_name
|
||||
where uc.search_condition is null
|
||||
and utc.table_name in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
order by utc.column_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?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="cn.fateverse.query.mapper.dynamic.PostgresDynamicDataSourceMapper">
|
||||
|
||||
|
||||
<sql id="uniQueryWhere">
|
||||
<where>
|
||||
1 = 1
|
||||
<foreach collection="select.uniCons" item="uniCon">
|
||||
<if test="uniCon.ucMock != null and uniCon.ucMock != '' and uniCon.ucType == 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat('%', #{uniCon.ucMock}, '%')</if>
|
||||
</if>
|
||||
<if test="uniCon.ucMock != null and uniCon.ucType != 'input'">
|
||||
<if test="uniCon.ucCon == 'EQ'">and ${uniCon.ucKey} = #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'NE'">and ${uniCon.ucKey} != #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GT'">and ${uniCon.ucKey} > #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'GTE'">and ${uniCon.ucKey} >= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LT'">and ${uniCon.ucKey} < #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LTE'">and ${uniCon.ucKey} <= #{uniCon.ucMock}</if>
|
||||
<if test="uniCon.ucCon == 'LIKE'">and ${uniCon.ucKey} like concat('%', #{uniCon.ucMock}, '%')</if>
|
||||
<if test="uniCon.ucCon == 'BETWEEN'">and ${uniCon.ucKey} between #{uniCon.begin} and #{uniCon.end}
|
||||
</if>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="checkSource" resultType="java.lang.Integer">
|
||||
select 1 as num;
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<include refid="uniQueryWhere"/>
|
||||
limit #{page.startNum} offset #{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="uniSingleQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(1) from ${select.tableInfo}
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopology" resultType="java.util.Map">
|
||||
select ${select.selectKey} from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<include refid="uniQueryWhere"/>
|
||||
limit #{page.startNum} offset #{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="uniMultiListQueryTopologyCount" resultType="java.lang.Long">
|
||||
select count(1) from ${select.tableInfo}
|
||||
<foreach collection="select.relevance" item="item">
|
||||
${item}
|
||||
</foreach>
|
||||
<include refid="uniQueryWhere"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectTableList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.DynamicTableResult">
|
||||
select
|
||||
relname as table_name,
|
||||
obj_description(oid) as table_comment
|
||||
from pg_class
|
||||
where relkind = 'r'
|
||||
and obj_description(relnamespace) like concat('%',#{params.namespace},'%')
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and relname like concat('%', #{table.tableName}, '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and obj_description(oid) like concat('%', #{table.tableComment}, '%')
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
limit #{page.startNum} offset #{page.endNum}
|
||||
</select>
|
||||
|
||||
<select id="selectTableListCount" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pg_class
|
||||
where relkind = 'r'
|
||||
and obj_description(relnamespace) like concat('%',#{params.namespace},'%')
|
||||
<if test="table.tableName != null and table.tableName != ''">
|
||||
and relname) like concat('%', #{table.tableName}, '%')
|
||||
</if>
|
||||
<if test="table.tableComment != null and table.tableComment != ''">
|
||||
and obj_description(oid) like concat('%', #{table.tableComment}, '%')
|
||||
</if>
|
||||
<if test="list !=null and list.size!=0">
|
||||
and table_name not in
|
||||
<foreach collection="list" item="name" separator="," open="(" close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableListByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableResult">
|
||||
select
|
||||
relname as table_name,
|
||||
obj_description(oid) as table_comment,
|
||||
'POSTGRES' as data_source_type
|
||||
from pg_class
|
||||
where relkind = 'r'
|
||||
and obj_description(relnamespace) like concat('%',#{params.namespace},'%')
|
||||
and relname in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectDynamicTableColumnsByNameList"
|
||||
resultMap="cn.fateverse.query.mapper.DynamicDataSourceMapper.TableColumnResult">
|
||||
select
|
||||
c.relname as remark,
|
||||
a.attname as column_name,
|
||||
d.description as column_comment,
|
||||
concat_ws ('', t.typname,SUBSTRING (format_type (a.atttypid,a.atttypmod) from'\(.*\)')) as column_type,
|
||||
a.attnum as sort,
|
||||
(case when typstorage = 'p' then 1 else 0 end ) as pk
|
||||
from
|
||||
pg_class c,
|
||||
pg_attribute a,
|
||||
pg_type t,
|
||||
pg_description d
|
||||
where a.attnum > 0
|
||||
and a.attrelid = c.oid
|
||||
and a.atttypid = t.oid
|
||||
and d.objoid = a.attrelid
|
||||
and d.objsubid = a.attnum
|
||||
and obj_description(relnamespace) like concat('%',#{params.namespace},'%') and c.relname in
|
||||
<foreach collection="list" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user