style: 错误信息英文返回-system 模块路由
This commit is contained in:
Binary file not shown.
@@ -45,7 +45,7 @@ func (s *SysConfigController) List(c *gin.Context) {
|
||||
func (s *SysConfigController) Info(c *gin.Context) {
|
||||
configId := c.Param("configId")
|
||||
if configId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysConfigService.SelectConfigById(configId)
|
||||
@@ -63,14 +63,15 @@ func (s *SysConfigController) Add(c *gin.Context) {
|
||||
var body model.SysConfig
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.ConfigID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查属性值唯一
|
||||
uniqueConfigKey := s.sysConfigService.CheckUniqueConfigKey(body.ConfigKey, "")
|
||||
if !uniqueConfigKey {
|
||||
msg := fmt.Sprintf("参数配置新增【%s】失败,参数键名已存在", body.ConfigKey)
|
||||
// 参数配置新增【%s】失败,参数键名已存在
|
||||
msg := fmt.Sprintf("Parameter configuration add [%s] failed, parameter key name already exists", body.ConfigKey)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -91,14 +92,15 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
var body model.SysConfig
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.ConfigID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查属性值唯一
|
||||
uniqueConfigKey := s.sysConfigService.CheckUniqueConfigKey(body.ConfigKey, body.ConfigID)
|
||||
if !uniqueConfigKey {
|
||||
msg := fmt.Sprintf("参数配置修改【%s】失败,参数键名已存在", body.ConfigKey)
|
||||
// 参数配置修改【%s】失败,参数键名已存在
|
||||
msg := fmt.Sprintf("Parameter configuration modification [%s] failed, parameter key name already exists", body.ConfigKey)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -106,7 +108,8 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
// 检查是否存在
|
||||
config := s.sysConfigService.SelectConfigById(body.ConfigID)
|
||||
if config.ConfigID != body.ConfigID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问参数配置数据!"))
|
||||
// 没有可访问参数配置数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible parameter configuration data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -125,7 +128,7 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
func (s *SysConfigController) Remove(c *gin.Context) {
|
||||
configIds := c.Param("configIds")
|
||||
if configIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -140,7 +143,7 @@ func (s *SysConfigController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -158,7 +161,7 @@ func (s *SysConfigController) RefreshCache(c *gin.Context) {
|
||||
func (s *SysConfigController) ConfigKey(c *gin.Context) {
|
||||
configKey := c.Param("configKey")
|
||||
if configKey == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
key := s.sysConfigService.SelectConfigValueByKey(configKey)
|
||||
@@ -177,7 +180,8 @@ func (s *SysConfigController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysConfigService.SelectConfigPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysConfig)
|
||||
@@ -186,19 +190,19 @@ func (s *SysConfigController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("config_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "参数编号",
|
||||
"B1": "参数名称",
|
||||
"C1": "参数键名",
|
||||
"D1": "参数键值",
|
||||
"E1": "系统内置",
|
||||
"A1": "ConfigID",
|
||||
"B1": "ConfigName",
|
||||
"C1": "ConfigKey",
|
||||
"D1": "ConfigValue",
|
||||
"E1": "Type",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
typeValue := "否"
|
||||
typeValue := "clogged"
|
||||
if row.ConfigType == "Y" {
|
||||
typeValue = "是"
|
||||
typeValue = "be"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.ConfigID,
|
||||
@@ -228,20 +232,22 @@ func (s *SysConfigController) ConfigValue(c *gin.Context) {
|
||||
Value string `json:"value" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
info := s.sysConfigService.SelectConfigByKey(body.Key)
|
||||
if info.ConfigKey != body.Key {
|
||||
c.JSON(200, result.ErrMsg("无效 key"))
|
||||
// 无效 key
|
||||
c.JSON(200, result.ErrMsg("Invalid key"))
|
||||
return
|
||||
}
|
||||
|
||||
// 与旧值相等不变更
|
||||
if info.ConfigValue == body.Value {
|
||||
c.JSON(200, result.ErrMsg("变更状态与旧值相等!"))
|
||||
// 变更状态与旧值相等!
|
||||
c.JSON(200, result.ErrMsg("The change status is equal to the old value!"))
|
||||
return
|
||||
}
|
||||
info.ConfigValue = body.Value
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s *SysDeptController) List(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindQuery(&querys)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func (s *SysDeptController) List(c *gin.Context) {
|
||||
func (s *SysDeptController) Info(c *gin.Context) {
|
||||
deptId := c.Param("deptId")
|
||||
if deptId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDeptService.SelectDeptById(deptId)
|
||||
@@ -82,7 +82,7 @@ func (s *SysDeptController) Add(c *gin.Context) {
|
||||
var body model.SysDept
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DeptID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -90,16 +90,19 @@ func (s *SysDeptController) Add(c *gin.Context) {
|
||||
if body.ParentID != "0" {
|
||||
deptParent := s.sysDeptService.SelectDeptById(body.ParentID)
|
||||
if deptParent.DeptID != body.ParentID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
if deptParent.Status == common.STATUS_NO {
|
||||
msg := fmt.Sprintf("上级部门【%s】停用,不允许新增", deptParent.DeptName)
|
||||
// 上级部门【%s】停用,不允许新增
|
||||
msg := fmt.Sprintf("Upper division [%s] deactivated, no new additions allowed", deptParent.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
if deptParent.DelFlag == common.STATUS_YES {
|
||||
msg := fmt.Sprintf("上级部门【%s】已删除,不允许新增", deptParent.DeptName)
|
||||
// 上级部门【%s】已删除,不允许新增
|
||||
msg := fmt.Sprintf("The parent department [%s] has been deleted and is not allowed to be added", deptParent.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -111,7 +114,8 @@ func (s *SysDeptController) Add(c *gin.Context) {
|
||||
// 检查同级下名称唯一
|
||||
uniqueDeptName := s.sysDeptService.CheckUniqueDeptName(body.DeptName, body.ParentID, "")
|
||||
if !uniqueDeptName {
|
||||
msg := fmt.Sprintf("部门新增【%s】失败,部门名称已存在", body.DeptName)
|
||||
// 部门新增【%s】失败,部门名称已存在
|
||||
msg := fmt.Sprintf("Department add [%s] failed, department name already exists", body.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -132,13 +136,14 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
var body model.SysDept
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DeptID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 上级部门不能选自己
|
||||
if body.DeptID == body.ParentID {
|
||||
msg := fmt.Sprintf("部门修改【%s】失败,上级部门不能是自己", body.DeptName)
|
||||
// 部门修改【%s】失败,上级部门不能是自己
|
||||
msg := fmt.Sprintf("Departmental modification [%s] failed, the parent department cannot be itself", body.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -146,14 +151,16 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
// 检查数据是否存在
|
||||
deptInfo := s.sysDeptService.SelectDeptById(body.DeptID)
|
||||
if deptInfo.DeptID != body.DeptID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
// 父级ID不为0是要检查
|
||||
if body.ParentID != "0" {
|
||||
deptParent := s.sysDeptService.SelectDeptById(body.ParentID)
|
||||
if deptParent.DeptID != body.ParentID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -161,7 +168,8 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
// 检查同级下名称唯一
|
||||
uniqueDeptName := s.sysDeptService.CheckUniqueDeptName(body.DeptName, body.ParentID, body.DeptID)
|
||||
if !uniqueDeptName {
|
||||
msg := fmt.Sprintf("部门修改【%s】失败,部门名称已存在", body.DeptName)
|
||||
// 部门修改【%s】失败,部门名称已存在
|
||||
msg := fmt.Sprintf("Department modification [%s] failed, department name already exists", body.DeptName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -170,7 +178,8 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
if body.Status == common.STATUS_NO {
|
||||
hasChild := s.sysDeptService.HasChildByDeptId(body.DeptID)
|
||||
if hasChild > 0 {
|
||||
msg := fmt.Sprintf("该部门包含未停用的子部门数量:%d", hasChild)
|
||||
// 该部门包含未停用的子部门数量:%d
|
||||
msg := fmt.Sprintf("Number of subsectors not deactivated included in this sector: %d", hasChild)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -191,21 +200,23 @@ func (s *SysDeptController) Edit(c *gin.Context) {
|
||||
func (s *SysDeptController) Remove(c *gin.Context) {
|
||||
deptId := c.Param("deptId")
|
||||
if deptId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
dept := s.sysDeptService.SelectDeptById(deptId)
|
||||
if dept.DeptID != deptId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问部门数据!"))
|
||||
// 没有可访问部门数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible sectoral data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在子部门
|
||||
hasChild := s.sysDeptService.HasChildByDeptId(deptId)
|
||||
if hasChild > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,存在子部门数:%d", hasChild)
|
||||
// 不允许删除,存在子部门数:%d
|
||||
msg := fmt.Sprintf("Deletion not allowed, number of subsectors present: %d", hasChild)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -213,14 +224,16 @@ func (s *SysDeptController) Remove(c *gin.Context) {
|
||||
// 检查是否分配给用户
|
||||
existUser := s.sysDeptService.CheckDeptExistUser(deptId)
|
||||
if existUser > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,部门已分配给用户数:%d", existUser)
|
||||
// 不允许删除,部门已分配给用户数:%d
|
||||
msg := fmt.Sprintf("Deletions are not allowed and the department has been assigned to the number of users: %d", existUser)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
rows := s.sysDeptService.DeleteDeptById(deptId)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
// 删除成功:%d
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -233,7 +246,7 @@ func (s *SysDeptController) Remove(c *gin.Context) {
|
||||
func (s *SysDeptController) ExcludeChild(c *gin.Context) {
|
||||
deptId := c.Param("deptId")
|
||||
if deptId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -274,7 +287,7 @@ func (s *SysDeptController) TreeSelect(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindQuery(&querys)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -295,7 +308,7 @@ func (s *SysDeptController) TreeSelect(c *gin.Context) {
|
||||
func (s *SysDeptController) RoleDeptTreeSelect(c *gin.Context) {
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (s *SysDictDataController) List(c *gin.Context) {
|
||||
func (s *SysDictDataController) Info(c *gin.Context) {
|
||||
dictCode := c.Param("dictCode")
|
||||
if dictCode == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictDataService.SelectDictDataByCode(dictCode)
|
||||
@@ -66,21 +66,23 @@ func (s *SysDictDataController) Add(c *gin.Context) {
|
||||
var body model.SysDictData
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictCode != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典类型是否存在
|
||||
sysDictType := s.sysDictTypeService.SelectDictTypeByType(body.DictType)
|
||||
if sysDictType.DictType != body.DictType {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
// 没有可访问字典类型数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典标签唯一
|
||||
uniqueDictLabel := s.sysDictDataService.CheckUniqueDictLabel(body.DictType, body.DictLabel, "")
|
||||
if !uniqueDictLabel {
|
||||
msg := fmt.Sprintf("数据新增【%s】失败,该字典类型下标签名已存在", body.DictLabel)
|
||||
// 数据新增【%s】失败,该字典类型下标签名已存在
|
||||
msg := fmt.Sprintf("Data addition [%s] failed, tag name already exists under this dictionary type", body.DictLabel)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -88,7 +90,8 @@ func (s *SysDictDataController) Add(c *gin.Context) {
|
||||
// 检查字典键值唯一
|
||||
uniqueDictValue := s.sysDictDataService.CheckUniqueDictValue(body.DictType, body.DictValue, "")
|
||||
if !uniqueDictValue {
|
||||
msg := fmt.Sprintf("数据新增【%s】失败,该字典类型下标签值已存在", body.DictValue)
|
||||
// 数据新增【%s】失败,该字典类型下标签值已存在
|
||||
msg := fmt.Sprintf("Data addition [%s] failed, tagged value already exists under this dictionary type", body.DictValue)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -109,28 +112,31 @@ func (s *SysDictDataController) Edit(c *gin.Context) {
|
||||
var body model.SysDictData
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictCode == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典类型是否存在
|
||||
sysDictType := s.sysDictTypeService.SelectDictTypeByType(body.DictType)
|
||||
if sysDictType.DictType != body.DictType {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
// 没有可访问字典类型数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典编码是否存在
|
||||
SysDictDataController := s.sysDictDataService.SelectDictDataByCode(body.DictCode)
|
||||
if SysDictDataController.DictCode != body.DictCode {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典编码数据!"))
|
||||
// 没有可访问字典编码数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary-encoded data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典标签唯一
|
||||
uniqueDictLabel := s.sysDictDataService.CheckUniqueDictLabel(body.DictType, body.DictLabel, body.DictCode)
|
||||
if !uniqueDictLabel {
|
||||
msg := fmt.Sprintf("数据修改【%s】失败,该字典类型下标签名已存在", body.DictLabel)
|
||||
// 数据修改【%s】失败,该字典类型下标签名已存在
|
||||
msg := fmt.Sprintf("Data modification [%s] failed, tag name already exists under this dictionary type", body.DictLabel)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -138,7 +144,8 @@ func (s *SysDictDataController) Edit(c *gin.Context) {
|
||||
// 检查字典键值唯一
|
||||
uniqueDictValue := s.sysDictDataService.CheckUniqueDictValue(body.DictType, body.DictValue, body.DictCode)
|
||||
if !uniqueDictValue {
|
||||
msg := fmt.Sprintf("数据修改【%s】失败,该字典类型下标签值已存在", body.DictValue)
|
||||
// 数据修改【%s】失败,该字典类型下标签值已存在
|
||||
msg := fmt.Sprintf("Data modification [%s] failed, tagged value already exists under this dictionary type", body.DictValue)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -158,7 +165,7 @@ func (s *SysDictDataController) Edit(c *gin.Context) {
|
||||
func (s *SysDictDataController) Remove(c *gin.Context) {
|
||||
dictCodes := c.Param("dictCodes")
|
||||
if dictCodes == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -173,7 +180,8 @@ func (s *SysDictDataController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
// 删除成功:%d
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -183,7 +191,7 @@ func (s *SysDictDataController) Remove(c *gin.Context) {
|
||||
func (s *SysDictDataController) DictType(c *gin.Context) {
|
||||
dictType := c.Param("dictType")
|
||||
if dictType == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -199,7 +207,8 @@ func (s *SysDictDataController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysDictDataService.SelectDictDataPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysDictData)
|
||||
@@ -208,20 +217,20 @@ func (s *SysDictDataController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("dict_data_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "字典编码",
|
||||
"B1": "字典排序",
|
||||
"C1": "字典标签",
|
||||
"D1": "字典键值",
|
||||
"E1": "字典类型",
|
||||
"F1": "状态",
|
||||
"A1": "DictCode",
|
||||
"B1": "DictSort",
|
||||
"C1": "DictLabel",
|
||||
"D1": "DictValue",
|
||||
"E1": "DictType",
|
||||
"F1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.DictCode,
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s *SysDictTypeController) List(c *gin.Context) {
|
||||
func (s *SysDictTypeController) Info(c *gin.Context) {
|
||||
dictId := c.Param("dictId")
|
||||
if dictId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictTypeService.SelectDictTypeByID(dictId)
|
||||
@@ -64,14 +64,15 @@ func (s *SysDictTypeController) Add(c *gin.Context) {
|
||||
var body model.SysDictType
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典名称唯一
|
||||
uniqueDictName := s.sysDictTypeService.CheckUniqueDictName(body.DictName, "")
|
||||
if !uniqueDictName {
|
||||
msg := fmt.Sprintf("字典新增【%s】失败,字典名称已存在", body.DictName)
|
||||
// 字典新增【%s】失败,字典名称已存在
|
||||
msg := fmt.Sprintf("Dictionary add [%s] failed, dictionary name already exists", body.DictName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -79,7 +80,8 @@ func (s *SysDictTypeController) Add(c *gin.Context) {
|
||||
// 检查字典类型唯一
|
||||
uniqueDictType := s.sysDictTypeService.CheckUniqueDictType(body.DictType, "")
|
||||
if !uniqueDictType {
|
||||
msg := fmt.Sprintf("字典新增【%s】失败,字典类型已存在", body.DictType)
|
||||
// 字典新增【%s】失败,字典类型已存在
|
||||
msg := fmt.Sprintf("Dictionary add [%s] failed, dictionary type already exists", body.DictType)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -100,21 +102,23 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
var body model.SysDictType
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.DictID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
dictInfo := s.sysDictTypeService.SelectDictTypeByID(body.DictID)
|
||||
if dictInfo.DictID != body.DictID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问字典类型数据!"))
|
||||
// 没有可访问字典类型数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible dictionary type data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查字典名称唯一
|
||||
uniqueDictName := s.sysDictTypeService.CheckUniqueDictName(body.DictName, body.DictID)
|
||||
if !uniqueDictName {
|
||||
msg := fmt.Sprintf("字典修改【%s】失败,字典名称已存在", body.DictName)
|
||||
// 字典修改【%s】失败,字典名称已存在
|
||||
msg := fmt.Sprintf("Dictionary modification [%s] failed, dictionary name already exists", body.DictName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -122,7 +126,8 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
// 检查字典类型唯一
|
||||
uniqueDictType := s.sysDictTypeService.CheckUniqueDictType(body.DictType, body.DictID)
|
||||
if !uniqueDictType {
|
||||
msg := fmt.Sprintf("字典修改【%s】失败,字典类型已存在", body.DictType)
|
||||
// 字典修改【%s】失败,字典类型已存在
|
||||
msg := fmt.Sprintf("Dictionary modification [%s] failed, dictionary type already exists", body.DictType)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -142,7 +147,7 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
func (s *SysDictTypeController) Remove(c *gin.Context) {
|
||||
dictIds := c.Param("dictIds")
|
||||
if dictIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -157,7 +162,7 @@ func (s *SysDictTypeController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -201,7 +206,8 @@ func (s *SysDictTypeController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysDictTypeService.SelectDictTypePage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysDictType)
|
||||
@@ -210,18 +216,18 @@ func (s *SysDictTypeController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("dict_type_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "字典主键",
|
||||
"B1": "字典名称",
|
||||
"C1": "字典类型",
|
||||
"D1": "状态",
|
||||
"A1": "DictID",
|
||||
"B1": "DictName",
|
||||
"C1": "DictType",
|
||||
"D1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.DictID,
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s *SysLogLoginController) List(c *gin.Context) {
|
||||
func (s *SysLogLoginController) Remove(c *gin.Context) {
|
||||
infoIds := c.Param("infoIds")
|
||||
if infoIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func (s *SysLogLoginController) Remove(c *gin.Context) {
|
||||
}
|
||||
rows := s.sysLogLoginService.DeleteSysLogLoginByIds(uniqueIDs)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (s *SysLogLoginController) Clean(c *gin.Context) {
|
||||
func (s *SysLogLoginController) Unlock(c *gin.Context) {
|
||||
userName := c.Param("userName")
|
||||
if userName == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
ok := s.accountService.ClearLoginRecordCache(userName)
|
||||
@@ -106,7 +106,8 @@ func (s *SysLogLoginController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysLogLoginService.SelectSysLogLoginPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysLogLogin)
|
||||
@@ -115,24 +116,24 @@ func (s *SysLogLoginController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("sys_log_login_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "序号",
|
||||
"B1": "用户账号",
|
||||
"C1": "登录状态",
|
||||
"D1": "登录地址",
|
||||
"E1": "登录地点",
|
||||
"F1": "浏览器",
|
||||
"G1": "操作系统",
|
||||
"H1": "提示消息",
|
||||
"I1": "访问时间",
|
||||
"A1": "ID",
|
||||
"B1": "UserName",
|
||||
"C1": "Status",
|
||||
"D1": "IP",
|
||||
"E1": "Location",
|
||||
"F1": "Browser",
|
||||
"G1": "OS",
|
||||
"H1": "Msg",
|
||||
"I1": "Time",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 状态
|
||||
statusValue := "失败"
|
||||
statusValue := "fail"
|
||||
if row.Status == "1" {
|
||||
statusValue = "成功"
|
||||
statusValue = "successes"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.LoginID,
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *SysLogOperateController) List(c *gin.Context) {
|
||||
func (s *SysLogOperateController) Remove(c *gin.Context) {
|
||||
operIds := c.Param("operIds")
|
||||
if operIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (s *SysLogOperateController) Remove(c *gin.Context) {
|
||||
}
|
||||
rows := s.SysLogOperateService.DeleteSysLogOperateByIds(uniqueIDs)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -85,7 +85,8 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.SysLogOperateService.SelectSysLogOperatePage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysLogOperate)
|
||||
@@ -94,22 +95,22 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("sys_log_operate_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "操作序号",
|
||||
"B1": "操作模块",
|
||||
"C1": "业务类型",
|
||||
"D1": "请求方法",
|
||||
"E1": "请求方式",
|
||||
"F1": "操作类别",
|
||||
"G1": "操作人员",
|
||||
"H1": "部门名称",
|
||||
"I1": "请求地址",
|
||||
"J1": "操作地址",
|
||||
"K1": "操作地点",
|
||||
"L1": "请求参数",
|
||||
"M1": "操作消息",
|
||||
"N1": "状态",
|
||||
"O1": "消耗时间(毫秒)",
|
||||
"P1": "操作时间",
|
||||
"A1": "ID",
|
||||
"B1": "Title",
|
||||
"C1": "BusinessType",
|
||||
"D1": "Method",
|
||||
"E1": "RequestMethod",
|
||||
"F1": "OperatorType",
|
||||
"G1": "OperName",
|
||||
"H1": "DeptName",
|
||||
"I1": "URL",
|
||||
"J1": "IP",
|
||||
"K1": "Location",
|
||||
"L1": "Param",
|
||||
"M1": "Msg",
|
||||
"N1": "Status",
|
||||
"O1": "CostTime (ms)",
|
||||
"P1": "OperTime",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
@@ -118,11 +119,11 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
// 业务类型
|
||||
businessType := ""
|
||||
// 操作类别
|
||||
OperatorType := ""
|
||||
operatorType := ""
|
||||
// 状态
|
||||
statusValue := "失败"
|
||||
statusValue := "fail"
|
||||
if row.Status == "1" {
|
||||
statusValue = "成功"
|
||||
statusValue = "success"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.OperID,
|
||||
@@ -130,7 +131,7 @@ func (s *SysLogOperateController) Export(c *gin.Context) {
|
||||
"C" + idx: businessType,
|
||||
"D" + idx: row.Method,
|
||||
"E" + idx: row.RequestMethod,
|
||||
"F" + idx: OperatorType,
|
||||
"F" + idx: operatorType,
|
||||
"G" + idx: row.OperName,
|
||||
"H" + idx: row.DeptName,
|
||||
"I" + idx: row.OperURL,
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *SysMenuController) List(c *gin.Context) {
|
||||
func (s *SysMenuController) Info(c *gin.Context) {
|
||||
menuId := c.Param("menuId")
|
||||
if menuId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysMenuService.SelectMenuById(menuId)
|
||||
@@ -73,7 +73,7 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.MenuID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
if menu.TYPE_DIR == body.MenuType || menu.TYPE_MENU == body.MenuType {
|
||||
uniqueNenuPath := s.sysMenuService.CheckUniqueMenuPath(body.Path, body.ParentID, "")
|
||||
if !uniqueNenuPath {
|
||||
msg := fmt.Sprintf("菜单新增【%s】失败,菜单路由地址已存在", body.MenuName)
|
||||
// 菜单新增【%s】失败,菜单路由地址已存在
|
||||
msg := fmt.Sprintf("Menu add [%s] failed, menu routing address already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -90,14 +91,16 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
// 检查名称唯一
|
||||
uniqueNenuName := s.sysMenuService.CheckUniqueMenuName(body.MenuName, body.ParentID, "")
|
||||
if !uniqueNenuName {
|
||||
msg := fmt.Sprintf("菜单新增【%s】失败,菜单名称已存在", body.MenuName)
|
||||
// 菜单新增【%s】失败,菜单名称已存在
|
||||
msg := fmt.Sprintf("Menu add [%s] failed, menu name already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
// 外链菜单需要符合网站http(s)开头
|
||||
if body.IsFrame == common.STATUS_NO && !regular.ValidHttp(body.Path) {
|
||||
msg := fmt.Sprintf("菜单新增【%s】失败,非内部地址必须以http(s)://开头", body.MenuName)
|
||||
// 菜单新增【%s】失败,非内部地址必须以http(s)://开头
|
||||
msg := fmt.Sprintf("Menu adds [%s] failure, non-internal addresses must start with http(s)://", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -118,13 +121,14 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.MenuID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 上级菜单不能选自己
|
||||
if body.MenuID == body.ParentID {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,上级菜单不能选择自己", body.MenuName)
|
||||
// 菜单修改【%s】失败,上级菜单不能选择自己
|
||||
msg := fmt.Sprintf("Menu modification [%s] fails, the parent menu cannot select itself", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -132,19 +136,21 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
// 检查数据是否存在
|
||||
menuInfo := s.sysMenuService.SelectMenuById(body.MenuID)
|
||||
if menuInfo.MenuID != body.MenuID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问菜单数据"))
|
||||
// 没有可访问菜单数据
|
||||
c.JSON(200, result.ErrMsg("No accessible menu data"))
|
||||
return
|
||||
}
|
||||
// 父级ID不为0是要检查
|
||||
if body.ParentID != "0" {
|
||||
menuParent := s.sysMenuService.SelectMenuById(body.ParentID)
|
||||
if menuParent.MenuID != body.ParentID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问菜单数据"))
|
||||
c.JSON(200, result.ErrMsg("No accessible menu data"))
|
||||
return
|
||||
}
|
||||
// 禁用菜单时检查父菜单是否使用
|
||||
if body.Status == common.STATUS_YES && menuParent.Status == common.STATUS_NO {
|
||||
c.JSON(200, result.ErrMsg("上级菜单未启用!"))
|
||||
// 上级菜单未启用!
|
||||
c.JSON(200, result.ErrMsg("The parent menu is not enabled!"))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -153,7 +159,8 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
if menu.TYPE_DIR == body.MenuType || menu.TYPE_MENU == body.MenuType {
|
||||
uniqueNenuPath := s.sysMenuService.CheckUniqueMenuPath(body.Path, body.ParentID, body.MenuID)
|
||||
if !uniqueNenuPath {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,菜单路由地址已存在", body.MenuName)
|
||||
// 菜单修改【%s】失败,菜单路由地址已存在
|
||||
msg := fmt.Sprintf("Menu modification [%s] failed, menu routing address already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -162,14 +169,16 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
// 检查名称唯一
|
||||
uniqueNenuName := s.sysMenuService.CheckUniqueMenuName(body.MenuName, body.ParentID, body.MenuID)
|
||||
if !uniqueNenuName {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,菜单名称已存在", body.MenuName)
|
||||
// 菜单修改【%s】失败,菜单名称已存在
|
||||
msg := fmt.Sprintf("Menu modification [%s] failed, menu name already exists", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
// 外链菜单需要符合网站http(s)开头
|
||||
if body.IsFrame == common.STATUS_NO && !regular.ValidHttp(body.Path) {
|
||||
msg := fmt.Sprintf("菜单修改【%s】失败,非内部地址必须以http(s)://开头", body.MenuName)
|
||||
// 菜单修改【%s】失败,非内部地址必须以http(s)://开头
|
||||
msg := fmt.Sprintf("Menu change [%s] failed, non-internal address must start with http(s)://", body.MenuName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -178,7 +187,8 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
if body.Status == common.STATUS_NO {
|
||||
hasStatus := s.sysMenuService.HasChildByMenuIdAndStatus(body.MenuID, common.STATUS_YES)
|
||||
if hasStatus > 0 {
|
||||
msg := fmt.Sprintf("不允许禁用,存在使用子菜单数:%d", hasStatus)
|
||||
// 不允许禁用,存在使用子菜单数:%d
|
||||
msg := fmt.Sprintf("Disabling is not allowed, number of submenus present for use: %d", hasStatus)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -199,21 +209,23 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
func (s *SysMenuController) Remove(c *gin.Context) {
|
||||
menuId := c.Param("menuId")
|
||||
if menuId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查数据是否存在
|
||||
menu := s.sysMenuService.SelectMenuById(menuId)
|
||||
if menu.MenuID != menuId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问菜单数据!"))
|
||||
// 没有可访问菜单数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible menu data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在子菜单
|
||||
hasChild := s.sysMenuService.HasChildByMenuIdAndStatus(menuId, "")
|
||||
if hasChild > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,存在子菜单数:%d", hasChild)
|
||||
// 不允许删除,存在子菜单数:%d
|
||||
msg := fmt.Sprintf("Deletion not allowed, number of submenus present: %d", hasChild)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -221,14 +233,15 @@ func (s *SysMenuController) Remove(c *gin.Context) {
|
||||
// 检查是否分配给角色
|
||||
existRole := s.sysMenuService.CheckMenuExistRole(menuId)
|
||||
if existRole > 0 {
|
||||
msg := fmt.Sprintf("不允许删除,菜单已分配给角色数:%d", existRole)
|
||||
// 不允许删除,菜单已分配给角色数:%d
|
||||
msg := fmt.Sprintf("Deletion not allowed, number of roles assigned to the menu: %d", existRole)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
rows := s.sysMenuService.DeleteMenuById(menuId)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -262,7 +275,7 @@ func (s *SysMenuController) TreeSelect(c *gin.Context) {
|
||||
func (s *SysMenuController) RoleMenuTreeSelect(c *gin.Context) {
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ func (s *SysNoticeController) List(c *gin.Context) {
|
||||
func (s *SysNoticeController) Info(c *gin.Context) {
|
||||
noticeId := c.Param("noticeId")
|
||||
if noticeId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysNoticeService.SelectNoticeById(noticeId)
|
||||
@@ -60,7 +60,7 @@ func (s *SysNoticeController) Add(c *gin.Context) {
|
||||
var body model.SysNotice
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.NoticeID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -80,14 +80,15 @@ func (s *SysNoticeController) Edit(c *gin.Context) {
|
||||
var body model.SysNotice
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.NoticeID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
notice := s.sysNoticeService.SelectNoticeById(body.NoticeID)
|
||||
if notice.NoticeID != body.NoticeID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问公告信息数据!"))
|
||||
// 没有可访问公告信息数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible bulletin information data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ func (s *SysNoticeController) Edit(c *gin.Context) {
|
||||
func (s *SysNoticeController) Remove(c *gin.Context) {
|
||||
noticeIds := c.Param("noticeIds")
|
||||
if noticeIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -121,6 +122,6 @@ func (s *SysNoticeController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *SysPostController) List(c *gin.Context) {
|
||||
func (s *SysPostController) Info(c *gin.Context) {
|
||||
postId := c.Param("postId")
|
||||
if postId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysPostService.SelectPostById(postId)
|
||||
@@ -63,14 +63,15 @@ func (s *SysPostController) Add(c *gin.Context) {
|
||||
var body model.SysPost
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.PostID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查名称唯一
|
||||
uniqueuPostName := s.sysPostService.CheckUniquePostName(body.PostName, "")
|
||||
if !uniqueuPostName {
|
||||
msg := fmt.Sprintf("岗位新增【%s】失败,岗位名称已存在", body.PostName)
|
||||
// 岗位新增【%s】失败,岗位名称已存在
|
||||
msg := fmt.Sprintf("Job addition [%s] failed, job name already exists", body.PostName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -78,7 +79,8 @@ func (s *SysPostController) Add(c *gin.Context) {
|
||||
// 检查编码属性值唯一
|
||||
uniquePostCode := s.sysPostService.CheckUniquePostCode(body.PostCode, "")
|
||||
if !uniquePostCode {
|
||||
msg := fmt.Sprintf("岗位新增【%s】失败,岗位编码已存在", body.PostCode)
|
||||
// 岗位新增【%s】失败,岗位编码已存在
|
||||
msg := fmt.Sprintf("Job addition [%s] failed, job code already exists", body.PostCode)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -99,21 +101,23 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
var body model.SysPost
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.PostID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
post := s.sysPostService.SelectPostById(body.PostID)
|
||||
if post.PostID != body.PostID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问岗位数据!"))
|
||||
// 没有可访问岗位数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible post data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查名称唯一
|
||||
uniqueuPostName := s.sysPostService.CheckUniquePostName(body.PostName, body.PostID)
|
||||
if !uniqueuPostName {
|
||||
msg := fmt.Sprintf("岗位修改【%s】失败,岗位名称已存在", body.PostName)
|
||||
// 岗位修改【%s】失败,岗位名称已存在
|
||||
msg := fmt.Sprintf("Post modification [%s] failed, post name already exists", body.PostName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -121,7 +125,8 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
// 检查编码属性值唯一
|
||||
uniquePostCode := s.sysPostService.CheckUniquePostCode(body.PostCode, body.PostID)
|
||||
if !uniquePostCode {
|
||||
msg := fmt.Sprintf("岗位修改【%s】失败,岗位编码已存在", body.PostCode)
|
||||
// 岗位修改【%s】失败,岗位编码已存在
|
||||
msg := fmt.Sprintf("Post modification [%s] failed, post code already exists", body.PostCode)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -141,7 +146,7 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
func (s *SysPostController) Remove(c *gin.Context) {
|
||||
postIds := c.Param("postIds")
|
||||
if postIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -156,7 +161,7 @@ func (s *SysPostController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -168,7 +173,8 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
querys := ctx.BodyJSONMap(c)
|
||||
data := s.sysPostService.SelectPostPage(querys)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysPost)
|
||||
@@ -177,19 +183,19 @@ func (s *SysPostController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("post_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "岗位编号",
|
||||
"B1": "岗位编码",
|
||||
"C1": "岗位名称",
|
||||
"D1": "岗位排序",
|
||||
"E1": "状态",
|
||||
"A1": "PostID",
|
||||
"B1": "PostCode",
|
||||
"C1": "PostName",
|
||||
"D1": "PostSort",
|
||||
"E1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.PostID,
|
||||
|
||||
@@ -60,7 +60,7 @@ func (s *SysProfileController) Info(c *gin.Context) {
|
||||
}
|
||||
isAdmin := config.IsAdmin(loginUser.UserID)
|
||||
if isAdmin {
|
||||
roleGroup = append(roleGroup, "管理员")
|
||||
roleGroup = append(roleGroup, "Administrator")
|
||||
}
|
||||
|
||||
// 查询用户所属岗位组
|
||||
@@ -93,7 +93,7 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.Sex == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -111,12 +111,14 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
if regular.ValidMobile(body.PhoneNumber) {
|
||||
uniquePhone := s.sysUserService.CheckUniquePhone(body.PhoneNumber, userId)
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码已存在", userName)
|
||||
// 修改用户【%s】失败,手机号码已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], cell phone number already exists", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码格式错误", userName)
|
||||
// 修改用户【%s】失败,手机号码格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], wrong format of cell phone number", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -127,12 +129,14 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
if regular.ValidEmail(body.Email) {
|
||||
uniqueEmail := s.sysUserService.CheckUniqueEmail(body.Email, userId)
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱已存在", userName)
|
||||
// 修改用户【%s】失败,邮箱已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox already exists", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱格式错误", userName)
|
||||
// 修改用户【%s】失败,邮箱格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox format error", userName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -165,7 +169,8 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
c.JSON(200, result.Ok(nil))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.ErrMsg("上传图片异常"))
|
||||
// 上传图片异常
|
||||
c.JSON(200, result.ErrMsg("Upload Image Exception"))
|
||||
}
|
||||
|
||||
// 个人重置密码
|
||||
@@ -180,7 +185,7 @@ func (s *SysProfileController) UpdatePwd(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -196,19 +201,22 @@ func (s *SysProfileController) UpdatePwd(c *gin.Context) {
|
||||
// 查询当前登录用户信息得到密码值
|
||||
user := s.sysUserService.SelectUserById(userId)
|
||||
if user.UserID != userId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查匹配用户密码
|
||||
oldCompare := crypto.BcryptCompare(body.OldPassword, user.Password)
|
||||
if !oldCompare {
|
||||
c.JSON(200, result.ErrMsg("修改密码失败,旧密码错误"))
|
||||
// 修改密码失败,旧密码错误
|
||||
c.JSON(200, result.ErrMsg("Failed to change password, old password is wrong"))
|
||||
return
|
||||
}
|
||||
newCompare := crypto.BcryptCompare(body.NewPassword, user.Password)
|
||||
if newCompare {
|
||||
c.JSON(200, result.ErrMsg("新密码不能与旧密码相同"))
|
||||
// 新密码不能与旧密码相同
|
||||
c.JSON(200, result.ErrMsg("The new password cannot be the same as the old one"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -232,7 +240,7 @@ func (s *SysProfileController) UpdatePwd(c *gin.Context) {
|
||||
func (s *SysProfileController) Avatar(c *gin.Context) {
|
||||
formFile, err := c.FormFile("file")
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ func (s *SysRoleController) List(c *gin.Context) {
|
||||
func (s *SysRoleController) Info(c *gin.Context) {
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
data := s.sysRoleService.SelectRoleById(roleId)
|
||||
@@ -69,14 +69,15 @@ func (s *SysRoleController) Add(c *gin.Context) {
|
||||
var body model.SysRole
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.RoleID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 判断角色名称是否唯一
|
||||
uniqueRoleName := s.sysRoleService.CheckUniqueRoleName(body.RoleName, "")
|
||||
if !uniqueRoleName {
|
||||
msg := fmt.Sprintf("角色新增【%s】失败,角色名称已存在", body.RoleName)
|
||||
// 角色新增【%s】失败,角色名称已存在
|
||||
msg := fmt.Sprintf("Character addition [%s] failed, character name already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -84,7 +85,8 @@ func (s *SysRoleController) Add(c *gin.Context) {
|
||||
// 判断角色键值是否唯一
|
||||
uniqueRoleKey := s.sysRoleService.CheckUniqueRoleKey(body.RoleKey, "")
|
||||
if !uniqueRoleKey {
|
||||
msg := fmt.Sprintf("角色新增【%s】失败,角色键值已存在", body.RoleName)
|
||||
// 角色新增【%s】失败,角色键值已存在
|
||||
msg := fmt.Sprintf("Character addition [%s] failed, character key already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -105,27 +107,30 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
var body model.SysRole
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.RoleID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员角色
|
||||
if body.RoleID == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 判断角色名称是否唯一
|
||||
uniqueRoleName := s.sysRoleService.CheckUniqueRoleName(body.RoleName, body.RoleID)
|
||||
if !uniqueRoleName {
|
||||
msg := fmt.Sprintf("角色修改【%s】失败,角色名称已存在", body.RoleName)
|
||||
// 角色修改【%s】失败,角色名称已存在
|
||||
msg := fmt.Sprintf("Character modification [%s] failed, character name already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -133,7 +138,8 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
// 判断角色键值是否唯一
|
||||
uniqueRoleKey := s.sysRoleService.CheckUniqueRoleKey(body.RoleKey, body.RoleID)
|
||||
if !uniqueRoleKey {
|
||||
msg := fmt.Sprintf("角色修改【%s】失败,角色键值已存在", body.RoleName)
|
||||
// 角色修改【%s】失败,角色键值已存在
|
||||
msg := fmt.Sprintf("Character modification [%s] failed, character key already exists", body.RoleName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -153,7 +159,7 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
roleIds := c.Param("roleIds")
|
||||
if roleIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -166,7 +172,8 @@ func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
// 检查是否管理员角色
|
||||
for _, id := range uniqueIDs {
|
||||
if id == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -175,7 +182,7 @@ func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -191,26 +198,29 @@ func (s *SysRoleController) Status(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员角色
|
||||
if body.RoleID == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 与旧值相等不变更
|
||||
if role.Status == body.Status {
|
||||
c.JSON(200, result.ErrMsg("变更状态与旧值相等!"))
|
||||
// 变更状态与旧值相等!
|
||||
c.JSON(200, result.ErrMsg("The change status is equal to the old value!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -245,20 +255,22 @@ func (s *SysRoleController) DataScope(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员角色
|
||||
if body.RoleID == admin.ROLE_ID {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员角色"))
|
||||
// 不允许操作管理员角色
|
||||
c.JSON(200, result.ErrMsg("The administrator role is not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -286,14 +298,15 @@ func (s *SysRoleController) AuthUserAllocatedList(c *gin.Context) {
|
||||
querys := ctx.QueryMap(c)
|
||||
roleId, ok := querys["roleId"]
|
||||
if !ok || roleId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(roleId.(string))
|
||||
if role.RoleID != roleId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
// 没有可访问角色数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -316,7 +329,7 @@ func (s *SysRoleController) AuthUserChecked(c *gin.Context) {
|
||||
}
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -331,7 +344,7 @@ func (s *SysRoleController) AuthUserChecked(c *gin.Context) {
|
||||
// 检查是否存在
|
||||
role := s.sysRoleService.SelectRoleById(body.RoleID)
|
||||
if role.RoleID != body.RoleID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问角色数据!"))
|
||||
c.JSON(200, result.ErrMsg("There is no accessible role data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -357,7 +370,8 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "")
|
||||
data := s.sysRoleService.SelectRolePage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysRole)
|
||||
@@ -366,26 +380,26 @@ func (s *SysRoleController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("role_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "角色序号",
|
||||
"B1": "角色名称",
|
||||
"C1": "角色权限",
|
||||
"D1": "角色排序",
|
||||
"E1": "数据范围",
|
||||
"F1": "角色状态",
|
||||
"A1": "RoleID",
|
||||
"B1": "RoleName",
|
||||
"C1": "RoleKey",
|
||||
"D1": "RoleSort",
|
||||
"E1": "DataScope",
|
||||
"F1": "Status",
|
||||
}
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 数据范围
|
||||
dataScope := "空"
|
||||
dataScope := "Empty"
|
||||
if v, ok := roledatascope.RoleDataScope[row.DataScope]; ok {
|
||||
dataScope = v
|
||||
}
|
||||
// 角色状态
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.RoleID,
|
||||
|
||||
@@ -59,7 +59,7 @@ func (s *SysUserController) List(c *gin.Context) {
|
||||
func (s *SysUserController) Info(c *gin.Context) {
|
||||
userId := c.Param("userId")
|
||||
if userId == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 查询系统角色列表
|
||||
@@ -95,7 +95,7 @@ func (s *SysUserController) Info(c *gin.Context) {
|
||||
// 检查用户是否存在
|
||||
user := s.sysUserService.SelectUserById(userId)
|
||||
if user.UserID != userId {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
var body model.SysUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.UserID != "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&bodyPassword, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
body.Password = bodyPassword.Password
|
||||
@@ -145,7 +145,8 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
// 检查用户登录账号是否唯一
|
||||
uniqueUserName := s.sysUserService.CheckUniqueUserName(body.UserName, "")
|
||||
if !uniqueUserName {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,登录账号已存在", body.UserName)
|
||||
// 新增用户【%s】失败,登录账号已存在
|
||||
msg := fmt.Sprintf("Failed to add user [%s], login account already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -155,12 +156,14 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
if regular.ValidMobile(body.PhoneNumber) {
|
||||
uniquePhone := s.sysUserService.CheckUniquePhone(body.PhoneNumber, "")
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,手机号码已存在", body.UserName)
|
||||
// 新增用户【%s】失败,手机号码已存在
|
||||
msg := fmt.Sprintf("Failed to add user [%s], cell phone number already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,手机号码格式错误", body.UserName)
|
||||
// 新增用户【%s】失败,手机号码格式错误
|
||||
msg := fmt.Sprintf("Failed to add user [%s], wrong format of cell phone number", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -171,12 +174,14 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
if regular.ValidEmail(body.Email) {
|
||||
uniqueEmail := s.sysUserService.CheckUniqueEmail(body.Email, "")
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,邮箱已存在", body.UserName)
|
||||
// 新增用户【%s】失败,邮箱已存在
|
||||
msg := fmt.Sprintf("Failed to add user [%s], mailbox already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("新增用户【%s】失败,邮箱格式错误", body.UserName)
|
||||
// 新增用户【%s】失败,邮箱格式错误
|
||||
msg := fmt.Sprintf("Failed to add user [%s], mailbox format error", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -198,26 +203,29 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
var body model.SysUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.UserID == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员用户
|
||||
if config.IsAdmin(body.UserID) {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员用户"))
|
||||
// 不允许操作管理员用户
|
||||
c.JSON(200, result.ErrMsg("Administrator users are not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
user := s.sysUserService.SelectUserById(body.UserID)
|
||||
if user.UserID != body.UserID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查用户登录账号是否唯一
|
||||
uniqueUserName := s.sysUserService.CheckUniqueUserName(body.UserName, body.UserID)
|
||||
if !uniqueUserName {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,登录账号已存在", body.UserName)
|
||||
// 修改用户【%s】失败,登录账号已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], login account already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -227,12 +235,14 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
if regular.ValidMobile(body.PhoneNumber) {
|
||||
uniquePhone := s.sysUserService.CheckUniquePhone(body.PhoneNumber, body.UserID)
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码已存在", body.UserName)
|
||||
// 修改用户【%s】失败,手机号码已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], cell phone number already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,手机号码格式错误", body.UserName)
|
||||
// 修改用户【%s】失败,手机号码格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], wrong format of cell phone number", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -243,12 +253,14 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
if regular.ValidEmail(body.Email) {
|
||||
uniqueEmail := s.sysUserService.CheckUniqueEmail(body.Email, body.UserID)
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱已存在", body.UserName)
|
||||
// 修改用户【%s】失败,邮箱已存在
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox already exists", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("修改用户【%s】失败,邮箱格式错误", body.UserName)
|
||||
// 修改用户【%s】失败,邮箱格式错误
|
||||
msg := fmt.Sprintf("Failed to modify user [%s], mailbox format error", body.UserName)
|
||||
c.JSON(200, result.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
@@ -273,7 +285,7 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
func (s *SysUserController) Remove(c *gin.Context) {
|
||||
userIds := c.Param("userIds")
|
||||
if userIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
@@ -288,7 +300,8 @@ func (s *SysUserController) Remove(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("删除成功:%d", rows)
|
||||
// 删除成功:%d
|
||||
msg := fmt.Sprintf("Deleted successfully: %d", rows)
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
@@ -301,23 +314,26 @@ func (s *SysUserController) ResetPwd(c *gin.Context) {
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否管理员用户
|
||||
if config.IsAdmin(body.UserID) {
|
||||
c.JSON(200, result.ErrMsg("不允许操作管理员用户"))
|
||||
// 不允许操作管理员用户
|
||||
c.JSON(200, result.ErrMsg("Administrator users are not allowed to operate"))
|
||||
return
|
||||
}
|
||||
|
||||
user := s.sysUserService.SelectUserById(body.UserID)
|
||||
if user.UserID != body.UserID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
if !regular.ValidPassword(body.Password) {
|
||||
c.JSON(200, result.ErrMsg("登录密码至少包含大小写字母、数字、特殊符号,且不少于6位"))
|
||||
// 登录密码至少包含大小写字母、数字、特殊符号,且不少于6位
|
||||
c.JSON(200, result.ErrMsg("Login password contains at least upper and lower case letters, numbers, special symbols, and not less than 6 digits"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -344,20 +360,22 @@ func (s *SysUserController) Status(c *gin.Context) {
|
||||
Status string `json:"status" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否存在
|
||||
user := s.sysUserService.SelectUserById(body.UserID)
|
||||
if user.UserID != body.UserID {
|
||||
c.JSON(200, result.ErrMsg("没有权限访问用户数据!"))
|
||||
// 没有可访问用户数据!
|
||||
c.JSON(200, result.ErrMsg("There is no accessible user data!"))
|
||||
return
|
||||
}
|
||||
|
||||
// 与旧值相等不变更
|
||||
if user.Status == body.Status {
|
||||
c.JSON(200, result.ErrMsg("变更状态与旧值相等!"))
|
||||
// 变更状态与旧值相等!
|
||||
c.JSON(200, result.ErrMsg("The change status is equal to the old value!"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -384,7 +402,8 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
dataScopeSQL := ctx.LoginUserToDataScopeSQL(c, "d", "u")
|
||||
data := s.sysUserService.SelectUserPage(querys, dataScopeSQL)
|
||||
if data["total"].(int64) == 0 {
|
||||
c.JSON(200, result.ErrMsg("导出数据记录为空"))
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, result.ErrMsg("Export data record is empty"))
|
||||
return
|
||||
}
|
||||
rows := data["rows"].([]model.SysUser)
|
||||
@@ -393,18 +412,18 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
fileName := fmt.Sprintf("user_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
|
||||
// 第一行表头标题
|
||||
headerCells := map[string]string{
|
||||
"A1": "用户编号",
|
||||
"B1": "登录名称",
|
||||
"C1": "用户名称",
|
||||
"D1": "用户邮箱",
|
||||
"E1": "手机号码",
|
||||
"F1": "用户性别",
|
||||
"G1": "帐号状态",
|
||||
"H1": "部门编号",
|
||||
"I1": "部门名称",
|
||||
"J1": "部门负责人",
|
||||
"K1": "最后登录IP",
|
||||
"L1": "最后登录时间",
|
||||
"A1": "UserID",
|
||||
"B1": "UserName",
|
||||
"C1": "NickName",
|
||||
"D1": "Email",
|
||||
"E1": "PhoneNumber",
|
||||
"F1": "UserSex",
|
||||
"G1": "Status",
|
||||
"H1": "DeptID",
|
||||
"I1": "DeptName",
|
||||
"J1": "DeptLeader",
|
||||
"K1": "LoginIP",
|
||||
"L1": "LoginDate",
|
||||
}
|
||||
// 读取用户性别字典数据
|
||||
dictSysUserSex := s.sysDictDataService.SelectDictDataByType("sys_user_sex")
|
||||
@@ -413,7 +432,7 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 用户性别
|
||||
sysUserSex := "未知"
|
||||
sysUserSex := "unknown"
|
||||
for _, v := range dictSysUserSex {
|
||||
if row.Sex == v.DictValue {
|
||||
sysUserSex = v.DictLabel
|
||||
@@ -421,9 +440,9 @@ func (s *SysUserController) Export(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
// 帐号状态
|
||||
statusValue := "停用"
|
||||
statusValue := "deactivate"
|
||||
if row.Status == "1" {
|
||||
statusValue = "正常"
|
||||
statusValue = "normalcy"
|
||||
}
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.UserID,
|
||||
@@ -485,7 +504,7 @@ func (s *SysUserController) ImportData(c *gin.Context) {
|
||||
// 上传的文件
|
||||
formFile, err := c.FormFile("file")
|
||||
if err != nil || updateSupport == "" {
|
||||
c.JSON(400, result.CodeMsg(400, "参数错误"))
|
||||
c.JSON(400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/framework/constants/cachekey"
|
||||
"ems.agt/src/framework/redis"
|
||||
@@ -93,12 +93,13 @@ func (r *SysConfigImpl) DeleteConfigByIds(configIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
configs := r.sysConfigRepository.SelectConfigByIds(configIds)
|
||||
if len(configs) <= 0 {
|
||||
return 0, errors.New("没有权限访问参数配置数据!")
|
||||
return 0, fmt.Errorf("there is no accessible parameter configuration data")
|
||||
}
|
||||
for _, config := range configs {
|
||||
// 检查是否为内置参数
|
||||
if config.ConfigType == "Y" {
|
||||
return 0, errors.New(config.ConfigID + " 配置参数属于内置参数,禁止删除!")
|
||||
// 【%s】 配置参数属于内置参数,禁止删除!
|
||||
return 0, fmt.Errorf("[%s] Configuration parameters are built-in parameters and their deletion is prohibited", config.ConfigID)
|
||||
}
|
||||
// 清除缓存
|
||||
r.clearConfigCache(config.ConfigKey)
|
||||
@@ -107,7 +108,8 @@ func (r *SysConfigImpl) DeleteConfigByIds(configIds []string) (int64, error) {
|
||||
rows := r.sysConfigRepository.DeleteConfigByIds(configIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除参数配置信息失败!")
|
||||
// 删除参数配置信息失败!
|
||||
return 0, fmt.Errorf("failed to delete parameter configuration information")
|
||||
}
|
||||
|
||||
// ResetConfigCache 重置参数缓存数据
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/modules/system/model"
|
||||
"ems.agt/src/modules/system/repository"
|
||||
@@ -77,7 +77,8 @@ func (r *SysDictDataImpl) DeleteDictDataByCodes(dictCodes []string) (int64, erro
|
||||
// 检查是否存在
|
||||
dictDatas := r.sysDictDataRepository.SelectDictDataByCodes(dictCodes)
|
||||
if len(dictDatas) <= 0 {
|
||||
return 0, errors.New("没有权限访问字典编码数据!")
|
||||
// 没有可访问字典编码数据!
|
||||
return 0, fmt.Errorf("there is no accessible dictionary-encoded data")
|
||||
}
|
||||
if len(dictDatas) == len(dictCodes) {
|
||||
for _, v := range dictDatas {
|
||||
@@ -88,7 +89,8 @@ func (r *SysDictDataImpl) DeleteDictDataByCodes(dictCodes []string) (int64, erro
|
||||
rows := r.sysDictDataRepository.DeleteDictDataByCodes(dictCodes)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除字典数据信息失败!")
|
||||
// 删除字典数据信息失败!
|
||||
return 0, fmt.Errorf("failed to delete dictionary data information")
|
||||
}
|
||||
|
||||
// InsertDictData 新增字典数据信息
|
||||
|
||||
@@ -2,7 +2,6 @@ package service
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/framework/constants/cachekey"
|
||||
@@ -107,14 +106,15 @@ func (r *SysDictTypeImpl) DeleteDictTypeByIDs(dictIDs []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
dictTypes := r.sysDictTypeRepository.SelectDictTypeByIDs(dictIDs)
|
||||
if len(dictTypes) <= 0 {
|
||||
return 0, errors.New("没有权限访问字典类型数据!")
|
||||
// 没有可访问字典类型数据!
|
||||
return 0, fmt.Errorf("there is no accessible dictionary type data")
|
||||
}
|
||||
for _, v := range dictTypes {
|
||||
// 字典类型下级含有数据
|
||||
useCount := r.sysDictDataRepository.CountDictDataByType(v.DictType)
|
||||
if useCount > 0 {
|
||||
msg := fmt.Sprintf("【%s】存在字典数据,不能删除", v.DictName)
|
||||
return 0, errors.New(msg)
|
||||
// 【%s】存在字典数据,不能删除
|
||||
return 0, fmt.Errorf("[%s] dictionary data exists and cannot be deleted", v.DictName)
|
||||
}
|
||||
// 清除缓存
|
||||
r.ClearDictCache(v.DictType)
|
||||
@@ -123,7 +123,8 @@ func (r *SysDictTypeImpl) DeleteDictTypeByIDs(dictIDs []string) (int64, error) {
|
||||
rows := r.sysDictTypeRepository.DeleteDictTypeByIDs(dictIDs)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除字典数据信息失败!")
|
||||
// 删除字典数据信息失败!
|
||||
return 0, fmt.Errorf("failed to delete dictionary data information")
|
||||
}
|
||||
|
||||
// ResetDictCache 重置字典缓存数据
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/modules/system/model"
|
||||
"ems.agt/src/modules/system/repository"
|
||||
@@ -55,17 +55,19 @@ func (r *SysNoticeImpl) DeleteNoticeByIds(noticeIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
notices := r.sysNoticeRepository.SelectNoticeByIds(noticeIds)
|
||||
if len(notices) <= 0 {
|
||||
return 0, errors.New("没有权限访问公告信息数据!")
|
||||
return 0, fmt.Errorf("there is no accessible bulletin information data")
|
||||
}
|
||||
for _, notice := range notices {
|
||||
// 检查是否为已删除
|
||||
if notice.DelFlag == "1" {
|
||||
return 0, errors.New(notice.NoticeID + " 公告信息已经删除!")
|
||||
// 【%s】公告信息已经删除!
|
||||
return 0, fmt.Errorf("the [%s] announcement message has been deleted", notice.NoticeID)
|
||||
}
|
||||
}
|
||||
if len(notices) == len(noticeIds) {
|
||||
rows := r.sysNoticeRepository.DeleteNoticeByIds(noticeIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除公告信息失败!")
|
||||
// 删除公告信息失败!
|
||||
return 0, fmt.Errorf("failed to delete the announcement message")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/modules/system/model"
|
||||
@@ -54,20 +53,22 @@ func (r *SysPostImpl) DeletePostByIds(postIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
posts := r.sysPostRepository.SelectPostByIds(postIds)
|
||||
if len(posts) <= 0 {
|
||||
return 0, errors.New("没有权限访问岗位数据!")
|
||||
// 没有可访问岗位数据!
|
||||
return 0, fmt.Errorf("there is no accessible post data")
|
||||
}
|
||||
for _, post := range posts {
|
||||
useCount := r.sysUserPostRepository.CountUserPostByPostId(post.PostID)
|
||||
if useCount > 0 {
|
||||
msg := fmt.Sprintf("【%s】已分配给用户,不能删除", post.PostName)
|
||||
return 0, errors.New(msg)
|
||||
// 【%s】已分配给用户,不能删除
|
||||
return 0, fmt.Errorf("[%s] has been assigned to a user and cannot be deleted", post.PostName)
|
||||
}
|
||||
}
|
||||
if len(posts) == len(postIds) {
|
||||
rows := r.sysPostRepository.DeletePostByIds(postIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除岗位信息失败!")
|
||||
// 删除岗位信息失败!
|
||||
return 0, fmt.Errorf("failed to delete post information")
|
||||
}
|
||||
|
||||
// UpdatePost 修改岗位信息
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/modules/system/model"
|
||||
@@ -99,18 +98,20 @@ func (r *SysRoleImpl) DeleteRoleByIds(roleIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
roles := r.sysRoleRepository.SelectRoleByIds(roleIds)
|
||||
if len(roles) <= 0 {
|
||||
return 0, errors.New("没有权限访问角色数据!")
|
||||
// 没有可访问角色数据!
|
||||
return 0, fmt.Errorf("there is no accessible role data")
|
||||
}
|
||||
for _, role := range roles {
|
||||
// 检查是否为已删除
|
||||
if role.DelFlag == "1" {
|
||||
return 0, errors.New(role.RoleID + " 角色信息已经删除!")
|
||||
// 【%s】角色信息已经删除!
|
||||
return 0, fmt.Errorf("[%s] Role information has been deleted", role.RoleID)
|
||||
}
|
||||
// 检查分配用户
|
||||
userCount := r.sysUserRoleRepository.CountUserRoleByRoleId(role.RoleID)
|
||||
if userCount > 0 {
|
||||
msg := fmt.Sprintf("【%s】已分配给用户,不能删除", role.RoleName)
|
||||
return 0, errors.New(msg)
|
||||
// 【%s】已分配给用户,不能删除
|
||||
return 0, fmt.Errorf("[%s] has been assigned to a user and cannot be deleted", role.RoleName)
|
||||
}
|
||||
}
|
||||
if len(roles) == len(roleIds) {
|
||||
@@ -121,7 +122,8 @@ func (r *SysRoleImpl) DeleteRoleByIds(roleIds []string) (int64, error) {
|
||||
rows := r.sysRoleRepository.DeleteRoleByIds(roleIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除角色信息失败!")
|
||||
// 删除角色信息失败!
|
||||
return 0, fmt.Errorf("failed to delete role information")
|
||||
}
|
||||
|
||||
// CheckUniqueRoleName 校验角色名称是否唯一
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -138,7 +137,8 @@ func (r *SysUserImpl) DeleteUserByIds(userIds []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
users := r.sysUserRepository.SelectUserByIds(userIds)
|
||||
if len(users) <= 0 {
|
||||
return 0, errors.New("没有权限访问用户数据!")
|
||||
// 没有可访问用户数据!
|
||||
return 0, fmt.Errorf("there is no accessible user data")
|
||||
}
|
||||
if len(users) == len(userIds) {
|
||||
// 删除用户与角色关联
|
||||
@@ -150,7 +150,7 @@ func (r *SysUserImpl) DeleteUserByIds(userIds []string) (int64, error) {
|
||||
rows := r.sysUserRepository.DeleteUserByIds(userIds)
|
||||
return rows, nil
|
||||
}
|
||||
return 0, errors.New("删除用户信息失败!")
|
||||
return 0, fmt.Errorf("failed to delete user information")
|
||||
}
|
||||
|
||||
// CheckUniqueUserName 校验用户名称是否唯一
|
||||
@@ -211,7 +211,8 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
if !ownItem {
|
||||
mustItemArrStr := strings.Join(mustItemArr, "、")
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, fmt.Sprintf("表格中必填列表项,%s}", mustItemArrStr))
|
||||
// 表格中必填列表项,
|
||||
failureMsgArr = append(failureMsgArr, fmt.Sprintf("Required list items in the form, %s}", mustItemArrStr))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -224,7 +225,7 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
}
|
||||
}
|
||||
sysUserStatus := common.STATUS_NO
|
||||
if row["G"] == "正常" {
|
||||
if row["G"] == "Normal" {
|
||||
sysUserStatus = common.STATUS_YES
|
||||
}
|
||||
|
||||
@@ -246,13 +247,15 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
if regular.ValidMobile(newSysUser.PhoneNumber) {
|
||||
uniquePhone := r.CheckUniquePhone(newSysUser.PhoneNumber, "")
|
||||
if !uniquePhone {
|
||||
msg := fmt.Sprintf("用户编号:%s 手机号码 %s 已存在", row["A"], row["E"])
|
||||
// 用户编号:%s 手机号码 %s 已存在
|
||||
msg := fmt.Sprintf("UserID: %s PhoneNumber: %s pre-existing", row["A"], row["E"])
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, msg)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("用户编号:%s 手机号码 %s 格式错误", row["A"], row["E"])
|
||||
// 用户编号:%s 手机号码 %s 格式错误
|
||||
msg := fmt.Sprintf("UserID: %s PhoneNumber: %s formatting error", row["A"], row["E"])
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, msg)
|
||||
continue
|
||||
@@ -264,13 +267,15 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
if regular.ValidEmail(newSysUser.Email) {
|
||||
uniqueEmail := r.CheckUniqueEmail(newSysUser.Email, "")
|
||||
if !uniqueEmail {
|
||||
msg := fmt.Sprintf("用户编号:%s 用户邮箱 %s 已存在", row["A"], row["D"])
|
||||
// 用户编号:%s 用户邮箱 %s 已存在
|
||||
msg := fmt.Sprintf("UserID: %s Email: %s pre-existing", row["A"], row["D"])
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, msg)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
msg := fmt.Sprintf("用户编号:%s 用户邮箱 %s 格式错误", row["A"], row["D"])
|
||||
// 用户编号:%s 用户邮箱 %s 格式错误
|
||||
msg := fmt.Sprintf("UserID: %s Email: %s formatting error", row["A"], row["D"])
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, msg)
|
||||
continue
|
||||
@@ -283,11 +288,13 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
newSysUser.CreateBy = operName
|
||||
insertId := r.InsertUser(newSysUser)
|
||||
if insertId != "" {
|
||||
msg := fmt.Sprintf("用户编号:%s 登录名称 %s 导入成功", row["A"], row["B"])
|
||||
// 用户编号:%s 登录名称 %s 导入成功
|
||||
msg := fmt.Sprintf("UserID: %s UserName: %s import successfully", row["A"], row["B"])
|
||||
successNum++
|
||||
successMsgArr = append(successMsgArr, msg)
|
||||
} else {
|
||||
msg := fmt.Sprintf("用户编号:%s 登录名称 %s 导入失败", row["A"], row["B"])
|
||||
// 用户编号:%s 登录名称 %s 导入失败
|
||||
msg := fmt.Sprintf("UserID: %s UserName: %s import failure", row["A"], row["B"])
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, msg)
|
||||
}
|
||||
@@ -300,11 +307,13 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
newSysUser.UpdateBy = operName
|
||||
rows := r.UpdateUser(newSysUser)
|
||||
if rows > 0 {
|
||||
msg := fmt.Sprintf("用户编号:%s 登录名称 %s 更新成功", row["A"], row["B"])
|
||||
// 用户编号:%s 登录名称 %s 更新成功
|
||||
msg := fmt.Sprintf("UserID: %s UserName: %s Update Successful", row["A"], row["B"])
|
||||
successNum++
|
||||
successMsgArr = append(successMsgArr, msg)
|
||||
} else {
|
||||
msg := fmt.Sprintf("用户编号:%s 登录名称 %s 更新失败", row["A"], row["B"])
|
||||
// 用户编号:%s 登录名称 %s 更新失败
|
||||
msg := fmt.Sprintf("UserID: %s UserName: %s Update Failed", row["A"], row["B"])
|
||||
failureNum++
|
||||
failureMsgArr = append(failureMsgArr, msg)
|
||||
}
|
||||
@@ -313,10 +322,12 @@ func (r *SysUserImpl) ImportUser(rows []map[string]string, isUpdateSupport bool,
|
||||
}
|
||||
|
||||
if failureNum > 0 {
|
||||
failureMsgArr = append([]string{fmt.Sprintf("很抱歉,导入失败!共 %d 条数据格式不正确,错误如下:", failureNum)}, failureMsgArr...)
|
||||
// 很抱歉,导入失败!共 %d 条数据格式不正确,错误如下:
|
||||
failureMsgArr = append([]string{fmt.Sprintf("Sorry, the import failed! A total of %d entries were formatted incorrectly with the following error:", failureNum)}, failureMsgArr...)
|
||||
return strings.Join(failureMsgArr, "<br/>")
|
||||
}
|
||||
|
||||
successMsgArr = append([]string{fmt.Sprintf("恭喜您,数据已全部导入成功!共 %d 条,数据如下:", successNum)}, successMsgArr...)
|
||||
// 恭喜您,数据已全部导入成功!共 %d 条,数据如下:
|
||||
successMsgArr = append([]string{fmt.Sprintf("Congratulations, the data has been imported successfully! Total %d entries, data below:", successNum)}, successMsgArr...)
|
||||
return strings.Join(successMsgArr, "<br/>")
|
||||
}
|
||||
|
||||
@@ -31,34 +31,34 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysConfigGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:config:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Parameter Configuration", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysConfig.Add,
|
||||
)
|
||||
sysConfigGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:config:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Parameter Configuration", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysConfig.Edit,
|
||||
)
|
||||
sysConfigGroup.DELETE("/:configIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:config:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Parameter Configuration", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysConfig.Remove,
|
||||
)
|
||||
sysConfigGroup.PUT("/refreshCache",
|
||||
repeat.RepeatSubmit(5),
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:config:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Parameter Configuration", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
controller.NewSysConfig.RefreshCache,
|
||||
)
|
||||
sysConfigGroup.GET("/configKey/:configKey", controller.NewSysConfig.ConfigKey)
|
||||
sysConfigGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:config:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Parameter Configuration", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysConfig.Export,
|
||||
)
|
||||
sysConfigGroup.PUT("/changeValue",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:config:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Parameter Configuration", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysConfig.ConfigValue,
|
||||
)
|
||||
}
|
||||
@@ -76,17 +76,17 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysDeptGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dept:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("部门信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Sectoral", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysDept.Add,
|
||||
)
|
||||
sysDeptGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dept:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("部门信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Sectoral", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysDept.Edit,
|
||||
)
|
||||
sysDeptGroup.DELETE("/:deptId",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dept:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("部门信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Sectoral", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysDept.Remove,
|
||||
)
|
||||
sysDeptGroup.GET("/list/exclude/:deptId",
|
||||
@@ -116,17 +116,17 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysDictDataGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典数据信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Data", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysDictData.Add,
|
||||
)
|
||||
sysDictDataGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典数据信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Data", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysDictData.Edit,
|
||||
)
|
||||
sysDictDataGroup.DELETE("/:dictCodes",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典数据信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Data", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysDictData.Remove,
|
||||
)
|
||||
sysDictDataGroup.GET("/type/:dictType",
|
||||
@@ -135,7 +135,7 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysDictDataGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典类型信息", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Type", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysDictData.Export,
|
||||
)
|
||||
}
|
||||
@@ -153,22 +153,22 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysDictTypeGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典类型信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Type", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysDictType.Add,
|
||||
)
|
||||
sysDictTypeGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典类型信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Type", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysDictType.Edit,
|
||||
)
|
||||
sysDictTypeGroup.DELETE("/:dictIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典类型信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Type", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysDictType.Remove,
|
||||
)
|
||||
sysDictTypeGroup.PUT("/refreshCache",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典类型信息", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Type", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
controller.NewSysDictType.RefreshCache,
|
||||
)
|
||||
sysDictTypeGroup.GET("/getDictOptionselect",
|
||||
@@ -177,7 +177,7 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysDictTypeGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:dict:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("字典类型信息", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Dictionary Type", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysDictType.Export,
|
||||
)
|
||||
}
|
||||
@@ -195,17 +195,17 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysMenuGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:menu:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("菜单信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Menu", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysMenu.Add,
|
||||
)
|
||||
sysMenuGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:menu:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("菜单信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Menu", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysMenu.Edit,
|
||||
)
|
||||
sysMenuGroup.DELETE("/:menuId",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:menu:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("菜单信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Menu", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysMenu.Remove,
|
||||
)
|
||||
sysMenuGroup.GET("/treeSelect",
|
||||
@@ -231,17 +231,17 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysNoticeGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:notice:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Notice", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysNotice.Add,
|
||||
)
|
||||
sysNoticeGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:notice:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Notice", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysNotice.Edit,
|
||||
)
|
||||
sysNoticeGroup.DELETE("/:noticeIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:notice:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("参数配置信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Notice", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysNotice.Remove,
|
||||
)
|
||||
}
|
||||
@@ -259,17 +259,17 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysPostGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:post:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("岗位信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Post", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysPost.Add,
|
||||
)
|
||||
sysPostGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:post:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("岗位信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Post", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysPost.Edit,
|
||||
)
|
||||
sysPostGroup.DELETE("/:postIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:post:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("岗位信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Post", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysPost.Remove,
|
||||
)
|
||||
sysPostGroup.POST("/export",
|
||||
@@ -291,12 +291,12 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysProfileGroup.PUT("/updatePwd",
|
||||
middleware.PreAuthorize(nil),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("个人信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Personal", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysProfile.UpdatePwd,
|
||||
)
|
||||
sysProfileGroup.POST("/avatar",
|
||||
middleware.PreAuthorize(nil),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户头像", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Personal Avatar", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysProfile.Avatar,
|
||||
)
|
||||
}
|
||||
@@ -314,29 +314,29 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysRoleGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:role:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysRole.Add,
|
||||
)
|
||||
sysRoleGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:role:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysRole.Edit,
|
||||
)
|
||||
sysRoleGroup.DELETE("/:roleIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:role:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysRole.Remove,
|
||||
)
|
||||
sysRoleGroup.PUT("/changeStatus",
|
||||
repeat.RepeatSubmit(5),
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:role:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysRole.Status,
|
||||
)
|
||||
sysRoleGroup.PUT("/dataScope",
|
||||
repeat.RepeatSubmit(5),
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysRole.DataScope,
|
||||
)
|
||||
sysRoleGroup.GET("/authUser/allocatedList",
|
||||
@@ -345,12 +345,12 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysRoleGroup.PUT("/authUser/checked",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_GRANT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_GRANT)),
|
||||
controller.NewSysRole.AuthUserChecked,
|
||||
)
|
||||
sysRoleGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("角色信息", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Role", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysRole.Export,
|
||||
)
|
||||
}
|
||||
@@ -368,33 +368,33 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysUserGroup.POST("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:add"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysUser.Add,
|
||||
)
|
||||
sysUserGroup.PUT("",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysUser.Edit,
|
||||
)
|
||||
sysUserGroup.DELETE("/:userIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysUser.Remove,
|
||||
)
|
||||
sysUserGroup.PUT("/resetPwd",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:resetPwd"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysUser.ResetPwd,
|
||||
)
|
||||
sysUserGroup.PUT("/changeStatus",
|
||||
repeat.RepeatSubmit(5),
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:edit"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_UPDATE)),
|
||||
controller.NewSysUser.Status,
|
||||
)
|
||||
sysUserGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysUser.Export,
|
||||
)
|
||||
sysUserGroup.GET("/importTemplate",
|
||||
@@ -403,7 +403,7 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysUserGroup.POST("/importData",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:user:import"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("用户信息", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("User", collectlogs.BUSINESS_TYPE_INSERT)),
|
||||
controller.NewSysUser.ImportData,
|
||||
)
|
||||
}
|
||||
@@ -417,17 +417,17 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysOperLogGroup.DELETE("/:operIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:operate:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("操作日志", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Operation", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysLogOperate.Remove,
|
||||
)
|
||||
sysOperLogGroup.DELETE("/clean",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:operate:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("操作日志", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Operation", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
controller.NewSysLogOperate.Clean,
|
||||
)
|
||||
sysOperLogGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:operate:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("操作日志", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("Operation", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysLogOperate.Export,
|
||||
)
|
||||
}
|
||||
@@ -441,22 +441,22 @@ func Setup(router *gin.Engine) {
|
||||
)
|
||||
sysLogininforGroup.DELETE("/:loginIds",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:login:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("系统登录信息", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("System Login", collectlogs.BUSINESS_TYPE_DELETE)),
|
||||
controller.NewSysLogLogin.Remove,
|
||||
)
|
||||
sysLogininforGroup.DELETE("/clean",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:login:remove"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("系统登录信息", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("System Login", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
controller.NewSysLogLogin.Clean,
|
||||
)
|
||||
sysLogininforGroup.PUT("/unlock/:userName",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:login:unlock"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("系统登录信息", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("System Login", collectlogs.BUSINESS_TYPE_CLEAN)),
|
||||
controller.NewSysLogLogin.Unlock,
|
||||
)
|
||||
sysLogininforGroup.POST("/export",
|
||||
middleware.PreAuthorize(map[string][]string{"hasPerms": {"system:log:login:export"}}),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("系统登录信息", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("System Login", collectlogs.BUSINESS_TYPE_EXPORT)),
|
||||
controller.NewSysLogLogin.Export,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user