liusheng
8 天以前 7eb4c98f4d96bebf28685d801e7b978d6c3d251e
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
<?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.smartor.mapper.ShardingMapper">
    <select id="getTableCount" resultType="long">
        SELECT count(*)
        FROM ${tableName}
    </select>
 
    <select id="getMaxId" resultType="long">
        SELECT max(id)
        FROM ${tableName}
    </select>
 
    <update id="renameTable">
        RENAME
        TABLE
        ${oldName}
        TO
        ${newName}
    </update>
 
    <update id="createLikeTable">
        CREATE TABLE ${newTableName} LIKE ${templateTableName}
    </update>
 
    <update id="setAutoIncrement">
        ALTER TABLE ${tableName} AUTO_INCREMENT = #{value}
    </update>
</mapper>