...
|
...
|
@@ -137,6 +137,30 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error |
|
|
return r, nil
|
|
|
}
|
|
|
|
|
|
func RoleGroupEdit(id int64, name string) (*protocol.ResponseRoleInfo, error) {
|
|
|
var (
|
|
|
err error
|
|
|
roleinfo *models.Role
|
|
|
)
|
|
|
roleinfo, err = models.GetRoleById(id)
|
|
|
if err != nil {
|
|
|
log.Error("获取角色数据失败:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if roleinfo.Types != models.ROLETYPES_GROUP {
|
|
|
log.Error("不是角色组")
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
roleinfo.Name = name
|
|
|
models.UpdateRoleById(roleinfo, []string{"Name"})
|
|
|
r := &protocol.ResponseRoleInfo{
|
|
|
ID: roleinfo.Id,
|
|
|
Name: roleinfo.Name,
|
|
|
Types: roleinfo.Types,
|
|
|
}
|
|
|
return r, nil
|
|
|
}
|
|
|
|
|
|
func RoleGroupDelete(param protocol.RequestRoleDelete) error {
|
|
|
var (
|
|
|
roleinfo *models.Role
|
...
|
...
|
@@ -219,7 +243,7 @@ func GetRoleList(adminid int64, companyId int64) ([]protocol.RoleGroup, error) { |
|
|
|
|
|
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
|
|
|
const (
|
|
|
dataSql string = `SELECT id,name,is_default,pid FROM role WHERE company_id=? AND pid=? and delete_at=0 `
|
|
|
dataSql string = `SELECT id,name,is_default,pid,types FROM role WHERE company_id=? AND pid=? and delete_at=0 `
|
|
|
)
|
|
|
var (
|
|
|
err error
|
...
|
...
|
@@ -231,7 +255,7 @@ func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) { |
|
|
|
|
|
func getRoleGroupByCompany(companyid int64) ([]protocol.RoleInfo, error) {
|
|
|
const (
|
|
|
datasql string = `SELECT id,name,is_default FROM role WHERE company_id=? AND types=? AND delete_at=0 `
|
|
|
datasql string = `SELECT id,name,is_default,types FROM role WHERE company_id=? AND types=? AND delete_at=0 `
|
|
|
)
|
|
|
var (
|
|
|
err error
|
...
|
...
|
|