wangting
2023-07-05 51cd18dc2821b2b67802ea36c707fd96b99a6afa
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
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
}