合并冲突

This commit is contained in:
momo 2023-11-14 11:50:41 +08:00
commit c19dbc1a41
20 changed files with 99 additions and 648 deletions

View File

@ -2,48 +2,46 @@ package gmodel
import (
"context"
"time"
"errors"
"gorm.io/gorm"
)
func (d *LdapDepartmentModel) GetOneById(ctx context.Context, id int64) (resp LdapDepartment, err error) {
db := d.db.WithContext(ctx).Model(&FsShoppingCart{})
return resp, db.Take(&resp).Error
}
func (d *LdapDepartmentModel) GetList(ctx context.Context, page, pageSize int, sort string) (resp []LdapDepartment, total int64, err error) {
db := d.db.WithContext(ctx).Model(&FsShoppingCart{})
// 获取列表
func (d *LdapDepartmentModel) GetAll(ctx context.Context, sort string) (resp []LdapDepartment, total int64, err error) {
db := d.db.WithContext(ctx).Model(&LdapDepartment{})
if sort != "" {
db = db.Order(sort)
}
//查询数量
if err = db.Limit(1).Count(&total).Error; err != nil {
if err = db.Count(&total).Error; err != nil {
return nil, 0, err
}
offset := (page - 1) * pageSize
err = db.Offset(offset).Limit(pageSize).Find(&resp).Error
err = db.Find(&resp).Error
return resp, total, err
}
// InsertOne 单个插入
func (d *LdapDepartmentModel) InsertOne(ctx context.Context, insertData LdapDepartment) error {
var nowTime = time.Now().UTC()
insertData.Ctime = &nowTime
insertData.Utime = &nowTime
result := d.db.WithContext(ctx).Model(&LdapDepartment{}).Create(&insertData)
if result.Error != nil {
return result.Error
} else {
return nil
}
func (d *LdapDepartmentModel) FindOne(ctx context.Context, id int64) (resp *LdapDepartment, err error) {
err = d.db.WithContext(ctx).Model(&LdapDepartment{}).Where("id = ?", id).Take(&resp).Error
return resp, err
}
// UpdateOne 单个更新
func (d *LdapDepartmentModel) UpdateOne(ctx context.Context, Department LdapDepartment, updateData map[string]interface{}) error {
result := d.db.WithContext(ctx).Model(&Department).Updates(updateData)
if result.Error != nil {
return result.Error
} else {
return nil
}
// 更新
func (d *LdapDepartmentModel) Update(ctx context.Context, id int64, data *LdapDepartment) error {
return d.db.WithContext(ctx).Model(&LdapDepartment{}).Where("id = ?", id).Updates(&data).Error
}
// 创建
func (d *LdapDepartmentModel) Create(ctx context.Context, data *LdapDepartment) error {
return d.db.WithContext(ctx).Model(&LdapDepartment{}).Create(&data).Error
}
func (d *LdapDepartmentModel) CreateOrUpdate(ctx context.Context, id int64, data *LdapDepartment) error {
_, err := d.FindOne(ctx, id)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return d.Create(ctx, data)
}
return err
}
return d.Update(ctx, id, data)
}

View File

@ -12,7 +12,7 @@ type LdapUsers struct {
Password *string `gorm:"default:'';" json:"password"` //
Nickname *string `gorm:"default:'';" json:"nickname"` //
GivenName *string `gorm:"default:'';" json:"given_name"` //
Email *string `gorm:"default:'';" json:"email"` //
Email *string `gorm:"unique_key;default:'';" json:"email"` //
JobNumber *string `gorm:"default:'';" json:"job_number"` //
Mobile *string `gorm:"unique_key;default:'';" json:"mobile"` //
Avatar *string `gorm:"default:'';" json:"avatar"` //

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
)
func AddDepartmentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AddDepartmentReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewAddDepartmentLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.AddDepartment(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
)
func AddMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AddMenuHandler
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewAddMenuLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.AddMenu(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
)
func DeleteDepartmentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteDepartmentReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewDeleteDepartmentLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.DeleteDepartment(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
)
func EditMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.EditMenuHandler
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewEditMenuLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.EditMenu(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -14,7 +14,7 @@ import (
func GetDepartmentsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetDepartmentsReq
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
)
func GetMenusTreeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetMenusTreeReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewGetMenusTreeLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.GetMenusTree(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -13,39 +13,14 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Method: http.MethodGet,
Path: "/api/ldap-admin/get_departments",
Handler: GetDepartmentsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/ldap-admin/add_department",
Handler: AddDepartmentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/ldap-admin/edit_department",
Handler: EditDepartmentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/ldap-admin/delete_department",
Handler: DeleteDepartmentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/ldap-admin/get_menus_tree",
Handler: GetMenusTreeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/ldap-admin/add_menu",
Handler: AddMenuHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/ldap-admin/edit_menu",
Handler: EditMenuHandler(serverCtx),
Path: "/api/ldap-admin/save_department",
Handler: SaveDepartmentHandler(serverCtx),
},
},
)

View File

@ -11,22 +11,22 @@ import (
"fusenapi/server/ldap-admin/internal/types"
)
func EditDepartmentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func SaveDepartmentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.EditDepartmentReq
var req types.SaveDepartmentReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewEditDepartmentLogic(r.Context(), svcCtx)
l := logic.NewSaveDepartmentLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.EditDepartment(&req, userinfo)
resp := l.SaveDepartment(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@ -1,62 +0,0 @@
package logic
import (
"errors"
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
)
type AddDepartmentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAddDepartmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddDepartmentLogic {
return &AddDepartmentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *AddDepartmentLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *AddDepartmentLogic) AddDepartment(req *types.AddDepartmentReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if req.ParentId > 0 {
_, err := l.svcCtx.AllModels.LdapDepartment.GetOneById(l.ctx, req.ParentId)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
basic.CodeServiceErr.Message = "查询不到上级"
} else {
basic.CodeServiceErr.Message = "系统出错"
}
return resp.SetStatus(basic.CodeServiceErr)
}
}
err := l.svcCtx.AllModels.LdapDepartment.InsertOne(l.ctx, gmodel.LdapDepartment{
Name: &req.Name,
})
if err != nil {
return resp.SetStatus(basic.CodeServiceErr)
}
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *AddDepartmentLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -1,43 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type AddMenuLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAddMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddMenuLogic {
return &AddMenuLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *AddMenuLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *AddMenuLogic) AddMenu(req *types.AddMenuHandler, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *AddMenuLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -1,43 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteDepartmentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteDepartmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDepartmentLogic {
return &DeleteDepartmentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *DeleteDepartmentLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *DeleteDepartmentLogic) DeleteDepartment(req *types.DeleteDepartmentReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *DeleteDepartmentLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -1,43 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type EditMenuLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewEditMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditMenuLogic {
return &EditMenuLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *EditMenuLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *EditMenuLogic) EditMenu(req *types.EditMenuHandler, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *EditMenuLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -1,10 +1,8 @@
package logic
import (
"fusenapi/constants"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"math"
"context"
@ -32,35 +30,11 @@ func NewGetDepartmentsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
// func (l *GetDepartmentsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *GetDepartmentsLogic) GetDepartments(req *types.GetDepartmentsReq, userinfo *auth.UserInfo) (resp *basic.Response) {
if req.CurrentPage <= 0 {
req.CurrentPage = constants.DEFAULT_PAGE
}
if req.PageSize <= 0 {
req.PageSize = constants.DEFAULT_PAGE_SIZE
}
resList, resTotal, err := l.svcCtx.AllModels.LdapDepartment.GetList(l.ctx, req.CurrentPage, req.PageSize, "")
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "获取部门列表失败")
}
var pageCount int64 = 1
if resTotal > int64(req.PageSize) {
var float64Count = float64(resTotal)
var float64PerPage = float64(req.PageSize)
pageCountFloat := math.Ceil(float64Count / float64PerPage)
pageCount = int64(pageCountFloat)
}
func (l *GetDepartmentsLogic) GetDepartments(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"list": resList,
"meta": map[string]int64{
"total_count": resTotal,
"page_count": pageCount,
"current_page": int64(req.CurrentPage),
"per_page": int64(req.PageSize),
},
})
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理

View File

@ -1,43 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type GetMenusTreeLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetMenusTreeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenusTreeLogic {
return &GetMenusTreeLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *GetMenusTreeLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *GetMenusTreeLogic) GetMenusTree(req *types.GetMenusTreeReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *GetMenusTreeLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -12,14 +12,14 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type EditDepartmentLogic struct {
type SaveDepartmentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewEditDepartmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditDepartmentLogic {
return &EditDepartmentLogic{
func NewSaveDepartmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveDepartmentLogic {
return &SaveDepartmentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
@ -27,17 +27,15 @@ func NewEditDepartmentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ed
}
// 处理进入前逻辑w,r
// func (l *EditDepartmentLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// func (l *SaveDepartmentLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *EditDepartmentLogic) EditDepartment(req *types.EditDepartmentReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
func (l *SaveDepartmentLogic) SaveDepartment(req *types.SaveDepartmentReq, userinfo *auth.UserInfo) (resp *basic.Response) {
//todo 鉴权。。。
return resp.SetStatus(basic.CodeOK)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *EditDepartmentLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// func (l *SaveDepartmentLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -5,60 +5,28 @@ import (
"fusenapi/utils/basic"
)
type EditMenuHandler struct {
type GetDepartmentsRsp struct {
List []*DepartmentsItem `json:"list"`
}
type DepartmentsItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
SyncState int64 `json:"sync_state"`
Child []*DepartmentsItem `json:"child"`
}
type SaveDepartmentReq struct {
Id int64 `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
Icon string `json:"icon"`
Path string `json:"path"`
Sort int64 `json:"sort"`
Status int64 `json:"status"`
Remark string `json:"remark"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Creator string `json:"creator"`
}
type AddMenuHandler struct {
Name string `json:"name"`
Title string `json:"title"`
Icon string `json:"icon"`
Path string `json:"path"`
Sort int64 `json:"sort"`
Status int64 `json:"status"`
ParentId int64 `json:"parent_id"`
Creator string `json:"creator"`
}
type GetMenusTreeReq struct {
}
type AddDepartmentReq struct {
Name string `json:"name"`
Remark string `json:"remark"`
Creator string `json:"creator"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
SyncState int64 `json:"sync_state"`
}
type EditDepartmentReq struct {
Id int64 `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
Creator string `json:"creator"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
SyncState int64 `json:"sync_state"`
}
type DeleteDepartmentReq struct {
Id int64 `json:"id"`
}
type GetDepartmentsReq struct {
CurrentPage int `form:"current_page"`
PageSize int `form:"page_size"`
Dn string `json:"dn"`
}
type Request struct {

View File

@ -149,6 +149,11 @@ func (l *DataTransferLogic) DataTransfer(req *types.DataTransferReq, w http.Resp
conn.Close()
return
}
//灯下删掉
/*if userInfo.UserId != 127{
conn.Close()
return
}*/
//设置连接
ws, err := l.setConnPool(conn, userInfo, isFirefoxBrowser, userAgent, oldWid)
if err != nil {

View File

@ -12,90 +12,32 @@ import "basic.api"
service ldap-admin {
//获取部门列表
@handler GetDepartmentsHandler
post /api/ldap-admin/get_departments(GetDepartmentsReq) returns (response);
// 新增部门
@handler AddDepartmentHandler
post /api/ldap-admin/add_department(AddDepartmentReq) returns (response);
// 编辑部门
@handler EditDepartmentHandler
post /api/ldap-admin/edit_department(EditDepartmentReq) returns (response);
// 删除部门
@handler DeleteDepartmentHandler
post /api/ldap-admin/delete_department(DeleteDepartmentReq) returns (response);
//获取菜单列表--树形
@handler GetMenusTreeHandler
post /api/ldap-admin/get_menus_tree(GetMenusTreeReq) returns (response);
// 新增菜单
@handler AddMenuHandler
post /api/ldap-admin/add_menu(AddMenuHandler) returns (response);
// 编辑菜单
@handler EditMenuHandler
post /api/ldap-admin/edit_menu(EditMenuHandler) returns (response);
}
type EditMenuHandler {
Id int64 `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
Icon string `json:"icon"`
Path string `json:"path"`
Sort int64 `json:"sort"`
Status int64 `json:"status"`
ParentId int64 `json:"parent_id"`
Creator string `json:"creator"`
}
type AddMenuHandler {
Name string `json:"name"`
Title string `json:"title"`
Icon string `json:"icon"`
Path string `json:"path"`
Sort int64 `json:"sort"`
Status int64 `json:"status"`
ParentId int64 `json:"parent_id"`
Creator string `json:"creator"`
}
//获取菜单列表--树形
type GetMenusTreeReq {
}
// 新增部门
type AddDepartmentReq {
Name string `json:"name"`
Remark string `json:"remark"`
Creator string `json:"creator"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
SyncState int64 `json:"sync_state"`
}
// 编辑部门
type EditDepartmentReq {
Id int64 `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
Creator string `json:"creator"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
SyncState int64 `json:"sync_state"`
}
// 删除部门
type DeleteDepartmentReq {
Id int64 `json:"id"`
get /api/ldap-admin/get_departments(request) returns (response);
//保存部门信息
@handler SaveDepartmentHandler
post /api/ldap-admin/save_department(SaveDepartmentReq) returns (response);
}
//获取部门列表
type GetDepartmentsReq {
CurrentPage int `form:"current_page"`
PageSize int `form:"page_size"`
type GetDepartmentsRsp {
List []*DepartmentsItem `json:"list"`
}
type DepartmentsItem {
Id int64 `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
SyncState int64 `json:"sync_state"`
Child []*DepartmentsItem `json:"child"`
}
//保存部门信息
type SaveDepartmentReq {
Id int64 `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
Type string `json:"type"`
ParentId int64 `json:"parent_id"`
Dn string `json:"dn"`
}