Newer
Older
smartwell_demos / src / main / resources / mapper / PartitionStrategyMapper.xml
chaizhuang on 18 Sep 2023 841 bytes 定时器,自动分区表创建
<?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.casic.dao.PartitionStrategyMapper">

    <select id="selectMaxId" resultType="java.lang.String">
        select max(high_value) as maxId
        from  dba_tab_partitions
        where TABLE_NAME = #{tableName}
        and   TABLE_OWNER = #{tableOwner}
    </select>

    <update id="createPartition">
        ALTER TABLE ${tableName}
        ADD PARTITION ${partitionName} VALUES LESS THAN (${time})
        <if test="storage != null and storage != ''">
            STORAGE (ON ${storage})
        </if>
    </update>

    <update id="createTableSpace">
        CREATE TABLESPACE ${tableSpaceName} DATAFILE ${dataFilePath} SIZE ${tableSpaceSize};
    </update>

</mapper>