| 12345678910111213141516171819202122232425262728293031323334 |
- <?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="com.liangjiang.price_collection.mapper.TableMapper">
- <!-- 创建数据表 -->
- <update id="createTable" parameterType="java.lang.String">
- CREATE TABLE IF NOT EXISTS ${tableName} (
- `id` INT UNSIGNED NOT NULL,
- `bid` VARCHAR(128) NOT NULL,
- `ask` VARCHAR(128) NOT NULL,
- PRIMARY KEY (`id`)
- )
- </update>
- <!-- 获取所有数据表格 -->
- <select id="getTableName" resultType="java.lang.String">
- SELECT
- table_name
- FROM
- information_schema.TABLES
- WHERE
- table_type = 'BASE TABLE'
- AND table_schema = 'one_price_warehouse'
- ORDER BY
- table_name
- </select>
- <insert id="savePrice">
- INSERT ${tableName} ( id, bid, ask ) VALUE (${id}, ${bid}, ${ask})on duplicate key update bid = ${bid}, ask = ${ask}
- </insert>
- <select id="getPriceInfo" resultType="com.liangjiang.price_collection.dto.PriceInfoDto">
- select id, bid, ask from ${tableName} where id > ${timeEnd}
- </select>
- </mapper>
|