DynamicSelectMapper.xml
5.44 KB
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
<?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.runsa.portal.query.dao.DynamicSelectDao">
<cache eviction="LRU" flushInterval="60000" size="512" readOnly="true"/>
<resultMap type="cn.runsa.portal.query.entity.DynamicSelect" id="dynamicSelect">
<id column="ds_id" property="id"/>
<result column="ds_name" property="name"/>
<result column="ds_describe" property="describe"/>
<result column="ds_create_time" property="createTime"/>
<collection property="tables" javaType="ArrayList" ofType="cn.runsa.portal.query.entity.DynamicTable">
<id column="dt_id" property="id"/>
<result column="ds_id" property="selectId"/>
<result column="dt_name" property="name"/>
<result column="dt_tablename" property="tableName"/>
<result column="dt_type" property="type" typeHandler="cn.runsa.portal.query.mybatis.DynamicTableTypeHandler"/>
<result column="dt_ref_select" property="refSelect"/>
<result column="dt_on" property="on"/>
<result column="dt_relation" property="relation" typeHandler="cn.runsa.portal.query.mybatis.DynamicTableRelTypeHandler"/>
<result column="dt_sort" property="sort"/>
<result column="dt_create_time" property="createTime"/>
<result column="dt_update_time" property="updateTime"/>
<collection property="fields" javaType="ArrayList" ofType="cn.runsa.portal.query.entity.DynamicField" resultMap="dynamicField" />
</collection>
</resultMap>
<resultMap id="dynamicField" type="cn.runsa.portal.query.entity.DynamicField" >
<id column="df_id" property="id"/>
<result column="dt_id" property="tableId"/>
<result column="df_name" property="name"/>
<result column="df_field_asname" property="fieldAsName"/>
<result column="df_field_name" property="fieldName"/>
<result column="df_primary" property="primary"/>
<result column="df_type" property="type" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldTypeHandler"/>
<result column="df_group" property="group" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldGroupHandler"/>
<result column="df_data_type" property="dataType" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldDataTypeHandler"/>
<result column="df_filter_type" property="filterType" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldFilterTypeHandler"/>
<result column="df_filter_hidden" property="filterHidden"/>
<result column="df_select_hidden" property="selectHidden"/>
<result column="df_select_type" property="selectType" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldSelectTypeHandler"/>
<result column="df_ref_select" property="selectId"/>
<result column="df_ref_type" property="refType" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldRefTypeHandler"/>
<result column="df_select_format" property="selectFormat"/>
<result column="df_where_format" property="whereFormat"/>
<result column="df_having_format" property="havingFormat"/>
<result column="df_empty_tips" property="emptyTips"/>
<result column="df_notnull" property="notNull"/>
<result column="df_defval" property="defVal"/>
<result column="df_regex" property="regex"/>
<result column="df_regex_error" property="regexError"/>
<result column="df_width" property="width"/>
<result column="df_decimals" property="decimals"/>
<result column="df_maxvalue" property="maxValue"/>
<result column="df_minvalue" property="minValue"/>
<result column="df_maxlength" property="maxLength"/>
<result column="df_minlength" property="minLength"/>
<result column="df_temp_text" property="template"/>
<result column="df_temp_sql" property="tempSql"/>
<result column="df_data_use_type" property="dataUseType" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldDataUseTypeHandler"/>
<result column="df_data_show_type" property="dataShowType" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldDataShowTypeHandler"/>
<result column="df_data_sql" property="dataSql"/>
<result column="df_orderby" property="orderBy" typeHandler="cn.runsa.portal.query.mybatis.DynamicFieldOrderByHandler"/>
<result column="df_group_concat" property="groupConcat"/>
<result column="df_sort" property="sort"/>
<result column="df_disable" property="disable"/>
</resultMap>
<select id="findById" parameterType="String" resultMap="dynamicSelect">
SELECT
t1.ds_id,t1.ds_name,t1.ds_describe,t1.ds_create_time
FROM pl_dynamic_select t1
WHERE t1.ds_id=#{id}
</select>
<select id="findCascadeById" parameterType="String" resultMap="dynamicSelect">
SELECT
t1.ds_id,t1.ds_name,t1.ds_describe,t1.ds_create_time,
t2.dt_name,t2.dt_tablename,t2.dt_type,t2.dt_ref_select,t2.dt_on,t2.dt_relation,t2.dt_sort,t2.dt_create_time,t2.dt_update_time,
t3.*
FROM pl_dynamic_select t1
LEFT JOIN pl_dynamic_table t2 ON t2.ds_id=t1.ds_id
LEFT JOIN pl_dynamic_field t3 ON t3.dt_id=t2.dt_id AND t3.df_disable=0
WHERE t1.ds_id=#{id}
ORDER BY t2.dt_sort ASC,t3.df_sort ASC
</select>
<select id="findTemplateField" resultMap="dynamicField">
SELECT t1.*
FROM pl_dynamic_field t1
INNER JOIN pl_dynamic_temp_param t2 on t2.df_ref_id=t1.df_id AND t2.df_id=#{id}
WHERE t1.df_disable=0
ORDER BY t1.df_sort ASC
</select>
<select id="exists" parameterType="String" resultType="boolean">
SELECT COUNT(1) FROM pl_dynamic_select WHERE ds_id=#{id}
</select>
<select id="findFieldById" parameterType="String" resultMap="dynamicField">
SELECT * FROM pl_dynamic_field
WHERE df_id=#{id}
ORDER BY df_sort ASC
</select>
</mapper>