From bf0dc1a1e927f91be99c70c512cc301bda605bf2 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Sat, 31 Aug 2024 14:31:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=B9=E6=8D=AE=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=AF=BC=E5=87=BAExcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 ++++----- 8 files changed, 59 insertions(+), 55 deletions(-) diff --git a/src/modules/system/controller/sys_config.go b/src/modules/system/controller/sys_config.go index b45c9a6..f721228 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 b7c8d46..bbfd04a 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 884a282..b1971ab 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 8aa23a8..61184d5 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 fdeb1fd..31f913c 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 05efc2a..03f63d6 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 4e8ebeb..c2557ef 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 eaca97f..facf615 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