master
huanghai 5 years ago
parent ad160682b0
commit 5bf8f2ce0f

@ -1,59 +1,59 @@
package DatastatisticService
import (
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
"dsSupport/MyModel/DataSource/DatasourceService"
"dsSupport/MyModel/MySwagger"
"dsSupport/Utils/ES7Util"
"fmt"
)
type ESDataContent struct {
Address string `json:"address"`
AreaCode string `json:"area_code"`
OrgName string `json:"org_name"`
}
func GetESDocCount() (bool, []map[string]interface{}) {
var datas []map[string]interface{}
var data map[string]interface{}
linksystems, c, _ := AccessSystemDao.ListApp("", 1, 1000)
if c > 0 {
for _, v := range linksystems {
var num int64 = 0
var sw MySwagger.DatasourceSwag
sw.SystemId = v["app_id"].(string)
rr, _, _, datasources, _ := DatasourceService.GetDatasourceResults(sw)
if rr == true {
for _, vv := range datasources {
fmt.Println(vv["datasource_code"])
fmt.Println(vv["datasource_name"])
result, _ := ES7Util.GetDocCount(vv["datasource_code"].(string))
num += result
_, _, esdata := ES7Util.GetLatestDoc(vv["datasource_code"].(string))
fmt.Println(esdata.BeginTime)
data = make(map[string]interface{})
data["system_name"] = v["app_name"]
data["system_id"] = v["app_id"]
data["datasource_code"] = vv["datasource_code"]
data["datasource_name"] = vv["datasource_name"]
data["storage_time"] = esdata.BeginTime
data["num"] = result
datas = append(datas, data)
}
}
//data = make(map[string]interface{})
//data["system_name"] = v["app_name"]
//data["system_id"] = v["app_id"]
//data["num"] = num
//datas = append(datas, data)
}
} else {
return false, datas
}
return true, datas
}
package DatastatisticService
import (
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
"dsSupport/MyModel/DataSource/DatasourceService"
"dsSupport/MyModel/MySwagger"
"dsSupport/Utils/ES7Util"
"fmt"
)
type ESDataContent struct {
Address string `json:"address"`
AreaCode string `json:"area_code"`
OrgName string `json:"org_name"`
}
func GetESDocCount() (bool, []map[string]interface{}) {
var datas []map[string]interface{}
var data map[string]interface{}
linksystems, c, _ := AccessSystemDao.ListApp("", 1, 1000)
if c > 0 {
for _, v := range linksystems {
var num int64 = 0
var sw MySwagger.DatasourceSwag
sw.SystemId = v["app_id"].(string)
rr, _, _, datasources, _ := DatasourceService.GetDatasourceResults(sw)
if rr == true {
for _, vv := range datasources {
fmt.Println(vv["datasource_code"])
fmt.Println(vv["datasource_name"])
result, _ := ES7Util.GetDocCount(vv["datasource_code"].(string))
num += result
_, _, esdata := ES7Util.GetLatestDoc(vv["datasource_code"].(string))
fmt.Println(esdata.BeginTime)
data = make(map[string]interface{})
data["system_name"] = v["app_name"]
data["system_id"] = v["app_id"]
data["datasource_code"] = vv["datasource_code"]
data["datasource_name"] = vv["datasource_name"]
data["storage_time"] = esdata.BeginTime
data["num"] = result
datas = append(datas, data)
}
}
//data = make(map[string]interface{})
//data["system_name"] = v["app_name"]
//data["system_id"] = v["app_id"]
//data["num"] = num
//datas = append(datas, data)
}
} else {
return false, datas
}
return true, datas
}

