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
<?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.sh.stc.sict.theme.common.dao.ThemeTableInfoMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.sh.stc.sict.theme.common.model.ThemeTableInfo" id="themeTableInfoMap">
<result property="id" column="id"/>
<result property="typeCode" column="type_code"/>
<result property="typeName" column="type_name"/>
<result property="tableName" column="table_name"/>
<result property="tableCode" column="table_code"/>
<result property="columnSize" column="column_size"/>
<result property="updateTime" column="update_time"/>
<result property="isShow" column="is_show"/>
</resultMap>
<resultMap id="themeTableInfoVo" type="cn.sh.stc.sict.theme.common.vo.ThemeTableInfoVO" extends="themeTableInfoMap">
<result property="tableRows" column="table_rows"/>
<result property="dataLength" column="data_length"/>
</resultMap>
<sql id="Base_Column_List">
id,type_code,type_name,table_name,table_code,column_size,update_time,is_show
</sql>
<select id="listInfo" resultMap="themeTableInfoVo">
select t.id, t.type_code, t.type_name,
t.table_code, t.table_name, t.column_size,
s.table_rows, truncate(data_length/1024/1024, 2) data_length
from theme_table_info t
left join information_schema.tables s on t.table_code = s.table_name
where t.is_show = 1
<if test="theme != null">
and t.theme = #{theme}
</if>
order by sort asc
</select>
</mapper>