|
|
@ -17,9 +17,9 @@ func AddBaseRole(ms models.TBaseRole) (int64, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//检查一个角色编码是不是已存在
|
|
|
|
//检查一个角色编码是不是已存在
|
|
|
|
func ExistRoleCode(roleCode string) (bool, error) {
|
|
|
|
func ExistRoleCode(roleId string, roleCode string) (bool, error) {
|
|
|
|
sql := `select count(1) as c from t_base_role where b_use=1 and role_code=?`
|
|
|
|
sql := `select count(1) as c from t_base_role where b_use=1 and role_code=? and role_id<>?`
|
|
|
|
list, err := db.SQL(sql, roleCode).Query().List()
|
|
|
|
list, err := db.SQL(sql, roleCode, roleId).Query().List()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return false, err
|
|
|
|
return false, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|