Mybatis簡單的通用報表匯入

2021-10-07 17:41:32 字數 1930 閱讀 5946

剛剛畢業找到工作,正處於培訓階段比較清閒,就想著寫點通用元件以後要用到的時候就可以節省很多精力,這裡是乙個mybatis的自己寫的乙個報表匯入。這塊打算用mybatis-plus重寫乙個,先記錄一下,說不定工作幾年回來看看自己寫的**還有點小羞恥。

service層

//多了就寫成列舉

private final static string after_excel2007_format

="xlsx"

;private final static string before_excel2007_format

="xls"

;/**

* @param istitle excel檔案首行是否為標題行

* @param tablename 表名

* @param idname 該錶主鍵名

* @param columns excel檔案每一列的對應的表的欄位名

* @author freeman

* */

@override

public

void

importexcel

(boolean istitle, string tablename, string idname, string[

] columns

, multipartfile file) throws ioexception

string fileformat = filename.

substring

(filename.

lastindexof

(".")+

1); string[

] values =

newstring

[columns.length];if

(after_excel2007_format

.equals

(fileformat))}

elseif(

before_excel2007_format

.equals

(fileformat))}

else

}private

void

insertexcel

(boolean istitle, string tablename, string idname, string[

] columns

, string[

] values, sheet sheet)if(

!"".equals

(idname)

&& idname !=

null

)else

}}

int insertbyexcel

(@param

("table"

) string table, @param

("columns"

) string[

] columns

, @param

("values"

) string[

] values)

;

"insertbyexcel"

>

insert

into $

"columns" item=

"column" open=

"(" separator=

"," close=

")">

$<

/foreach>

values

"values" item=

"value" open=

"(" separator=

"," close=

")">

#<

/foreach>

<

/insert>

Visual Basic通用報表設計小結

本文對vb設計報表的方法作了乙個小結,大家都知道,在vb平台下製作報表大致有兩種選擇 使用vb自帶的data report控制項和借助第三方軟體。其中第三方軟體比較著名的就是ms excel和seagate公司的crystalreporter,以下就這三個方案進行詳細的討論。1.data repor...

Visual Basic通用報表設計小結

本文對vb設計報表的方法作了乙個小結,大家都知道,在vb平台下製作報表大致有兩種選擇 使用vb自帶的data report控制項和借助第三方軟體。其中第三方軟體比較著名的就是ms excel和seagate公司的crystalreporter,以下就這三個方案進行詳細的討論。1.data repor...

Visual Basic通用報表設計小結

visual basic通用報表設計小結 本文對vb設計報表的方法作了乙個小結,大家都知道,在vb平台下製作報表大致有兩種選擇 使用vb自帶的data report控制項和借助第三方軟體。其中第三方軟體比較著名的就是ms excel和seagate公司的crystalreporter,以下就這三個方...