Newer
Older
newfiber-data-adapter / src / main / java / org / springnewfiber / dataadapter / sswj / mapper / ExcelPlusMapper.xml
@dongjt dongjt on 14 Jun 2022 1 KB 对接雨量数据
<?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="org.springnewfiber.dataadapter.sswj.mapper.ExcelPlusMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="ExcelPlusMap" type="org.springnewfiber.dataadapter.sswj.entity.TableColumnInfo">
        <result column="column_name" property="columnName"/>
        <result column="column_comment" property="columnComment"/>
    </resultMap>

    <select id="selectTableColumn" resultMap="ExcelPlusMap">
        SELECT COLUMN_NAME,column_comment FROM information_schema.COLUMNS
        WHERE TABLE_SCHEMA = #{dataName} AND TABLE_NAME = #{tableName} ORDER BY ordinal_position
    </select>
    <select id="selectTableName" resultType="java.lang.String">
        SELECT TABLE_COMMENT FROM information_schema.TABLES
        WHERE TABLE_SCHEMA = #{dataName} AND TABLE_NAME = #{tableName}
    </select>
    <select id="selectDataByTableName" resultType="java.util.Map">
        SELECT * FROM ${tableName}
        WHERE 1=1
        <if test="lastSql != null and lastSql != ''">
            and #{lastSql}
        </if>
    </select>
</mapper>