fix: export log empty issue
This commit is contained in:
@@ -41,7 +41,7 @@ database:
|
||||
password: "1000omc@kp!"
|
||||
host: "127.0.0.1"
|
||||
port: 33066
|
||||
name: tenants_db
|
||||
name: "tenants_db"
|
||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
||||
backup: d:/omc.git/be.ems/restagent/database
|
||||
|
||||
|
||||
@@ -113,7 +113,13 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
querys["pageNum"] = 1
|
||||
querys["pageSize"] = 10000
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
|
||||
// multi-tenancy, only filter user setting tenant_id
|
||||
userName := ctx.LoginUserToUserName(c)
|
||||
if s.IsTenancyUser(userName) {
|
||||
querys["operName"] = userName
|
||||
}
|
||||
// dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
|
||||
dataScopeSQL := ""
|
||||
data := s.SysLogOperateService.SelectSysLogOperatePage(querys, dataScopeSQL)
|
||||
if parse.Number(data["total"]) == 0 {
|
||||
// 导出数据记录为空
|
||||
@@ -221,8 +227,5 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
func (s *SysLogOperateController) IsTenancyUser(userName string) bool {
|
||||
var tenantID []int64
|
||||
dborm.DefaultDB().Table("sys_user").Where("user_name=?", userName).Cols("tenant_id").Find(&tenantID)
|
||||
if len(tenantID) > 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return (len(tenantID) > 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user