style: 错误信息英文返回-system 模块路由

This commit is contained in:
TsMask
2023-11-08 14:56:36 +08:00
parent ae7f2d050c
commit a102f772cb
21 changed files with 460 additions and 342 deletions

View File

@@ -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 修改岗位信息