From 8eeb38c59a4945904de738afcc4973f4c487c094 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 1 Aug 2024 15:01:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=87=BAExecl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/monitor/controller/sys_job.go | 20 ++++++++++-------- src/modules/monitor/controller/sys_job_log.go | 19 ++++++++++------- src/modules/system/controller/sys_config.go | 2 +- .../system/controller/sys_dict_data.go | 20 ++++++++++-------- .../system/controller/sys_dict_type.go | 20 ++++++++++-------- .../system/controller/sys_log_login.go | 21 +++++++++++-------- .../system/controller/sys_log_operate.go | 21 +++++++++++-------- src/modules/system/controller/sys_post.go | 10 ++++----- src/modules/system/controller/sys_role.go | 10 ++++----- src/modules/system/controller/sys_user.go | 10 ++++----- 10 files changed, 81 insertions(+), 72 deletions(-) diff --git a/src/modules/monitor/controller/sys_job.go b/src/modules/monitor/controller/sys_job.go index de8e7dd2..2420e553 100644 --- a/src/modules/monitor/controller/sys_job.go +++ b/src/modules/monitor/controller/sys_job.go @@ -319,16 +319,18 @@ func (s *SysJobController) ResetQueueJob(c *gin.Context) { func (s *SysJobController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - // data := s.sysJobService.SelectJobPage(querys) - // if data["total"].(int64) == 0 { - // // 导出数据记录为空 - // c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) - // return - // } - // rows := data["rows"].([]model.SysJob) + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 + data := s.sysJobService.SelectJobPage(querys) + if parse.Number(data["total"]) == 0 { + // 导出数据记录为空 + c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) + return + } + rows := data["rows"].([]model.SysJob) - rows := s.sysJobService.SelectJobList(model.SysJob{}) + // rows := s.sysJobService.SelectJobList(model.SysJob{}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) diff --git a/src/modules/monitor/controller/sys_job_log.go b/src/modules/monitor/controller/sys_job_log.go index bcfd8991..4705700e 100644 --- a/src/modules/monitor/controller/sys_job_log.go +++ b/src/modules/monitor/controller/sys_job_log.go @@ -131,15 +131,18 @@ func (s *SysJobLogController) Clean(c *gin.Context) { func (s *SysJobLogController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - // data := s.sysJobLogService.SelectJobLogPage(querys) - // if data["total"].(int64) == 0 { - // c.JSON(200, result.ErrMsg("Export data record is empty")) - // return - // } - // rows := data["rows"].([]model.SysJobLog) + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 + data := s.sysJobLogService.SelectJobLogPage(querys) + if parse.Number(data["total"]) == 0 { + // 导出数据记录为空 + c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) + return + } + rows := data["rows"].([]model.SysJobLog) - rows := s.sysJobLogService.SelectJobLogList(model.SysJobLog{}) + // rows := s.sysJobLogService.SelectJobLogList(model.SysJobLog{}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) diff --git a/src/modules/system/controller/sys_config.go b/src/modules/system/controller/sys_config.go index e6978784..e4a02837 100644 --- a/src/modules/system/controller/sys_config.go +++ b/src/modules/system/controller/sys_config.go @@ -228,7 +228,7 @@ func (s *SysConfigController) Export(c *gin.Context) { // 查询结果,根据查询条件结果,单页最大值限制 querys := ctx.BodyJSONMap(c) querys["pageNum"] = 1 - querys["pageSize"] = 1000 + querys["pageSize"] = 10000 data := s.sysConfigService.SelectConfigPage(querys) if parse.Number(data["total"]) == 0 { // 导出数据记录为空 diff --git a/src/modules/system/controller/sys_dict_data.go b/src/modules/system/controller/sys_dict_data.go index 6733988b..8e3d56bc 100644 --- a/src/modules/system/controller/sys_dict_data.go +++ b/src/modules/system/controller/sys_dict_data.go @@ -241,16 +241,18 @@ func (s *SysDictDataController) DictType(c *gin.Context) { func (s *SysDictDataController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - // data := s.sysDictDataService.SelectDictDataPage(querys) - // if data["total"].(int64) == 0 { - // // 导出数据记录为空 - // c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) - // return - // } - // rows := data["rows"].([]model.SysDictData) + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 + data := s.sysDictDataService.SelectDictDataPage(querys) + if parse.Number(data["total"]) == 0 { + // 导出数据记录为空 + c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) + return + } + rows := data["rows"].([]model.SysDictData) - rows := s.sysDictDataService.SelectDictDataList(model.SysDictData{}) + // rows := s.sysDictDataService.SelectDictDataList(model.SysDictData{}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) diff --git a/src/modules/system/controller/sys_dict_type.go b/src/modules/system/controller/sys_dict_type.go index b44807ce..1af741e5 100644 --- a/src/modules/system/controller/sys_dict_type.go +++ b/src/modules/system/controller/sys_dict_type.go @@ -244,16 +244,18 @@ func (s *SysDictTypeController) DictOptionselect(c *gin.Context) { func (s *SysDictTypeController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - // data := s.sysDictTypeService.SelectDictTypePage(querys) - // if data["total"].(int64) == 0 { - // // 导出数据记录为空 - // c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) - // return - // } - // rows := data["rows"].([]model.SysDictType) + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 + data := s.sysDictTypeService.SelectDictTypePage(querys) + if parse.Number(data["total"]) == 0 { + // 导出数据记录为空 + c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) + return + } + rows := data["rows"].([]model.SysDictType) - rows := s.sysDictTypeService.SelectDictTypeList(model.SysDictType{}) + // rows := s.sysDictTypeService.SelectDictTypeList(model.SysDictType{}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) diff --git a/src/modules/system/controller/sys_log_login.go b/src/modules/system/controller/sys_log_login.go index ad6a7a70..59e9a73d 100644 --- a/src/modules/system/controller/sys_log_login.go +++ b/src/modules/system/controller/sys_log_login.go @@ -122,16 +122,19 @@ func (s *SysLogLoginController) Unlock(c *gin.Context) { func (s *SysLogLoginController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - // data := s.sysLogLoginService.SelectSysLogLoginPage(querys) - // if data["total"].(int64) == 0 { - // // 导出数据记录为空 - // c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) - // return - // } - // rows := data["rows"].([]model.SysLogLogin) + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 + dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u") + data := s.sysLogLoginService.SelectSysLogLoginPage(querys, dataScopeSQL) + if parse.Number(data["total"]) == 0 { + // 导出数据记录为空 + c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) + return + } + rows := data["rows"].([]model.SysLogLogin) - rows := s.sysLogLoginService.SelectSysLogLoginList(model.SysLogLogin{}) + // rows := s.sysLogLoginService.SelectSysLogLoginList(model.SysLogLogin{}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) diff --git a/src/modules/system/controller/sys_log_operate.go b/src/modules/system/controller/sys_log_operate.go index 85f64267..e5cc4a3e 100644 --- a/src/modules/system/controller/sys_log_operate.go +++ b/src/modules/system/controller/sys_log_operate.go @@ -103,16 +103,19 @@ func (s *SysLogOperateController) Clean(c *gin.Context) { func (s *SysLogOperateController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - // data := s.SysLogOperateService.SelectSysLogOperatePage(querys) - // if data["total"].(int64) == 0 { - // // 导出数据记录为空 - // c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) - // return - // } - // rows := data["rows"].([]model.SysLogOperate) + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 + dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u") + data := s.SysLogOperateService.SelectSysLogOperatePage(querys, dataScopeSQL) + if parse.Number(data["total"]) == 0 { + // 导出数据记录为空 + c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) + return + } + rows := data["rows"].([]model.SysLogOperate) - rows := s.SysLogOperateService.SelectSysLogOperateList(model.SysLogOperate{}) + // rows := s.SysLogOperateService.SelectSysLogOperateList(model.SysLogOperate{}) if len(rows) <= 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) diff --git a/src/modules/system/controller/sys_post.go b/src/modules/system/controller/sys_post.go index 7d2b6584..26a2822d 100644 --- a/src/modules/system/controller/sys_post.go +++ b/src/modules/system/controller/sys_post.go @@ -210,13 +210,11 @@ func (s *SysPostController) Remove(c *gin.Context) { func (s *SysPostController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - querys := map[string]any{ - "pageNum": 1, - "pageSize": 1000, - } + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 data := s.sysPostService.SelectPostPage(querys) - if data["total"].(int64) == 0 { + if parse.Number(data["total"]) == 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) return diff --git a/src/modules/system/controller/sys_role.go b/src/modules/system/controller/sys_role.go index be43f919..2300679c 100644 --- a/src/modules/system/controller/sys_role.go +++ b/src/modules/system/controller/sys_role.go @@ -413,14 +413,12 @@ func (s *SysRoleController) AuthUserChecked(c *gin.Context) { func (s *SysRoleController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - querys := map[string]any{ - "pageNum": 1, - "pageSize": 1000, - } + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "") data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL) - if data["total"].(int64) == 0 { + if parse.Number(data["total"]) == 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) return diff --git a/src/modules/system/controller/sys_user.go b/src/modules/system/controller/sys_user.go index e5515a10..4eb2c10e 100644 --- a/src/modules/system/controller/sys_user.go +++ b/src/modules/system/controller/sys_user.go @@ -473,14 +473,12 @@ func (s *SysUserController) Status(c *gin.Context) { func (s *SysUserController) Export(c *gin.Context) { language := ctx.AcceptLanguage(c) // 查询结果,根据查询条件结果,单页最大值限制 - // querys := ctx.BodyJSONMap(c) - querys := map[string]any{ - "pageNum": 1, - "pageSize": 1000, - } + querys := ctx.BodyJSONMap(c) + querys["pageNum"] = 1 + querys["pageSize"] = 10000 dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u") data := s.sysUserService.SelectUserPage(querys, dataScopeSQL) - if data["total"].(int64) == 0 { + if parse.Number(data["total"]) == 0 { // 导出数据记录为空 c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) return