Browse Source

增加其他功能代码

master
VIVIMAN 3 years ago
parent
commit
5ab673e208
  1. 1
      golang_learn/data_func/go_to_command/run_sql/build.bat
  2. 21
      golang_learn/data_func/go_to_command/run_sql/main.exe.manifest
  3. 303
      golang_learn/data_func/go_to_command/run_sql/main.go
  4. BIN
      golang_learn/data_func/go_to_command/run_sql/main.syso
  5. BIN
      golang_learn/data_func/go_to_command/run_sql/rc.ico
  6. 73
      golang_learn/data_func/go_to_windows/main.go
  7. 309
      golang_learn/data_func/go_to_windows/winMc.go
  8. 295
      golang_learn/data_func/go_to_windows/winStruct.go
  9. 32
      golang_learn/data_func/go_to_windows/winView.go

1
golang_learn/data_func/go_to_command/run_sql/build.bat

@ -0,0 +1 @@
go build -o CleanData.exe

21
golang_learn/data_func/go_to_command/run_sql/main.exe.manifest

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="x86"
name="controls"
type="win32"
></assemblyIdentity>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>

303
golang_learn/data_func/go_to_command/run_sql/main.go

@ -0,0 +1,303 @@
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"log"
"os"
"time"
)
var tabs Tabs // 清除特殊字符串表和字段
var url = `root:admin@tcp(127.0.0.1:35017)/hy_qggwy?charset=utf8`
func main() {
db, err := sql.Open("mysql", url)
if err != nil {
log.Fatal("连接数据库成功!")
os.Exit(1)
}
log.Println("连接数据库成功!")
for i := range tabs.Tab {
tab := tabs.Tab[i]
log.Println("开始执行表:" + tab.name)
for _, col := range tab.Cols {
for i2 := range ts {
_, _ = db.Exec(fmt.Sprintf(`update %s set %s=replace(%s, '%s', '') where %s is not null`, tab.name, col, col, ts[i2], col))
}
}
}
log.Println("执行完成!")
time.Sleep(60 * time.Second)
}
var ts = []string{
"&#x00",
"&#x01",
"&#00",
"&#01",
"&#",
}
// 清除特殊字符串问题
type Tab struct {
name string
Cols []string
}
type Tabs struct {
Tab []Tab
}
func init() {
// 清除字段可能存储特殊字符串处理
tabs = Tabs{
Tab: []Tab{
{
name: "A01",
Cols: []string{
"A0101",
"A0102",
"A0104",
"A0107",
"A0111A",
"A0114A",
"A0115A",
"A0117",
"A0128",
"A0134",
"A0140",
"A0141",
"A0144",
"A3921",
"A3927",
"A0160",
"A0163",
"A0165",
"A0184",
"A0187A",
"A0192",
"A0192A",
"A0221",
"A0288",
"A0192E",
"A0192C",
"A0196",
"A0197",
"A0195",
"A1701",
"A14Z101",
"A15Z101",
"A0120",
"A0121",
"A0122",
"A2949",
"A0180",
"QRZXL",
"QRZXLXX",
"QRZXW",
"QRZXWXX",
"ZZXL",
"ZZXLXX",
"ZZXW",
"ZZXWXX",
"ZGXL",
"ZGXLXX",
"ZGXW",
"ZGXWXX",
"TCSJSHOW",
"TCFSSHOW",
},
},
{
name: "A02",
Cols: []string{
"A0201A",
"A0201B",
"A0201D",
"A0201E",
"A0215A",
"A0219",
"A0223",
"A0225",
"A0243",
"A0245",
"A0247",
"A0251B",
"A0255",
"A0265",
"A0267",
"A0272",
"A0281",
},
},
{
name: "A05",
Cols: []string{
"A0531",
"A0501B",
"A0504",
"A0511",
"A0517",
"A0524",
"A0526",
"A0528B",
"A0530",
"A0532",
},
},
{
name: "A06",
Cols: []string{
"A0601",
"A0602",
"A0604",
"A0607",
"A0611",
"A0699",
},
},
{
name: "A08",
Cols: []string{
"A0801A",
"A0801B",
"A0901A",
"A0901B",
"A0804",
"A0807",
"A0904",
"A0814",
"A0824",
"A0827",
"A0837",
"A0811",
"A0831",
"A0832",
"A0834",
"A0835",
"A0838",
"A0839",
"A0899",
},
},
{
name: "A14",
Cols: []string{
"A1404A",
"A1404B",
"A1407",
"A1411A",
"A1414",
"A1415",
"A1416",
"A1424",
"A1428",
},
},
{
name: "A15",
Cols: []string{
"A1517",
"A1521",
},
},
{
name: "A30",
Cols: []string{
"A3001",
"A3004",
"A3007A",
"A3038",
},
},
{
name: "A33",
Cols: []string{
"A3310",
"A3321",
"A3321C",
"A3321D",
"A3322",
"A3323",
"A3331",
"A3332",
"A3333",
"A3350",
"A3360",
"A3361",
"A3362",
"A3371",
"A3372",
"A3381",
"A3382",
"A3385",
"A3321A",
"A3321B",
"A3321E",
"A3321F",
"A3333A",
"A3333B",
},
},
{
name: "A36",
Cols: []string{
"A3601",
"A3604A",
"A3607",
"A3627",
"A3611",
"SORTID",
},
},
{
name: "A57",
Cols: []string{
"A5714",
},
},
{
name: "A99Z1",
Cols: []string{
"A99Z101",
"A99Z102",
"A99Z103",
"A99Z104",
"A99Z191",
"A99Z195",
},
},
{
name: "B01",
Cols: []string{
"B0101",
"B0104",
"B0114",
"B0117",
"B0124",
"B0127",
"B0131",
"B0194",
"B0227",
"B0232",
"B0233",
"B0236",
"B0234",
"B0150",
"B0183",
"B0185",
"B0164",
"B0167",
"B0268",
"B0269",
"B0238",
"B0239",
"B0180",
"SORTID",
},
},
},
}
}