@ -1,132 +1,132 @@
package Jyt2012Service
import (
"dsSupport/MyModel/JYT2012/Jyt2012DAO"
"dsSupport/MyModel/MySwagger"
"dsSupport/Utils/CacheUtil"
"dsSupport/Utils/CommonUtil"
"dsSupport/models"
"html"
"strconv"
"strings"
"time"
)
func GetJyt2012Results(swag MySwagger.Jyt2012Swag) (bool, string, int32, []map[string]interface{}, error) {
var condition string
var conditions []string
var page int
var query MySwagger.Jyt2012Query
if swag.DicName != "" {
conditions = append(conditions, "dic_name="+"'"+html.EscapeString(swag.DicName)+"'")
}
if swag.DicValue != "" {
conditions = append(conditions, "dic_value="+"'"+html.EscapeString(swag.DicValue)+"'")
}
if swag.DicType != 0 {
conditions = append(conditions, "dic_type="+"'"+strconv.Itoa(swag.DicType)+"'")
}
if swag.DicInfo != "" {
conditions = append(conditions, "dic_info="+"'"+html.EscapeString(swag.DicInfo)+"'")
}
if swag.RootFlag != 0 {
conditions = append(conditions, "root_flag="+"'"+strconv.Itoa(swag.RootFlag)+"'")
}
if swag.JytFlag != 0 {
conditions = append(conditions, "jyt_flag="+"'"+strconv.Itoa(swag.JytFlag)+"'")
}
if swag.ParentId != "" {
conditions = append(conditions, "parent_id="+"'"+html.EscapeString(swag.ParentId)+"'")
}
if swag.DeleteFlag != 0 {
conditions = append(conditions, "delete_flag="+"'"+strconv.Itoa(swag.DeleteFlag)+"'")
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
}
if swag.Page != 0 {
page = swag.Page
query.Page = (page - 1) * 100
} else {
query.Page = 0
}
if len(conditions) > 0 {
condition = " AND " + strings.Join(conditions, " AND ")
} else {
condition = ""
}
query.Conditions = condition
result, message, count, data, failResult := Jyt2012DAO.GetJyt2012Results(query)
return result, message, count, data, failResult
}
func CreateJyt2012(model models.TDataexJyt2012) (bool, string, error) {
business := new(models.TDataexJyt2012)
business.Id = CommonUtil.GetUUID()
business.DicName = html.EscapeString(model.DicName)
business.DicValue = html.EscapeString(model.DicValue)
business.DicType = model.DicType
business.DicInfo = html.EscapeString(model.DicInfo)
business.RootFlag = model.RootFlag
business.JytFlag = model.JytFlag
business.ParentId = html.EscapeString(model.ParentId)
business.CreateTime = time.Now()
business.DeleteFlag = -1
business.EnableFlag = 1
result, message, error := Jyt2012DAO.CreateJyt2012(business)
return result, message, error
}
func UpdateJyt2012(id string, model models.TDataexJyt2012) (bool, string, error) {
business := new(models.TDataexJyt2012)
//清除Redis缓存
var ids = []string{id}
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
CacheUtil.DeleteCacheByIds(ids, selector)
business.ChangeTime = time.Now()
business.DicName = html.EscapeString(model.DicName)
business.DicValue = html.EscapeString(model.DicValue)
business.DicType = model.DicType
business.DicInfo = html.EscapeString(model.DicInfo)
business.RootFlag = model.RootFlag
business.JytFlag = model.JytFlag
business.ParentId = html.EscapeString(model.ParentId)
business.EnableFlag = model.EnableFlag
result, message, error := Jyt2012DAO.UpdateJyt2012(id, business)
return result, message, error
}
func RemoveJyt2012(id string) (bool, string, error) {
business := new(models.TDataexJyt2012)
//清除Redis缓存
var ids = []string{id}
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
CacheUtil.DeleteCacheByIds(ids, selector)
business.Id = html.EscapeString(id)
business.ChangeTime = time.Now()
business.DeleteTime = time.Now()
business.DeleteFlag = 1
business.EnableFlag = -1
result, message, error := Jyt2012DAO.RemoveJyt2012(id, business)
return result, message, error
}
func IsJyt2012ExistsById(id string) bool {
result := Jyt2012DAO.IsJyt2012ExistsById(id)
return result
}
package Jyt2012Service
import (
"dsSupport/MyModel/JYT2012/Jyt2012DAO"
"dsSupport/MyModel/MySwagger"
"dsSupport/Utils/CacheUtil"
"dsSupport/Utils/CommonUtil"
"dsSupport/models"
"html"
"strconv"
"strings"
"time"
)
func GetJyt2012Results(swag MySwagger.Jyt2012Swag) (bool, string, int32, []map[string]interface{}, error) {
var condition string
var conditions []string
var page int
var query MySwagger.Jyt2012Query
if swag.DicName != "" {
conditions = append(conditions, "dic_name="+"'"+html.EscapeString(swag.DicName)+"'")
}
if swag.DicValue != "" {
conditions = append(conditions, "dic_value="+"'"+html.EscapeString(swag.DicValue)+"'")
}
if swag.DicType != 0 {
conditions = append(conditions, "dic_type="+"'"+strconv.Itoa(swag.DicType)+"'")
}
if swag.DicInfo != "" {
conditions = append(conditions, "dic_info="+"'"+html.EscapeString(swag.DicInfo)+"'")
}
if swag.RootFlag != 0 {
conditions = append(conditions, "root_flag="+"'"+strconv.Itoa(swag.RootFlag)+"'")
}
if swag.JytFlag != 0 {
conditions = append(conditions, "jyt_flag="+"'"+strconv.Itoa(swag.JytFlag)+"'")
}
if swag.ParentId != "" {
conditions = append(conditions, "parent_id="+"'"+html.EscapeString(swag.ParentId)+"'")
}
if swag.DeleteFlag != 0 {
conditions = append(conditions, "delete_flag="+"'"+strconv.Itoa(swag.DeleteFlag)+"'")
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
}
if swag.Page != 0 {
page = swag.Page
query.Page = (page - 1) * 100
} else {
query.Page = 0
}
if len(conditions) > 0 {
condition = " AND " + strings.Join(conditions, " AND ")
} else {
condition = ""
}
query.Conditions = condition
result, message, count, data, failResult := Jyt2012DAO.GetJyt2012Results(query)
return result, message, count, data, failResult
}
func CreateJyt2012(model models.TDataexJyt2012) (bool, string, error) {
business := new(models.TDataexJyt2012)
business.Id = CommonUtil.GetUUID()
business.DicName = html.EscapeString(model.DicName)
business.DicValue = html.EscapeString(model.DicValue)
business.DicType = model.DicType
business.DicInfo = html.EscapeString(model.DicInfo)
business.RootFlag = model.RootFlag
business.JytFlag = model.JytFlag
business.ParentId = html.EscapeString(model.ParentId)
business.CreateTime = time.Now()
business.DeleteFlag = -1
business.EnableFlag = 1
result, message, error := Jyt2012DAO.CreateJyt2012(business)
return result, message, error
}
func UpdateJyt2012(id string, model models.TDataexJyt2012) (bool, string, error) {
business := new(models.TDataexJyt2012)
//清除Redis缓存
var ids = []string{id}
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
CacheUtil.DeleteCacheByIds(ids, selector)
business.ChangeTime = time.Now()
business.DicName = html.EscapeString(model.DicName)
business.DicValue = html.EscapeString(model.DicValue)
business.DicType = model.DicType
business.DicInfo = html.EscapeString(model.DicInfo)
business.RootFlag = model.RootFlag
business.JytFlag = model.JytFlag
business.ParentId = html.EscapeString(model.ParentId)
business.EnableFlag = model.EnableFlag
result, message, error := Jyt2012DAO.UpdateJyt2012(id, business)
return result, message, error
}
func RemoveJyt2012(id string) (bool, string, error) {
business := new(models.TDataexJyt2012)
//清除Redis缓存
var ids = []string{id}
var selector = CacheUtil.GetBean("t_dataex_jyt2012")
CacheUtil.DeleteCacheByIds(ids, selector)
business.Id = html.EscapeString(id)
business.ChangeTime = time.Now()
business.DeleteTime = time.Now()
business.DeleteFlag = 1
business.EnableFlag = -1
result, message, error := Jyt2012DAO.RemoveJyt2012(id, business)
return result, message, error
}
func IsJyt2012ExistsById(id string) bool {
result := Jyt2012DAO.IsJyt2012ExistsById(id)
return result
}

