fix: 系统数据导出格式优化
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"be.ems/src/framework/constants/admin"
|
||||
"be.ems/src/framework/i18n"
|
||||
"be.ems/src/framework/utils/ctx"
|
||||
"be.ems/src/framework/utils/date"
|
||||
"be.ems/src/framework/utils/file"
|
||||
"be.ems/src/framework/utils/parse"
|
||||
"be.ems/src/framework/vo/result"
|
||||
@@ -413,21 +414,18 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
// 查询结果,根据查询条件结果,单页最大值限制
|
||||
// querys := ctx.BodyJSONMap(c)
|
||||
querys := map[string]any{
|
||||
"pageNum": 1,
|
||||
"pageSize": 1000,
|
||||
}
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "")
|
||||
// data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
|
||||
// if data["total"].(int64) == 0 {
|
||||
// // 导出数据记录为空
|
||||
// c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
// return
|
||||
// }
|
||||
// rows := data["rows"].([]model.SysRole)
|
||||
|
||||
rows := s.sysRoleService.SelectRoleList(model.SysRole{}, dataScopeSQL)
|
||||
if len(rows) <= 0 {
|
||||
data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysRole)
|
||||
|
||||
// 闭包函数处理多语言
|
||||
converI18n := func(language string, arr *[]model.SysRole) {
|
||||
@@ -447,6 +445,7 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
"C1": i18n.TKey(language, "role.export.key"),
|
||||
"D1": i18n.TKey(language, "role.export.sort"),
|
||||
"E1": i18n.TKey(language, "role.export.status"),
|
||||
"F1": i18n.TKey(language, "role.export.time"),
|
||||
// "F1": i18n.TKey(language, "role.export.dataScope"),
|
||||
}
|
||||
// 读取系统角色数据范围字典数据
|
||||
@@ -474,6 +473,7 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
"C" + idx: row.RoleKey,
|
||||
"D" + idx: row.RoleSort,
|
||||
"E" + idx: statusValue,
|
||||
"F" + idx: date.ParseDateToStr(row.CreateTime, date.YYYY_MM_DDTHH_MM_SSZ),
|
||||
// "F" + idx: dataScope,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user