Merge branch 'master' of 10.10.14.250:huanghai/dsMin

master
huanghai 5 years ago
commit c211487568

@ -26,12 +26,11 @@ func GetDataaccessResults(query MySwagger.DataaccessQuery) (bool, string, int, [
conditionSql := fmt.Sprintf("%s", " limit ? offset ? ")
//分页的语句
pageSql := fmt.Sprintf("%s %s", sql, conditionSql)
//分页数据当前页现存条数
count, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().Count()
if count > 0 {
//分页数据
list, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
//数据条数
count, _ := DbUtil.Engine.SQL(sql).Query().Count()
//分页数据
list, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
if list != nil {
listJson, _ :=json.Marshal(list)
sql1 := "SELECT * FROM t_dataex_datasource WHERE 1 = 1"

@ -62,8 +62,6 @@ func GetDataaccessResults(swag MySwagger.DataaccessSwag) (bool, string, int, []m
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
} else {
conditions = append(conditions, "enable_flag='1'")
}
if swag.Page != 0 {
query.Page = swag.Page

@ -30,11 +30,11 @@ func GetDataerrorResults(query MySwagger.DataerrorQuery) (bool, string, int, []m
conditionSql := fmt.Sprintf("%s", " limit ? offset ? ")
//分页的语句
pageSql := fmt.Sprintf("%s %s", sql, conditionSql)
//分页数据当前页现存条数
count, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().Count()
if count > 0 {
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
//数据条数
count, _ := DbUtil.Engine.SQL(sql).Query().Count()
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
if list != nil {
return true, "数据获取成功", count, list, err
} else {
return false, "数据获取失败,数据源不存在", count, nil, nil

@ -32,8 +32,6 @@ func GetDataerrorResults(swag MySwagger.DataerrorSwag) (bool, string, int, []map
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
} else {
conditions = append(conditions, "enable_flag='1'")
}
if swag.Page != 0 {
query.Page = swag.Page

@ -22,11 +22,11 @@ func GetDatasourceResults(query MySwagger.DatasourceQuery) (bool, string, int, [
conditionSql := fmt.Sprintf("%s", " limit ? offset ? ")
//分页的语句
pageSql := fmt.Sprintf("%s %s", sql, conditionSql)
//分页数据当前页现存条数
count, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().Count()
if count > 0 {
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
//数据条数
count, _ := DbUtil.Engine.SQL(sql).Query().Count()
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
if list != nil {
return true, "数据获取成功", count, list, err
} else {
return false, "数据获取失败,数据源不存在", count, nil, nil

@ -66,8 +66,6 @@ func GetDatasourceResults(swag MySwagger.DatasourceSwag) (bool, string, int, []m
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
} else {
conditions = append(conditions, "enable_flag='1'")
}
if swag.Page != 0 {
//page = swag.Page

@ -19,12 +19,13 @@ import (
// @Failure 400 {object} MySwagger.Result
// @Router /v1/openapi/datastatistic/ReadESDocAmount [post]
func ReadESDocAmount(c *gin.Context) {
success, data := DatastatisticService.GetESDocCount()
success, message, count, data := DatastatisticService.GetESDocCount()
if success {
c.JSON(http.StatusOK, MySwagger.Result{
Success: true,
Fail: false,
Message: "",
Message: message,
Total: count,
Data: data,
})
@ -33,7 +34,7 @@ func ReadESDocAmount(c *gin.Context) {
c.JSON(http.StatusOK, MySwagger.Result{
Success: false,
Fail: true,
Message: "",
Message: message,
})
return

@ -1,64 +1,3 @@
<<<<<<< HEAD
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 (
@ -74,9 +13,10 @@ type ESDataContent struct {
OrgName string `json:"org_name"`
}
func GetESDocCount() (bool, []map[string]interface{}) {
func GetESDocCount() (bool, string, int, []map[string]interface{}) {
var datas []map[string]interface{}
var data map[string]interface{}
var count int
linksystems, c, _ := AccessSystemDao.ListApp("", 1, 1000)
if c > 0 {
@ -108,11 +48,13 @@ func GetESDocCount() (bool, []map[string]interface{}) {
//data["system_id"] = v["app_id"]
//data["num"] = num
//datas = append(datas, data)
//fmt.Println("len(datas):", len(datas))
}
count = len(datas)
} else {
return false, datas
return false, "数据获取失败, 找不到系统", count, datas
}
return true, datas
return true, "数据获取成功", count, datas
}
>>>>>>> ed13a56a674e22558c9fde7fef8d8bd7df80d00b

@ -21,11 +21,11 @@ func GetJyt2012Results(query MySwagger.Jyt2012Query) (bool, string, int, []map[s
conditionSql := fmt.Sprintf("%s", " limit ? offset ? ")
//分页的语句
pageSql := fmt.Sprintf("%s %s", sql, conditionSql)
//分页数据当前页现存条数
count, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().Count()
if count > 0 {
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
//数据条数
count, _ := DbUtil.Engine.SQL(sql).Query().Count()
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
if list != nil {
return true, "数据获取成功", count, list, err
} else {
return false, "数据获取失败,数据源不存在", count, nil, nil

@ -1,137 +1,3 @@
<<<<<<< HEAD
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 (
@ -179,8 +45,6 @@ func GetJyt2012Results(swag MySwagger.Jyt2012Swag) (bool, string, int, []map[str
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
} else {
conditions = append(conditions, "enable_flag='1'")
}
if swag.Page != 0 {
query.Page = swag.Page
@ -266,4 +130,4 @@ func IsJyt2012ExistsById(id string) bool {
return result
}
>>>>>>> 45f3e9adb8df950c7777dd7b3b0d45c245f98fa2

@ -21,11 +21,11 @@ func GetMetadataResults(query MySwagger.MetadataQuery) (bool, string, int, []map
conditionSql := fmt.Sprintf("%s", " limit ? offset ? ")
//分页的语句
pageSql := fmt.Sprintf("%s %s", sql, conditionSql)
//分页数据当前页现存条数
count, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().Count()
if count > 0 {
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
//数据条数
count, _ := DbUtil.Engine.SQL(sql).Query().Count()
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
if list != nil {
return true, "数据获取成功", count, list, err
} else {
return false, "数据获取失败,数据源不存在", count, nil, nil

@ -61,8 +61,6 @@ func GetMetadataResults(swag MySwagger.MetadataSwag) (bool, string, int, []map[s
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
} else {
conditions = append(conditions, "enable_flag='1'")
}
if swag.Page != 0 {
query.Page = swag.Page

@ -1,14 +1,3 @@
<<<<<<< HEAD
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 {
@ -18,5 +7,4 @@ type DatasourceESSwag struct {
Conditions map[string]interface{} `json:"conditions" example:"[{res_id:12300,res_name:初一语文一单元作业,teacher_id:123001,time_spend:100s}]"`
Sort map[string]interface{} `json:"sort" example:"[{res_id:12300,res_name:初一语文一单元作业,teacher_id:123001,time_spend:100s}]"`
Page int `json:"page" example:"1"`
>>>>>>> 45f3e9adb8df950c7777dd7b3b0d45c245f98fa2
}

@ -1,34 +1,3 @@
<<<<<<< HEAD
/**
* @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:
@ -58,4 +27,4 @@ type Jyt2012Swag struct {
EnableFlag int `json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)" example:"1"`
Page int `json:"page" example:"1"`
}
>>>>>>> 45f3e9adb8df950c7777dd7b3b0d45c245f98fa2

@ -5,6 +5,5 @@ type Result struct {
Fail bool `json:"fail" example:"false"`
Message string `json:"message" example:"操作成功"`
Total int `json:"total" example:"120"`
Count int `json:"total" example:"120"`
Data []map[string]interface{} `json:"data" `
}

@ -22,11 +22,11 @@ func GetOrgtreeResults(query MySwagger.OrgtreeQuery) (bool, string, int, []map[s
conditionSql := fmt.Sprintf("%s", " limit ? offset ? ")
//分页的语句
pageSql := fmt.Sprintf("%s %s", sql, conditionSql)
//分页数据当前页现存条数
count, _ := DbUtil.Engine.SQL(pageSql, limit, offset).Query().Count()
if count > 0 {
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
//数据条数
count, _ := DbUtil.Engine.SQL(sql).Query().Count()
//分页数据
list, err := DbUtil.Engine.SQL(pageSql, limit, offset).Query().List()
if list != nil {
return true, "数据获取成功", count, list, err
} else {
return false, "数据获取失败,数据源不存在", count, nil, nil

@ -7,6 +7,7 @@ import (
"dsSupport/Utils/CacheUtil"
"dsSupport/Utils/CommonUtil"
"dsSupport/models"
"fmt"
"html"
"strconv"
"strings"
@ -52,8 +53,6 @@ func GetOrgtreeResults(swag MySwagger.OrgtreeSwag) (bool, string, int, []map[str
}
if swag.EnableFlag != 0 {
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
} else {
conditions = append(conditions, "enable_flag='1'")
}
if swag.Page != 0 {
query.Page = swag.Page
@ -67,6 +66,7 @@ func GetOrgtreeResults(swag MySwagger.OrgtreeSwag) (bool, string, int, []map[str
condition = ""
}
query.Conditions = condition
fmt.Println(query.Conditions)
result, message, count, data, failResult := OrgtreeDAO.GetOrgtreeResults(query)

Loading…
Cancel
Save