@ -1,19 +1,19 @@
package MySwagger
import "time"
type DataaccessSwag struct {
DatasourceId string `json:"datasource_id" xorm:"not null comment('数据源ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
SourceSystemid string `json:"consume_systemid" xorm:"not null comment('源系统ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
ConsumeSystemid string `json:"consume_systemid" xorm:"not null comment('数据使用系统ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
QueryFlag int `json:"query_flag" xorm:"not null default 1 comment('可查【1-1否】') INT(11)" example:"1"`
SetFlag int `json:"set_flag" xorm:"not null default -1 comment('可修改【1-1否】') INT(11)" example:"1"`
ConsumeType int `json:"consume_type" xorm:"not null comment('使用数据范围【1本机构2本机构以及下属机构-1不限制】') INT(11)" example:"-1"`
ConsumeOrgid string `json:"consume_orgid" xorm:"not null comment('使用数据机构ID【-1不限制】') index VARCHAR(36)" example:"-1"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-22 17:26:53"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
package MySwagger
import "time"
type DataaccessSwag struct {
DatasourceId string `json:"datasource_id" xorm:"not null comment('数据源ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
SourceSystemid string `json:"consume_systemid" xorm:"not null comment('源系统ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
ConsumeSystemid string `json:"consume_systemid" xorm:"not null comment('数据使用系统ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
QueryFlag int `json:"query_flag" xorm:"not null default 1 comment('可查【1-1否】') INT(11)" example:"1"`
SetFlag int `json:"set_flag" xorm:"not null default -1 comment('可修改【1-1否】') INT(11)" example:"1"`
ConsumeType int `json:"consume_type" xorm:"not null comment('使用数据范围【1本机构2本机构以及下属机构-1不限制】') INT(11)" example:"-1"`
ConsumeOrgid string `json:"consume_orgid" xorm:"not null comment('使用数据机构ID【-1不限制】') index VARCHAR(36)" example:"-1"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-22 17:26:53"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -1,20 +1,20 @@
package MySwagger
import (
"time"
)
type DataerrorSwag struct {
SystemId string `json:"system_id" xorm:"not null comment('数据提供系统ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DatasourceId string `json:"datasource_id" xorm:"not null comment('数据源ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
OrgId string `json:"org_id" xorm:"not null comment('数据机构ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DataId string `json:"data_id" xorm:"not null comment('数据ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DataContent string `json:"data_content" xorm:"default 'NULL' comment('数据内容【Json格式输入参数】') VARCHAR" example:""`
FileUri string `json:"file_uri" xorm:"default 'NULL' comment('文件地址【文件交换】') VARCHAR(500)" example:"/file/url/"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-22 17:26:53"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-22 17:26:53"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}
package MySwagger
import (
"time"
)
type DataerrorSwag struct {
SystemId string `json:"system_id" xorm:"not null comment('数据提供系统ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DatasourceId string `json:"datasource_id" xorm:"not null comment('数据源ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
OrgId string `json:"org_id" xorm:"not null comment('数据机构ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DataId string `json:"data_id" xorm:"not null comment('数据ID【输入参数】') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DataContent string `json:"data_content" xorm:"default 'NULL' comment('数据内容【Json格式输入参数】') VARCHAR" example:""`
FileUri string `json:"file_uri" xorm:"default 'NULL' comment('文件地址【文件交换】') VARCHAR(500)" example:"/file/url/"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-22 17:26:53"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-22 17:26:53"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -1,10 +1,10 @@
package MySwagger
type DatasourceESSwag struct {
DatasourceCode string `json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree"`
OrgIDs []string `json:"orgids" xorm:"not null comment('提供数据范围【1本机构2本机构以及下属机构-1不限制】') VARCHAR(36)" example:""`
BeginTime string `json:"begin_time" example:"2020-06-22 17:26:53"`
Conditions map[string]interface{} `json:"conditions" example:""`
Sort map[string]interface{} `json:"sort" example:""`
Page int `json:"page" example:"1"`
package MySwagger
type DatasourceESSwag struct {
DatasourceCode string `json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree"`
OrgIDs []string `json:"orgids" xorm:"not null comment('提供数据范围【1本机构2本机构以及下属机构-1不限制】') VARCHAR(36)" example:""`
BeginTime string `json:"begin_time" example:"2020-06-22 17:26:53"`
Conditions map[string]interface{} `json:"conditions" example:""`
Sort map[string]interface{} `json:"sort" example:""`
Page int `json:"page" example:"1"`
}

@ -1,17 +1,17 @@
package MySwagger
type DatasourceSwag struct {
SystemId string `json:"system_id" xorm:"not null comment('数据提供系统ID【外键】') index VARCHAR(36)" example:"1C0F6832-65C6-4888-BDDE-A3373B11499D"`
DatasourceName string `json:"datasource_name" xorm:"not null comment('数据源名称') VARCHAR(100)" example:"组织机构信息"`
DatasourceCode string `json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree"`
DatasourceDetail string `json:"datasource_detail" xorm:"default 'NULL' comment('数据源说明') VARCHAR(500)" example:"教育主管单位、教辅单位、各级各类学校机构信息"`
SetFlag int `json:"set_flag" xorm:"not null default 1 comment('可修改【1-1否】') INT(11)" example:"1"`
CollectFlag int `json:"collect_flag" xorm:"not null default 1 comment('可汇集【1-1否】') INT(11)" example:"1"`
ProvideType int `json:"provide_type" xorm:"not null comment('提供数据范围【1本机构2本机构以及下属机构-1不限制】') INT(11)" example:"2"`
ProvideOrgid string `json:"provide_orgid" xorm:"not null comment('提供数据机构ID【-1不限制】') index VARCHAR(36)" example:"-1"`
DatastoreType int `json:"datastore_type" xorm:"not null comment('数据存储类型【1DB2ES3Kafka】') INT(11)" example:"2"`
DicId string `json:"dic_id, omitempty" xorm:"default 'NULL' comment('数据字典ID') index VARCHAR(36)" example:"1C0F6832-65C6-4888-BDDE-A3373B11499D"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
package MySwagger
type DatasourceSwag struct {
SystemId string `json:"system_id" xorm:"not null comment('数据提供系统ID【外键】') index VARCHAR(36)" example:"1C0F6832-65C6-4888-BDDE-A3373B11499D"`
DatasourceName string `json:"datasource_name" xorm:"not null comment('数据源名称') VARCHAR(100)" example:"组织机构信息"`
DatasourceCode string `json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree"`
DatasourceDetail string `json:"datasource_detail" xorm:"default 'NULL' comment('数据源说明') VARCHAR(500)" example:"教育主管单位、教辅单位、各级各类学校机构信息"`
SetFlag int `json:"set_flag" xorm:"not null default 1 comment('可修改【1-1否】') INT(11)" example:"1"`
CollectFlag int `json:"collect_flag" xorm:"not null default 1 comment('可汇集【1-1否】') INT(11)" example:"1"`
ProvideType int `json:"provide_type" xorm:"not null comment('提供数据范围【1本机构2本机构以及下属机构-1不限制】') INT(11)" example:"2"`
ProvideOrgid string `json:"provide_orgid" xorm:"not null comment('提供数据机构ID【-1不限制】') index VARCHAR(36)" example:"-1"`
DatastoreType int `json:"datastore_type" xorm:"not null comment('数据存储类型【1DB2ES3Kafka】') INT(11)" example:"2"`
DicId string `json:"dic_id, omitempty" xorm:"default 'NULL' comment('数据字典ID') index VARCHAR(36)" example:"1C0F6832-65C6-4888-BDDE-A3373B11499D"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -1,29 +1,29 @@
/**
* @Title:
* @Description:
* @Author: Yuki Wong(iyuki0430@msn.com)
* @Update:
* @Date: 2020/7/9 10:24
* @File: Jyt2012Swag.go
* @Software: GoLand
**/
package MySwagger
import "time"
type Jyt2012Swag struct {
Id string `json:"id" xorm:"not null pk comment('ID') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DicName string `json:"dic_name" xorm:"not null comment('字典/字典项名称') VARCHAR(100)" example:"sex"`
DicValue string `json:"dic_name" xorm:"not null comment('字典/字典项值') VARCHAR(100)" example:"10"`
DicType int `json:"dic_type" xorm:"not null default 1 comment('字典类型【1国标数据、关联数据源2国标字典、关联元数据】') INT(11)" example:"1"`
DicInfo string `json:"dic_info" xorm:"default ''NULL'' comment('字典项说明') VARCHAR(500)" example:"我是字典项说明"`
RootFlag int `json:"root_flag" xorm:"not null default -1 comment('是否是字典【1-1否】') INT(11)" example:"1"`
JytFlag int `json:"jyt_flag" xorm:"not null default 1 comment('是否国标【1-1自定义】') INT(11)" example:"1"`
ParentId string `json:"parent_id" xorm:"default ''NULL'' comment('字典ID【字典项父节点】') VARCHAR(36)" example:"38BD0DB-0142-4356-8F2B-623813FC2578"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-22 17:26:53"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}
/**
* @Title:
* @Description:
* @Author: Yuki Wong(iyuki0430@msn.com)
* @Update:
* @Date: 2020/7/9 10:24
* @File: Jyt2012Swag.go
* @Software: GoLand
**/
package MySwagger
import "time"
type Jyt2012Swag struct {
Id string `json:"id" xorm:"not null pk comment('ID') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DicName string `json:"dic_name" xorm:"not null comment('字典/字典项名称') VARCHAR(100)" example:"sex"`
DicValue string `json:"dic_name" xorm:"not null comment('字典/字典项值') VARCHAR(100)" example:"10"`
DicType int `json:"dic_type" xorm:"not null default 1 comment('字典类型【1国标数据、关联数据源2国标字典、关联元数据】') INT(11)" example:"1"`
DicInfo string `json:"dic_info" xorm:"default ''NULL'' comment('字典项说明') VARCHAR(500)" example:"我是字典项说明"`
RootFlag int `json:"root_flag" xorm:"not null default -1 comment('是否是字典【1-1否】') INT(11)" example:"1"`
JytFlag int `json:"jyt_flag" xorm:"not null default 1 comment('是否国标【1-1自定义】') INT(11)" example:"1"`
ParentId string `json:"parent_id" xorm:"default ''NULL'' comment('字典ID【字典项父节点】') VARCHAR(36)" example:"38BD0DB-0142-4356-8F2B-623813FC2578"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-22 17:26:53"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-22 17:26:53"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -1,13 +1,13 @@
package MySwagger
type LinksystemSwag struct {
SystemName string `json:"system_name" xorm:"not null comment('系统名称') VARCHAR(100)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
SystemCode string `json:"system_code" xorm:"not null default ''NULL'' comment('系统编码【可读的缩写平台内统一使用code】') VARCHAR(36)" example:"BASE_JAVA"`
SystemType int `json:"system_type" xorm:"not null comment('系统类型【1基础数据、2管理平台、3资源平台、4学科工具】') INT(11)" example:"1"`
SystemKey string `json:"system_key" xorm:"not null comment('系统密钥【必须保密】') VARCHAR(36)" example:"8971966b-ac44-11ea-bd48-f48e38f73cf7"`
CollectFlag int `json:"collect_flag" xorm:"not null default -1 comment('数据汇集标志【默认-11启动汇集-1关闭汇集】') INT(11)" example:"1"`
ProviderName string `json:"provider_name" xorm:"default ''NULL'' comment('厂商名称') VARCHAR(10)" example:"东师理想"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
package MySwagger
type LinksystemSwag struct {
SystemName string `json:"system_name" xorm:"not null comment('系统名称') VARCHAR(100)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
SystemCode string `json:"system_code" xorm:"not null default ''NULL'' comment('系统编码【可读的缩写平台内统一使用code】') VARCHAR(36)" example:"BASE_JAVA"`
SystemType int `json:"system_type" xorm:"not null comment('系统类型【1基础数据、2管理平台、3资源平台、4学科工具】') INT(11)" example:"1"`
SystemKey string `json:"system_key" xorm:"not null comment('系统密钥【必须保密】') VARCHAR(36)" example:"8971966b-ac44-11ea-bd48-f48e38f73cf7"`
CollectFlag int `json:"collect_flag" xorm:"not null default -1 comment('数据汇集标志【默认-11启动汇集-1关闭汇集】') INT(11)" example:"1"`
ProviderName string `json:"provider_name" xorm:"default ''NULL'' comment('厂商名称') VARCHAR(10)" example:"东师理想"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -1,5 +1,5 @@
package MySwagger
type MetadataESSwag struct {
IndexName string `json:"index_name" xorm:"not null comment('ES Index Name') VARCHAR(50)" example:"org_tree"`
package MySwagger
type MetadataESSwag struct {
IndexName string `json:"index_name" xorm:"not null comment('ES Index Name') VARCHAR(50)" example:"org_tree"`
}

@ -1,20 +1,20 @@
package MySwagger
type MetadataSwag struct {
Id string `json:"id" xorm:"not null pk comment('ID') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DatasourceId string `json:"datasource_id" xorm:"default ''NULL'' comment('数据源ID') index VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
ItemName string `json:"item_name" xorm:"not null comment('数据项名称【英文】') VARCHAR(50)" example:"org_name"`
DicId string `json:"dic_id" xorm:"default ''NULL'' comment('数据字典ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
ItemType string `json:"item_type" xorm:"default ''NULL'' comment('数据项类型【1整数、2浮点、3字符、4布尔、5日期、6时间、7日期+时间】') VARCHAR(50)" example:"string"`
ItemLength int `json:"item_length" xorm:"default NULL comment('数据最大长度【UTF-8 字符长度】') INT(11)" example:"36"`
ItemPattern string `json:"item_pattern" xorm:"default 'NULL' comment('数据项模式') VARCHAR(255)" example:""`
ItemInfo string `json:"item_info" xorm:"not null comment('数据项说明') VARCHAR(50)" example:"我是数据项说明"`
CheckName int `json:"check_name" xorm:"not null default -1 comment('是否检测名称【1-1否】') INT(11)" example:"1"`
CheckDic int `json:"check_dic" xorm:"not null default -1 comment('是否检测字典') INT(11)" example:"1"`
CheckType int `json:"check_type" xorm:"not null default -1 comment('是否检测类型') INT(11)" example:"1"`
CheckPattern int `json:"check_pattern" xorm:"not null default -1 comment('是否检测模式') INT(11)" example:"1"`
CheckExist int `json:"check_exist" xorm:"not null default -1 comment('是否检测必填') INT(11)" example:"1"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
package MySwagger
type MetadataSwag struct {
Id string `json:"id" xorm:"not null pk comment('ID') VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
DatasourceId string `json:"datasource_id" xorm:"default ''NULL'' comment('数据源ID') index VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
ItemName string `json:"item_name" xorm:"not null comment('数据项名称【英文】') VARCHAR(50)" example:"org_name"`
DicId string `json:"dic_id" xorm:"default ''NULL'' comment('数据字典ID') index VARCHAR(36)" example:"F38BD0DB-0142-4356-8F2B-623813FC2578"`
ItemType string `json:"item_type" xorm:"default ''NULL'' comment('数据项类型【1整数、2浮点、3字符、4布尔、5日期、6时间、7日期+时间】') VARCHAR(50)" example:"string"`
ItemLength int `json:"item_length" xorm:"default NULL comment('数据最大长度【UTF-8 字符长度】') INT(11)" example:"36"`
ItemPattern string `json:"item_pattern" xorm:"default 'NULL' comment('数据项模式') VARCHAR(255)" example:""`
ItemInfo string `json:"item_info" xorm:"not null comment('数据项说明') VARCHAR(50)" example:"我是数据项说明"`
CheckName int `json:"check_name" xorm:"not null default -1 comment('是否检测名称【1-1否】') INT(11)" example:"1"`
CheckDic int `json:"check_dic" xorm:"not null default -1 comment('是否检测字典') INT(11)" example:"1"`
CheckType int `json:"check_type" xorm:"not null default -1 comment('是否检测类型') INT(11)" example:"1"`
CheckPattern int `json:"check_pattern" xorm:"not null default -1 comment('是否检测模式') INT(11)" example:"1"`
CheckExist int `json:"check_exist" xorm:"not null default -1 comment('是否检测必填') INT(11)" example:"1"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -1,22 +1,22 @@
package MySwagger
import "time"
type OrgtreeSwag struct {
Id string `json:"id" xorm:"not null pk comment('ID【根节点默认为-1】') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
OrgName string `json:"org_name" xorm:"not null comment('机构名称') VARCHAR(100)" example:"开平区教育局"`
OrgType int `json:"org_type" xorm:"not null comment('机构类型【1教育局、2学校、3教辅单位、4大学区、5部门、6、主校7、学段、8年级、9班级】') INT(11)" example:"1"`
ParentId string `json:"parent_id" xorm:"default ''NULL'' comment('父节点ID') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
CatId string `json:"cat_id" xorm:"not null comment('层级ID【4位数字一组、右侧多级累加】') VARCHAR(100)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
ProvinceId string `json:"province_id" xorm:"default 'NULL' comment('省编码') VARCHAR(6)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
CityId string `json:"city_id" xorm:"default 'NULL' comment('地市编码') VARCHAR(6)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
AreaId string `json:"area_id" xorm:"default 'NULL' comment('县区编码') VARCHAR(6)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
LinksystemId string `json:"linksystem_id" xorm:"default 'NULL' comment('源业务系统') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
LinkId string `json:"link_id" xorm:"default 'NULL' comment('业务系统机构原ID') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-11 09:19:26"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-11 09:19:26"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-11 09:19:26"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}
package MySwagger
import "time"
type OrgtreeSwag struct {
Id string `json:"id" xorm:"not null pk comment('ID【根节点默认为-1】') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
OrgName string `json:"org_name" xorm:"not null comment('机构名称') VARCHAR(100)" example:"开平区教育局"`
OrgType int `json:"org_type" xorm:"not null comment('机构类型【1教育局、2学校、3教辅单位、4大学区、5部门、6、主校7、学段、8年级、9班级】') INT(11)" example:"1"`
ParentId string `json:"parent_id" xorm:"default ''NULL'' comment('父节点ID') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
CatId string `json:"cat_id" xorm:"not null comment('层级ID【4位数字一组、右侧多级累加】') VARCHAR(100)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
ProvinceId string `json:"province_id" xorm:"default 'NULL' comment('省编码') VARCHAR(6)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
CityId string `json:"city_id" xorm:"default 'NULL' comment('地市编码') VARCHAR(6)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
AreaId string `json:"area_id" xorm:"default 'NULL' comment('县区编码') VARCHAR(6)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
LinksystemId string `json:"linksystem_id" xorm:"default 'NULL' comment('源业务系统') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
LinkId string `json:"link_id" xorm:"default 'NULL' comment('业务系统机构原ID') VARCHAR(36)" example:"0383FF67-CCBA-4256-891E-BAFD487547FA"`
CreateTime time.Time `json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME" example:"2020-06-11 09:19:26"`
ChangeTime time.Time `json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME" example:"2020-06-11 09:19:26"`
DeleteTime time.Time `json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME" example:"2020-06-11 09:19:26"`
DeleteFlag int `json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)" example:"1"`
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}

@ -0,0 +1,46 @@
package main
import (
"dsSupport/Utils/CommonUtil"
"dsSupport/Utils/DbUtil"
"fmt"
)
var db = DbUtil.Engine
func main() {
//1、读取每一张需要创建的表
sql := "select * from t_dw_table"
list, _ := db.SQL(sql).Query().List()
for i := range list {
tableId := list[i]["table_id"].(int64)
tableName := list[i]["table_name"].(string)
createTableSql := `DROP TABLE IF EXISTS "public"."` + tableName + `";`+"\r\n"
createTableSql += `CREATE TABLE "public"."` + tableName + `" (`+"\r\n"
//2、根据表名获取相应的创建表的信息
sql = `select * from t_dw_table_field where table_id=?`
list2, _ := db.SQL(sql, tableId).Query().List()
for i2 := range list2 {
dataType := list2[i2]["data_type"].(string)
fieldLength := list2[i2]["field_length"].(int64)
isNull := list2[i2]["is_null"].(int64)
var c = ""
if dataType == "int" {
c = "int" + CommonUtil.ConvertInt64ToString(fieldLength)
} else {
c = dataType + "(" + CommonUtil.ConvertInt64ToString(fieldLength) + ") " + ` COLLATE "pg_catalog"."default" `
}
if isNull==1{
c+="NOT NULL,"
}else{
if i2< len(list2)-1{
c+=","
}
}
createTableSql += `"` + list2[i2]["field_name"].(string) + `" ` + c+"\r\n"
}
createTableSql += `);`+"\r\n"
fmt.Println(createTableSql)
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -98,6 +98,7 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@ -129,6 +130,7 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.12.0 h1:/f3b24xrDhkhddlaobPe2JgBqfdt+gC/NYl0QY9IOuI=
github.com/pkg/sftp v1.12.0/go.mod h1:fUqqXB5vEgVCZ131L+9say31RAri6aF6KDViawhxKK8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@ -170,6 +172,7 @@ github.com/xormplus/xorm v0.0.0-20200731130200-6811f3bde592 h1:uZkSqOig4izJR611D
github.com/xormplus/xorm v0.0.0-20200731130200-6811f3bde592/go.mod h1:+v6b10b4x5IcQmp1/Cbo9IqaknxVeuhQng+fhya6bdI=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=

Loading…
Cancel
Save