BIN
golang_learn/data_func/go_to_command/run_sql/main.syso

Binary file not shown.

BIN
golang_learn/data_func/go_to_command/run_sql/rc.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

73
golang_learn/data_func/go_to_windows/main.go

@ -33,6 +33,10 @@ var passwordname = "Qw^e1@10&++Hzb...?8" // 解压密码
var path string // 该部分不存在最后 横线 (格式为 D:\hzb2021),使用时需要补充横线
var epsoft1 = `全国公务员管理信息系统2020版` // 系统名称 1
var epsoft2 = `全国公务员管理信息系统2021版` // 系统名称 2
var url = `root:admin@tcp(127.0.0.1:35017)/hy_qggwy?charset=utf8`
var tabs Tabs // 清除特殊字符串表和字段
var funcs Funcs // 执行批量操作脚本
var typeStr = `0` // 执行导出名册默认 0-按照职务输出生成 1-按照主职务生成
type myApp struct {
title string
@ -59,11 +63,11 @@ func init() {
app.title = "公务员管理系统-运行监控"
app.name = "网新"
service1 = myService{
text: "数据存储库",
text: " 数据存储库",
serviceName: "GWY20_Mysql",
}
service3 = myService{
text: "公务员系统",
text: " 公务员系统",
serviceName: "GWY20_Tomcat",
}
path, _ = os.Getwd()
@ -465,6 +469,28 @@ func setServerSize() {
})
}
// 按照职务输出生成(可能人员重复)
func getMcByA0281() {
typeStr = "0"
mc, b := RunMc()
if b {
return
}
showMsg("导出文件成功!")
showMsg(fmt.Sprintf("存放当前目录下,文件名称:%s", mc))
}
// 按照主职务生成(可能人员丢失)
func getMcByA0279() {
typeStr = "1"
mc, b := RunMc()
if b {
return
}
showMsg("导出文件成功!")
showMsg(fmt.Sprintf("存放当前目录下,文件名称:%s", mc))
}
// reDbIndex 重新构建索引
func reDbIndex() {
// 判断 mysql 服务应用启动
@ -475,7 +501,7 @@ func reDbIndex() {
time.Sleep(time.Second)
db, _ := sql.Open("mysql", "root:admin@tcp(127.0.0.1:35017)/hy_qggwy?charset=utf8")
db, _ := sql.Open("mysql", url)
showMsg("连接数据库成功!\n请不要进行其他操作,否则影响执行...")
for i := 0; i < len(DbIndex); i++ {
ExecSql(db, fmt.Sprintf(`DROP INDEX %s ON %s`, DbIndex[i].idxName, DbIndex[i].tabName))
@ -484,6 +510,45 @@ func reDbIndex() {
showMsg("已完成重新构建索引!")
}
// clearData 数据清洗 (主要同步主细表数据;清洗可录入数据中特殊字符串)
func clearData() {
// 判断 mysql 服务应用启动
if service1.btnStart.Enabled() {
walk.MsgBox(app.mw, "错误", "数据库服务未启动,即将进行数据库服务启动!", walk.MsgBoxIconWarning)
startService(service1)
}
time.Sleep(time.Second)
db, _ := sql.Open("mysql", url)
showMsg("连接数据库成功!\n请不要进行其他操作,否则影响执行...")
for i := range funcs.Sql {
sqlStrs := funcs.Sql[i]
for _, sqlStr := range sqlStrs.Sql {
db.Exec(sqlStr)
}
showMsg(fmt.Sprintf("已完成%s!", sqlStrs.name))
}
for i := range tabs.Tab {
tab := tabs.Tab[i]
for _, col := range tab.Cols {
for i2 := range ts {
_, _ = db.Exec(fmt.Sprintf(`update %s set %s=replace(%s, '%s', '') where %s is not null`, tab.name, col, col, ts[i2], col))
}
}
}
showMsg("已完成清洗数据中特殊字符串!")
}
var ts = []string{
"&#x00",
"&#x01",
"&#00",
"&#01",
"&#",
}
func ExecSql(db *sql.DB, sql string) {
stmt, err := db.Prepare(sql)
if err != nil {
@ -505,7 +570,7 @@ func dbBak() {
// 判断 mysql 服务应用启动
if !service1.btnStart.Enabled() {
db, _ := sql.Open("mysql", "root:admin@tcp(127.0.0.1:35017)/hy_qggwy?charset=utf8")
db, _ := sql.Open("mysql", url)
showMsg("连接数据库成功!\n备份操作可能需要相当长时间...")
// 【压缩data方式】创建临时文件夹

309
golang_learn/data_func/go_to_windows/winMc.go

@ -0,0 +1,309 @@
package main
import (
"database/sql"
"encoding/json"
"fmt"
"github.com/360EntSecGroup-Skylar/excelize"
_ "github.com/go-sql-driver/mysql"
"strconv"
"strings"
"time"
)
const sheetName = `Sheet1`
const fileName = `公务员系统数据-`
const fileType = `.xlsx`
const sqlCodeStr = `SELECT concat(code_type,code_value),code_name FROM CODE_VALUE where code_type in('%s') union SELECT concat(code_type,code_value),code_name3 FROM CODE_VALUE where code_type='ZB01'`
const sqlB01 = `select b0111,b0121,b0101 from b01 where b0111<>'-1' order by b0121,sortid`
const sqlA01A0279 = `select %s from a01 where a0163='1' and exists(select 1 from a02 a02 where a01.a0000=a02.a0000 and a0279='1' and A0201B='%s') order by (select lpad(max(a0225),5,'0') from a02 where a01.a0000=a02.a0000 and a0279='1' and A0201B='%s')`
const sqlA01A0281 = `select %s from a01 where a0163='1' and exists(select 1 from a02 a02 where a01.a0000=a02.a0000 and a0281='true' and A0201B='%s') order by (select lpad(max(a0225),5,'0') from a02 where a01.a0000=a02.a0000 and a0281='true' and A0201B='%s')`
var CodeValueMap = make(map[string]string)
func RunMc() (string, bool) {
db, _ := sql.Open("mysql", url)
codes, headers, types, headWidth, err := getInit()
if err {
showMsg(fmt.Sprintf("导出名册发生异常!"))
return "", err
}
var allObj [][]interface{}
if len(CodeValueMap) == 0 {
QueryMap(db, fmt.Sprintf(sqlCodeStr, strings.Join(types, "','")), CodeValueMap)
}
b01s := QueryB01(db)
b01 := dept{
Id: "-1",
Child: make([]*dept, 0),
}
makeTree(b01s, &b01)
makeA01s(b01, db, codes, types, &allObj)
return getExcelFile(headers, headWidth, allObj), false
}
func makeA01s(b01 dept, db *sql.DB, codes []string, types []string, allObj *[][]interface{}) {
for _, d := range b01.Child {
QueryA01(db, strings.Join(codes, ","), types, d.Id, allObj)
if len(d.Child) > 0 {
makeA01s(*d, db, codes, types, allObj)
}
}
}
// getInit 初始化 JSON 对象,获取猎头
func getInit() ([]string, []string, []string, []float64, bool) {
var yrYhs []YrYh
//读取的数据为json格式,需要进行解码
err := json.Unmarshal([]byte(yryh), &yrYhs)
if err != nil {
showMsg(fmt.Sprintf("导出名册发生异常:%s", err))
return nil, nil, nil, nil, true
}
yrYhsLen := len(yrYhs)
types := make([]string, yrYhsLen, yrYhsLen) // 输出类型
codes := make([]string, yrYhsLen, yrYhsLen) // 输出信息项
headers := make([]string, yrYhsLen, yrYhsLen) // 输出列名
headWidth := make([]float64, yrYhsLen, yrYhsLen) // 输出列名
for i1, i2 := range yrYhs {
codes[i1] = i2.Code
headers[i1] = i2.Name
headWidth[i1] = i2.Width
types[i1] = i2.Type
}
return codes, headers, types, headWidth, false
}
func getExcelFile(headers []string, headWidth []float64, values [][]interface{}) string {
f, _ := ExportExcel(sheetName, headers, headWidth, values)
fileNameType := fileName + time.Now().Format("2006102150405") + fileType
_ = f.SaveAs(fileNameType)
return fileNameType
}
// maxCharCount 最多26个字符A-Z
const maxCharCount = 26
// ExportExcel 导出Excel文件
// sheetName 工作表名称, 注意这里不要取sheet1这种名字,否则导致文件打开时发生部分错误。
// headers 列名切片, 表头
// rows 数据切片,是一个二维数组
func ExportExcel(sheetName string, headers []string, headWidth []float64, rows [][]interface{}) (*excelize.File, error) {
f := excelize.NewFile()
style, _ := f.NewStyle(`{
"border":[
{"type":"top","color":"#000000","style":1},
{"type":"left","color":"#000000","style":1},
{"type":"right","color":"#000000","style":1},
{"type":"bottom","color":"#000000","style":1}
],
"font":{"size":12,"color":"#000000","family":"仿宋"},
"alignment":{"horizontal":"center","vertical":"center","wrap_text":true},
"fill":{"type":"gradient","shading":0,"color":["#FFFF00","#FFFF00"]}
}`)
sheetIndex := f.NewSheet(sheetName)
maxColumnRowNameLen := 1 + len(strconv.Itoa(len(rows)))
columnCount := len(headers)
if columnCount > maxCharCount {
maxColumnRowNameLen++
} else if columnCount > maxCharCount*maxCharCount {
maxColumnRowNameLen += 2
}
columnNames := make([][]byte, 0, columnCount)
f.SetRowHeight(sheetName, 1, 80) // 设置行高
for i, header := range headers {
columnName := getColumnName(i, maxColumnRowNameLen)
columnNames = append(columnNames, columnName)
// 初始化excel表头,这里的index从1开始要注意
curColumnName := getColumnRowName(columnName, 1)
f.SetColWidth(sheetName, toCharStr(i+1), toCharStr(i+1), headWidth[i])
f.SetCellValue(sheetName, curColumnName, header)
f.SetCellStyle(sheetName, curColumnName, curColumnName, style) // 设置单元格样式
}
for rowIndex, row := range rows {
for columnIndex, columnName := range columnNames {
// 从第二行开始
f.SetCellValue(sheetName, getColumnRowName(columnName, rowIndex+2), row[columnIndex])
}
}
f.SetActiveSheet(sheetIndex)
return f, nil
}
// getColumnName 生成列名
// Excel的列名规则是从A-Z往后排;超过Z以后用两个字母表示,比如AA,AB,AC;两个字母不够以后用三个字母表示,比如AAA,AAB,AAC
// 这里做数字到列名的映射:0 -> A, 1 -> B, 2 -> C
// maxColumnRowNameLen 表示名称框的最大长度,假设数据是10行,1000列,则最后一个名称框是J1000(如果有表头,则是J1001),是4位
// 这里根据 maxColumnRowNameLen 生成切片,后面生成名称框的时候可以复用这个切片,而无需扩容
func getColumnName(column, maxColumnRowNameLen int) []byte {
const A = 'A'
if column < maxCharCount {
// 第一次就分配好切片的容量
slice := make([]byte, 0, maxColumnRowNameLen)
return append(slice, byte(A+column))
} else {
// 递归生成类似AA,AB,AAA,AAB这种形式的列名
return append(getColumnName(column/maxCharCount-1, maxColumnRowNameLen), byte(A+column%maxCharCount))
}
}
// getColumnRowName 生成名称框
// Excel的名称框是用A1,A2,B1,B2来表示的,这里需要传入前一步生成的列名切片,然后直接加上行索引来生成名称框,就无需每次分配内存
func getColumnRowName(columnName []byte, rowIndex int) (columnRowName string) {
l := len(columnName)
columnName = strconv.AppendInt(columnName, int64(rowIndex), 10)
columnRowName = string(columnName)
// 将列名恢复回去
columnName = columnName[:l]
return
}
// QueryB01 获取机构树信息
func QueryB01(db *sql.DB) []*dept {
rows, _ := db.Query(sqlB01)
defer rows.Close()
var b0111, b0121, b0101 string
depts := make([]*dept, 0)
for rows.Next() {
_ = rows.Scan(&b0111, &b0121, &b0101)
depts = append(depts, &dept{
Id: b0111,
Pid: b0121,
Name: b0101,
Child: make([]*dept, 0),
})
}
return depts
}
// QueryA01 获取人员信息
func QueryA01(db *sql.DB, codes string, types []string, b0111 string, allObj *[][]interface{}) {
var sqlStr string
if typeStr == "1" {
sqlStr = fmt.Sprintf(sqlA01A0279, codes, b0111, b0111)
} else {
sqlStr = fmt.Sprintf(sqlA01A0281, codes, b0111, b0111)
}
rows, _ := db.Query(sqlStr)
defer rows.Close()
columns, _ := rows.Columns()
columnsLen := len(columns)
scanArgs := make([]interface{}, columnsLen)
values := make([]interface{}, columnsLen)
for i := range values {
scanArgs[i] = &values[i]
}
for rows.Next() {
_ = rows.Scan(scanArgs...)
valuer := make([]interface{}, columnsLen)
setValueStr(values, types, valuer)
*allObj = append(*allObj, valuer)
}
}
func setValueStr(values []interface{}, types []string, valuer []interface{}) {
for i, col := range values {
if col != nil {
s := string(col.([]byte))
if types[i] == NULL {
valuer[i] = s
} else if types[i] == DATE {
valuer[i] = s[0:4] + DIAN + s[4:6]
} else {
valuer[i] = CodeValueMap[types[i]+s]
}
} else {
valuer[i] = NULL
}
}
}
// 获取表数据
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 has(v1 dept, vs []*dept) bool {
var has bool
has = false
for _, v2 := range vs {
v3 := *v2
if v1.Id == v3.Pid {
has = true
break
}
}
return has
}
// makeTree 生成机构树对象
func makeTree(vs []*dept, node *dept) {
childs := findChild(node, vs)
for _, child := range childs {
node.Child = append(node.Child, child)
if has(*child, vs) {
makeTree(vs, child)
}
}
}
func findChild(v *dept, vs []*dept) (ret []*dept) {
ret = make([]*dept, 0)
for _, v2 := range vs {
if v.Id == v2.Pid {
ret = append(ret, v2)
}
}
return
}
// 数字转字母
func toCharStr(i int) string {
return string(rune('A' - 1 + i))
}
type YrYh struct {
Name string `json:"name"`
Code string `json:"code"`
Type string `json:"type"`
Width float64 `json:"width"`
}
const yryh = `[
{"name":"姓名","code":"a01.a0101","type":"","width":11},
{"name":"性别","code":"a01.a0104","type":"GB2261","width":8},
{"name":"民族","code":"a01.a0117","type":"GB3304","width":8},
{"name":"出生日期","code":"a01.a0107","type":"DATE","width":12},
{"name":"参加工作时间","code":"a01.a0134","type":"DATE","width":13},
{"name":"入党时间","code":"a01.a0140","type":"","width":12},
{"name":"工作单位及职务全称","code":"a01.a0192a","type":"","width":20},
{"name":"职务层次","code":"a01.a0221","type":"ZB09","width":12},
{"name":"任职务层次时间","code":"a01.a0288","type":"DATE","width":15},
{"name":"职级","code":"a01.a0192e","type":"ZB148","width":12},
{"name":"任职级时间","code":"a01.a0192c","type":"DATE","width":12},
{"name":"任相当层次职务职级时间","code":"a01.a0192x","type":"DATE","width":15},
{"name":"最高学历","code":"a01.zgxl","type":"","width":15},
{"name":"籍贯","code":"a01.a0111","type":"ZB01","width":12}
]`
const DATE = "DATE"
const NULL = ""
const DIAN = "."
// 树结构
type dept struct {
Id string `json:"id"`
Pid string `json:"pid"`
Name string `json:"name"`
Child []*dept `json:"child"`
}

295
golang_learn/data_func/go_to_windows/winStruct.go

@ -12,7 +12,9 @@ var Info = strings.Join([]string{
"3. 设置 应用和数据库 内存大小",
"4. 实现 数据库索引 重新构建",
"5. 实现 数据备份 压缩备份库文件与备份照片",
//"6. 实现 数据还原 执行还原库文件与还原照片",
"6. 【待完善】数据还原", // "实现 数据还原 执行还原库文件与还原照片",
"7. 实现 特殊字符串处理,由于 ”&#“ 导致无法导入问题的解决",
"8. 实现 按照机构树前序遍历方式 导出表册",
fmt.Sprintf("版本:%s", Version)}, "\n")
// 【废弃】基础库部分脚本(除 a01 和 b01)
@ -459,3 +461,294 @@ var DbIndex = []tabIdx{
{tabName: "J2108", idxName: "J2108_IDX_001", idxColumn: "UNITID"},
{tabName: "J2108", idxName: "J2108_IDX_002", idxColumn: "TABLEID"},
}
// 清除特殊字符串问题
type Tab struct {
name string
Cols []string
}
type Tabs struct {
Tab []Tab
}
// 批量处理主细表或描述拼接
type Sqls struct {
name string
Sql []string
}
type Funcs struct {
Sql []Sqls
}
func init() {
// 清除字段可能存储特殊字符串处理
tabs = Tabs{
Tab: []Tab{
{
name: "A01",
Cols: []string{
"A0101",
"A0102",
"A0104",
"A0107",
"A0111A",
"A0114A",
"A0115A",
"A0117",
"A0128",
"A0134",
"A0140",
"A0141",
"A0144",
"A3921",
"A3927",
"A0160",
"A0163",
"A0165",
"A0184",
"A0187A",
"A0192",
"A0192A",
"A0221",
"A0288",
"A0192E",
"A0192C",
"A0196",
"A0197",
"A0195",
"A1701",
"A14Z101",
"A15Z101",
"A0120",
"A0121",
"A0122",
"A2949",
"A0180",
"QRZXL",
"QRZXLXX",
"QRZXW",
"QRZXWXX",
"ZZXL",
"ZZXLXX",
"ZZXW",
"ZZXWXX",
"ZGXL",
"ZGXLXX",
"ZGXW",
"ZGXWXX",
"TCSJSHOW",
"TCFSSHOW",
},
},
{
name: "A02",
Cols: []string{
"A0201A",
"A0201B",
"A0201D",
"A0201E",
"A0215A",
"A0219",
"A0223",
"A0225",
"A0243",
"A0245",
"A0247",
"A0251B",
"A0255",
"A0265",
"A0267",
"A0272",
"A0281",
},
},
{
name: "A05",
Cols: []string{
"A0531",
"A0501B",
"A0504",
"A0511",
"A0517",
"A0524",
"A0526",
"A0528B",
"A0530",
"A0532",
},
},
{
name: "A06",
Cols: []string{
"A0601",
"A0602",
"A0604",
"A0607",
"A0611",
"A0699",
},
},
{
name: "A08",
Cols: []string{
"A0801A",
"A0801B",
"A0901A",
"A0901B",
"A0804",
"A0807",
"A0904",
"A0814",
"A0824",
"A0827",
"A0837",
"A0811",
"A0831",
"A0832",
"A0834",
"A0835",
"A0838",
"A0839",
"A0899",
},
},
{
name: "A14",
Cols: []string{
"A1404A",
"A1404B",
"A1407",
"A1411A",
"A1414",
"A1415",
"A1416",
"A1424",
"A1428",
},
},
{
name: "A15",
Cols: []string{
"A1517",
"A1521",
},
},
{
name: "A30",
Cols: []string{
"A3001",
"A3004",
"A3007A",
"A3038",
},
},
{
name: "A33",
Cols: []string{
"A3310",
"A3321",
"A3321C",
"A3321D",
"A3322",
"A3323",
"A3331",
"A3332",
"A3333",
"A3350",
"A3360",
"A3361",
"A3362",
"A3371",
"A3372",
"A3381",
"A3382",
"A3385",
"A3321A",
"A3321B",
"A3321E",
"A3321F",
"A3333A",
"A3333B",
},
},
{
name: "A36",
Cols: []string{
"A3601",
"A3604A",
"A3607",
"A3627",
"A3611",
"SORTID",
},
},
{
name: "A57",
Cols: []string{
"A5714",
},
},
{
name: "A99Z1",
Cols: []string{
"A99Z101",
"A99Z102",
"A99Z103",
"A99Z104",
"A99Z191",
"A99Z195",
},
},
{
name: "B01",
Cols: []string{
"B0101",
"B0104",
"B0114",
"B0117",
"B0124",
"B0127",
"B0131",
"B0194",
"B0227",
"B0232",
"B0233",
"B0236",
"B0234",
"B0150",
"B0183",
"B0185",
"B0164",
"B0167",
"B0268",
"B0269",
"B0238",
"B0239",
"B0180",
"SORTID",
},
},
},
}
// 批量处理功能脚本
funcs = Funcs{
Sql: []Sqls{
/*{
name: "职务层次及职级主细同步",
Sql: []string{
"update a01 set a0221='',a0288='' where not exists(select 1 from a05 where a01.a0000=a05.a0000 and a0524='1' and A0531='0')",
"update a01 set a0192e='',a0192c='' where not exists(select 1 from a05 where a01.a0000=a05.a0000 and a0524='1' and A0531='1')",
"update a01,a05 set a0221=A0501B,a0288=A0504 where a01.a0000=a05.a0000 and a0524='1' and A0531='0'",
"update a01,a05 set a0192e=A0501B,a0192c=A0504 where a01.a0000=a05.a0000 and a0524='1' and A0531='1'",
},
},
{
name: "拼接政治面貌信息",
Sql: []string{
"update a01 set a0140=concat(substr(a0144,1,4),'.',substr(a0144,5,2)) where a0141 in('01','02') and (a0144 is not null or a0144 <> '')",
"update a01 set a0140=concat('(',(select code_name from code_value where code_type='GB4762' and code_value=a0141),')') where a0141 in(select code_value from code_value where code_type='GB4762' and code_value not in ('01','02'))",
},
},*/
},
}
}

32
golang_learn/data_func/go_to_windows/winView.go

@ -39,11 +39,16 @@ func GetWindows() error {
Text: "数据备份",
OnTriggered: dbBak,
},
/*Action{
// Image: "./image//huanyuan.png",
Text: "数据还原",
OnTriggered: reDbBak,
},*/
//Action{
// // Image: "./image//huanyuan.png",
// Text: "数据还原",
// OnTriggered: reDbBak,
//},
Action{
// Image: "./image//qinghuancun.png",
Text: "数据清洗",
OnTriggered: clearData,
},
Action{
// Image: "./image//tuichu.png",
Text: "退出",
@ -70,6 +75,23 @@ func GetWindows() error {
},
},
},
Menu{
Text: "&表册",
// Image: "./image//shezhi.png",
Items: []MenuItem{
Separator{},
Action{
// Image: "./image//shujuku.png",
Text: "按照职务输出生成(可能人员重复)",
OnTriggered: getMcByA0281,
},
Action{
// Image: "./image//yingyong.png",
Text: "按照主职务生成(可能人员丢失)",
OnTriggered: getMcByA0279,
},
},
},
Menu{
Text: "&帮助",
// Image: "./image//bangzhu.png",

Loading…
Cancel
Save