From eb437a28354684e6fa587bf5082eafa7a4252d81 Mon Sep 17 00:00:00 2001 From: VIVIMAN Date: Tue, 21 Dec 2021 17:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../only_balance_ms020405/main.go | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/golang_learn/data_office/get_db_excel/only_balance_ms020405/main.go b/golang_learn/data_office/get_db_excel/only_balance_ms020405/main.go index a22ab7b..97ea3a6 100644 --- a/golang_learn/data_office/get_db_excel/only_balance_ms020405/main.go +++ b/golang_learn/data_office/get_db_excel/only_balance_ms020405/main.go @@ -86,7 +86,7 @@ func main() { // Icon: "src/data_office/get_db_excel/only_balance_gui/main.ico", // 这样实现将页面加载到主界面上 AssignTo: &mw.MainWindow, - Size: Size{600, 400}, + Size: Size{Width: 600, Height: 400}, Layout: VBox{}, MenuItems: []MenuItem{ Menu{ @@ -95,7 +95,7 @@ func main() { Separator{}, Action{ Text: "退出", - OnTriggered: func() { mw.Close() }, + OnTriggered: func() { _ = mw.Close() }, }, }, }, @@ -104,7 +104,7 @@ func main() { Items: []MenuItem{ Action{ Text: "关于", - OnTriggered: mw.aboutAction_Triggered, + OnTriggered: mw.aboutactionTriggered, }, }, }, @@ -131,7 +131,7 @@ func main() { Enabled: isEnd, Text: "关闭", OnClicked: func() { - mw.Close() + _ = mw.Close() }, }, }, @@ -181,10 +181,10 @@ func wirteExcel(outTE *walk.TextEdit, outPB *walk.ProgressBar) { outTE.AppendText("文件名称为:【当前目录下】" + strings.Replace(path, "./", "", -1) + "\r\n") outTE.AppendText("请关闭当前窗口,重新打开\r\n") - fromDB.Close() + _ = fromDB.Close() } -func (mw *MyMainWindow) aboutAction_Triggered() { +func (mw *MyMainWindow) aboutactionTriggered() { walk.MsgBox(mw, "数据库对比工具"+version, " 该工具为公务员系统2020版与公务员系统2021版部分信息比对,\n产生结果会生成Excel供使用。\n"+ "作者:Viviman张 完成时间:2021-12-21 日", walk.MsgBoxIconQuestion) @@ -210,17 +210,6 @@ func doBalance(toMap map[string]map[string]string) map[string]Row4 { return rows } -// 获取表数据 -func QueryMap(db *sql.DB, sqlStr string, m map[string]string) { - rows, _ := db.Query(sqlStr) - defer rows.Close() - columns, _ := rows.Columns() - for rows.Next() { - _ = rows.Scan(&columns[0], &columns[1]) - m[columns[0]] = columns[1] - } -} - // 获取表数据 func QuerySQL(db *sql.DB, sqlStr string) map[string]map[string]string { mapObj := make(map[string]map[string]string)