|
@@ -137,6 +137,30 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error |
|
@@ -137,6 +137,30 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error |
137
|
return r, nil
|
137
|
return r, nil
|
138
|
}
|
138
|
}
|
139
|
|
139
|
|
|
|
140
|
+func RoleGroupEdit(id int64, name string) (*protocol.ResponseRoleInfo, error) {
|
|
|
141
|
+ var (
|
|
|
142
|
+ err error
|
|
|
143
|
+ roleinfo *models.Role
|
|
|
144
|
+ )
|
|
|
145
|
+ roleinfo, err = models.GetRoleById(id)
|
|
|
146
|
+ if err != nil {
|
|
|
147
|
+ log.Error("获取角色数据失败:%s", err)
|
|
|
148
|
+ return nil, protocol.NewErrWithMessage("1")
|
|
|
149
|
+ }
|
|
|
150
|
+ if roleinfo.Types != models.ROLETYPES_GROUP {
|
|
|
151
|
+ log.Error("不是角色组")
|
|
|
152
|
+ return nil, protocol.NewErrWithMessage("1")
|
|
|
153
|
+ }
|
|
|
154
|
+ roleinfo.Name = name
|
|
|
155
|
+ models.UpdateRoleById(roleinfo, []string{"Name"})
|
|
|
156
|
+ r := &protocol.ResponseRoleInfo{
|
|
|
157
|
+ ID: roleinfo.Id,
|
|
|
158
|
+ Name: roleinfo.Name,
|
|
|
159
|
+ Types: roleinfo.Types,
|
|
|
160
|
+ }
|
|
|
161
|
+ return r, nil
|
|
|
162
|
+}
|
|
|
163
|
+
|
140
|
func RoleGroupDelete(param protocol.RequestRoleDelete) error {
|
164
|
func RoleGroupDelete(param protocol.RequestRoleDelete) error {
|
141
|
var (
|
165
|
var (
|
142
|
roleinfo *models.Role
|
166
|
roleinfo *models.Role
|
|
@@ -219,7 +243,7 @@ func GetRoleList(adminid int64, companyId int64) ([]protocol.RoleGroup, error) { |
|
@@ -219,7 +243,7 @@ func GetRoleList(adminid int64, companyId int64) ([]protocol.RoleGroup, error) { |
219
|
|
243
|
|
220
|
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
|
244
|
func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) {
|
221
|
const (
|
245
|
const (
|
222
|
- dataSql string = `SELECT id,name,is_default,pid FROM role WHERE company_id=? AND pid=? and delete_at=0 `
|
246
|
+ dataSql string = `SELECT id,name,is_default,pid,types FROM role WHERE company_id=? AND pid=? and delete_at=0 `
|
223
|
)
|
247
|
)
|
224
|
var (
|
248
|
var (
|
225
|
err error
|
249
|
err error
|
|
@@ -231,7 +255,7 @@ func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) { |
|
@@ -231,7 +255,7 @@ func getRoleInfoByPid(companyid int64, pid int64) ([]protocol.RoleInfo, error) { |
231
|
|
255
|
|
232
|
func getRoleGroupByCompany(companyid int64) ([]protocol.RoleInfo, error) {
|
256
|
func getRoleGroupByCompany(companyid int64) ([]protocol.RoleInfo, error) {
|
233
|
const (
|
257
|
const (
|
234
|
- datasql string = `SELECT id,name,is_default FROM role WHERE company_id=? AND types=? AND delete_at=0 `
|
258
|
+ datasql string = `SELECT id,name,is_default,types FROM role WHERE company_id=? AND types=? AND delete_at=0 `
|
235
|
)
|
259
|
)
|
236
|
var (
|
260
|
var (
|
237
|
err error
|
261
|
err error
|