@ -4,7 +4,7 @@ import (
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
"dsSupport/MyModel/DataSource/DatasourceDAO"
"dsSupport/MyModel/MySwagger"
"dsSupport/MyModel/OrgTree/Orgtree Service "
"dsSupport/MyModel/OrgTree/Orgtree DAO "
"dsSupport/Utils/CacheUtil"
"dsSupport/Utils/CommonUtil"
"dsSupport/Utils/ES7Util"
@ -111,12 +111,18 @@ func GetDatasourceResults(swag MySwagger.DatasourceSwag) (bool, string, int, []m
* @ Return error 错 误 信 息
* /
func CreateDatasource ( model models . TDataexDatasource ) ( bool , string , error ) {
// 校验数据提供系统是否存在
_ , e := AccessSystemDao . GetApp ( model . SystemId )
if e != nil {
return false , " SystemId 不存在", nil
return false , " 数据提供系统 不存在", nil
}
if ! OrgtreeService . IsOrgtreeExistsById ( model . ProvideOrgid ) {
return false , "OrgId不存在" , nil
// 校验机构是否存在
if ! OrgtreeDAO . IsOrgtreeExistsById ( model . ProvideOrgid ) {
return false , "机构不存在" , nil
}
// 校验数据源编码是否存在
if DatasourceDAO . IsDatasourceExistsByCode ( html . EscapeString ( model . DatasourceCode ) ) {
return false , "数据源编码已存在" , nil
}
business := new ( models . TDataexDatasource )
business . Id = CommonUtil . GetUUID ( )
@ -140,8 +146,16 @@ func CreateDatasource(model models.TDataexDatasource) (bool, string, error) {
}
func UpdateDatasource ( id string , model models . TDataexDatasource ) ( bool , string , error ) {
// 校验数据提供系统是否存在
_ , e := AccessSystemDao . GetApp ( model . SystemId )
if e != nil {
return false , "数据提供系统不存在" , nil
}
// 校验机构是否存在
if ! OrgtreeDAO . IsOrgtreeExistsById ( model . ProvideOrgid ) {
return false , "机构不存在" , nil
}
business := new ( models . TDataexDatasource )
//清除Redis缓存
var ids = [ ] string { id }
var selector = CacheUtil . GetBean ( "t_dataex_datasource" )
@ -227,14 +241,14 @@ func ReadESDoc(datasourceCode string, orgIDs []string, page int, begin string, c
return result , message , count , esDatas
}
func IsDatasourceExistsById ( id string ) bool {
result := DatasourceDAO . IsDatasourceExistsById ( id )
return result
}
func GetDatasourceIdByCode ( code string ) ( bool , string , interface { } , error ) {
result , message , data , err := DatasourceDAO . GetDatasourceIdByCode ( code )
return result , message , data , err
}
//func IsDatasourceExistsByCode(code string) bool {
// result := DatasourceDAO.IsDatasourceExistsByCode(code)
//
// return result
//}
//
//func GetDatasourceIdByCode(code string) (bool, string, interface{}, error) {
// result, message, data, err := DatasourceDAO.GetDatasourceIdByCode(code)
//
// return result, message, data, err
//}