<sqlid="delIndex"> DROP INDEX #{indexName} ON #{tableName}; </sql> <updateid="delAnIndex"> <includerefid="delIndex" /> </update>
1 2 3 4 5 6
<sqlid="createIndex"> CREATE INDEX #{idx_users_name} ON ${users}(dh); </sql> <updateid="createUsersIndex"> <includerefid="createIndex" /> </update>
正常调用创建或删除方法并传入值后:
1
Cannot determine value type from string 'z_9777769dm8x'; nested exception is java.sql.SQLDataException: Cannot determine value type from string 'z_9777769dm8x' with root cause
<!-- 创建索引 --> <updateid="createIndex"parameterType="java.util.Map"> CREATE INDEX `${params.indexName}` ON `${params.tableName}`(`${params.columnName}`); </update>
<!-- 删除索引 --> <updateid="dropIndex"> ALTER TABLE `${params.tableName}` DROP INDEX `${params.indexName}`; </update>
<!-- 判断索引是否存在 --> <selectid="isIndexExists"resultType="int"parameterType="java.util.Map"> SELECT COUNT(*) FROM information_schema.statistics WHERE table_schema = DATABASE() AND table_name = #{params.tableName} AND index_name = #{params.indexName} </select>