package com.vci.ubcs.ddl.mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.ResultType; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; /** * Description: * * @author LiHang * @date 2023/4/25 */ public interface DllMapper { @Update({"${viewCreateSql}"}) int createViewBySql(@Param("viewCreateSql") String viewCreateSql); @Update({"create table ${tableName} ( ${attributeSql} )"}) int createTableBySql(@Param("tableName") String tableName, @Param("attributeSql") String attributeSql); @Update({"COMMENT ON TABLE ${tableName} IS '${comment}' "}) int commentTable(@Param("tableName") String tableName, @Param("comment") String comment); @Update({"COMMENT ON column ${tableName}.${columnName} IS '${comment}' "}) int commentColumnTable(@Param("tableName") String tableName, @Param("columnName") String columnName, @Param("comment") String comment); @Update({"alter table ${tableName} modify ( ${attributeSql} ) "}) int modifyTableBySql(@Param("tableName") String tableName, @Param("attributeSql") String attributeSql); @Update({"alter table ${tableName} add ( ${attributeSql} )"}) int addColumn2TableBySql(@Param("tableName") String tableName, @Param("attributeSql") String attributeSql); @Update({"drop table if exists ${tableName}"}) int dropTable(@Param("tableName") String tableName); @Select({"select count(table_name) from user_tables where upper(table_name) = upper(#{tableName,jdbcType=VARCHAR})"}) int checkTableExist(@Param("tableName") String tableName); @Select({"select count(*) from ${tableName}"}) @ResultType(Integer.class) int countAll(@Param("tableName") String tableName); }