|
|
|
@ -15,39 +15,39 @@ import (
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetDataaccessResults (swag MySwagger.DataaccessSwag) (bool, string, int32, []map[string]interface{}, error) {
|
|
|
|
|
var condition string
|
|
|
|
|
var conditions []string
|
|
|
|
|
var page int
|
|
|
|
|
func GetDataaccessResults(swag MySwagger.DataaccessSwag) (bool, string, int32, []map[string]interface{}, error) {
|
|
|
|
|
var condition string
|
|
|
|
|
var conditions []string
|
|
|
|
|
var page int
|
|
|
|
|
var query MySwagger.DataaccessQuery
|
|
|
|
|
|
|
|
|
|
if swag.DatasourceId != "" {
|
|
|
|
|
conditions = append(conditions, "datasource_id=" + "'" + html.EscapeString(swag.DatasourceId) + "'")
|
|
|
|
|
conditions = append(conditions, "datasource_id="+"'"+html.EscapeString(swag.DatasourceId)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.ConsumeSystemid != "" {
|
|
|
|
|
conditions = append(conditions, "consume_systemid=" + "'" + html.EscapeString(swag.ConsumeSystemid) + "'")
|
|
|
|
|
conditions = append(conditions, "consume_systemid="+"'"+html.EscapeString(swag.ConsumeSystemid)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.QueryFlag != 0 {
|
|
|
|
|
conditions = append(conditions, "query_flag=" + "'" + strconv.Itoa(swag.QueryFlag) + "'")
|
|
|
|
|
conditions = append(conditions, "query_flag="+"'"+strconv.Itoa(swag.QueryFlag)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.SetFlag != 0 {
|
|
|
|
|
conditions = append(conditions, "item_length=" + "'" + strconv.Itoa(swag.SetFlag) + "'")
|
|
|
|
|
conditions = append(conditions, "set_flag="+"'"+strconv.Itoa(swag.SetFlag)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.ConsumeType != 0 {
|
|
|
|
|
conditions = append(conditions, "item_pattern=" + "'" + strconv.Itoa(swag.ConsumeType) + "'")
|
|
|
|
|
conditions = append(conditions, "consume_type="+"'"+strconv.Itoa(swag.ConsumeType)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.ConsumeOrgid != "" {
|
|
|
|
|
conditions = append(conditions, "item_info=" + "'" + html.EscapeString(swag.ConsumeOrgid) + "'")
|
|
|
|
|
conditions = append(conditions, "consume_orgid="+"'"+html.EscapeString(swag.ConsumeOrgid)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.DeleteFlag != 0 {
|
|
|
|
|
conditions = append(conditions, "delete_flag=" + "'" + strconv.Itoa(swag.DeleteFlag) + "'")
|
|
|
|
|
conditions = append(conditions, "delete_flag="+"'"+strconv.Itoa(swag.DeleteFlag)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.EnableFlag != 0 {
|
|
|
|
|
conditions = append(conditions, "check_dic=" + "'" + strconv.Itoa(swag.EnableFlag) + "'")
|
|
|
|
|
conditions = append(conditions, "enable_flag="+"'"+strconv.Itoa(swag.EnableFlag)+"'")
|
|
|
|
|
}
|
|
|
|
|
if swag.Page != 0 {
|
|
|
|
|
page = swag.Page
|
|
|
|
|
query.Page = (page -1) * 100
|
|
|
|
|
query.Page = (page - 1) * 100
|
|
|
|
|
} else {
|
|
|
|
|
query.Page = 0
|
|
|
|
|
}
|
|
|
|
@ -59,21 +59,19 @@ func GetDataaccessResults (swag MySwagger.DataaccessSwag) (bool, string, int32,
|
|
|
|
|
}
|
|
|
|
|
query.Conditions = condition
|
|
|
|
|
|
|
|
|
|
result, message, count, data, failResult := DataaccessDAO.GetDataaccessResults(query)
|
|
|
|
|
|
|
|
|
|
result,message,count,data,failResult:= DataaccessDAO.GetDataaccessResults(query)
|
|
|
|
|
|
|
|
|
|
return result,message,count,data,failResult
|
|
|
|
|
return result, message, count, data, failResult
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func CreateDataaccess (model models.TDataexDataaccess) (bool, string, error) {
|
|
|
|
|
if ! DatasourceService.IsDatasourceExistsById(model.DatasourceId) {
|
|
|
|
|
func CreateDataaccess(model models.TDataexDataaccess) (bool, string, error) {
|
|
|
|
|
if !DatasourceService.IsDatasourceExistsById(model.DatasourceId) {
|
|
|
|
|
return false, "DatasourceId不存在", nil
|
|
|
|
|
}
|
|
|
|
|
if ! LinksystemService.IsLinksystemExistsById(model.ConsumeSystemid) {
|
|
|
|
|
if !LinksystemService.IsLinksystemExistsById(model.ConsumeSystemid) {
|
|
|
|
|
return false, "SystemId不存在", nil
|
|
|
|
|
}
|
|
|
|
|
if ! OrgtreeService.IsOrgtreeExistsById(model.ConsumeOrgid) {
|
|
|
|
|
if !OrgtreeService.IsOrgtreeExistsById(model.ConsumeOrgid) {
|
|
|
|
|
return false, "OrgId不存在", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -89,19 +87,19 @@ func CreateDataaccess (model models.TDataexDataaccess) (bool, string, error) {
|
|
|
|
|
business.DeleteFlag = -1
|
|
|
|
|
business.EnableFlag = 1
|
|
|
|
|
|
|
|
|
|
result, message, error:= DataaccessDAO.CreateDataaccess(business)
|
|
|
|
|
result, message, error := DataaccessDAO.CreateDataaccess(business)
|
|
|
|
|
|
|
|
|
|
return result, message, error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func UpdateDataaccess (id string, model models.TDataexDataaccess) (bool, string, error) {
|
|
|
|
|
if ! DatasourceService.IsDatasourceExistsById(model.DatasourceId) {
|
|
|
|
|
func UpdateDataaccess(id string, model models.TDataexDataaccess) (bool, string, error) {
|
|
|
|
|
if !DatasourceService.IsDatasourceExistsById(model.DatasourceId) {
|
|
|
|
|
return false, "DatasourceId不存在", nil
|
|
|
|
|
}
|
|
|
|
|
if ! LinksystemService.IsLinksystemExistsById(model.ConsumeSystemid) {
|
|
|
|
|
if !LinksystemService.IsLinksystemExistsById(model.ConsumeSystemid) {
|
|
|
|
|
return false, "SystemId不存在", nil
|
|
|
|
|
}
|
|
|
|
|
if ! OrgtreeService.IsOrgtreeExistsById(model.ConsumeOrgid) {
|
|
|
|
|
if !OrgtreeService.IsOrgtreeExistsById(model.ConsumeOrgid) {
|
|
|
|
|
return false, "OrgId不存在", nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -122,12 +120,12 @@ func UpdateDataaccess (id string, model models.TDataexDataaccess) (bool, string,
|
|
|
|
|
business.CreateTime = time.Now()
|
|
|
|
|
business.DeleteFlag = -1
|
|
|
|
|
business.EnableFlag = 1
|
|
|
|
|
result, message, error:= DataaccessDAO.UpdateDataaccess(id, business)
|
|
|
|
|
result, message, error := DataaccessDAO.UpdateDataaccess(id, business)
|
|
|
|
|
|
|
|
|
|
return result, message, error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func RemoveDataaccess (id string) (bool, string, error) {
|
|
|
|
|
func RemoveDataaccess(id string) (bool, string, error) {
|
|
|
|
|
business := new(models.TDataexDataaccess)
|
|
|
|
|
|
|
|
|
|
//清除Redis缓存
|
|
|
|
@ -141,7 +139,7 @@ func RemoveDataaccess (id string) (bool, string, error) {
|
|
|
|
|
business.DeleteFlag = 1
|
|
|
|
|
business.EnableFlag = -1
|
|
|
|
|
|
|
|
|
|
result, message, error:= DataaccessDAO.RemoveDataaccess(id, business)
|
|
|
|
|
result, message, error := DataaccessDAO.RemoveDataaccess(id, business)
|
|
|
|
|
|
|
|
|
|
return result, message, error
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|