优化结构
This commit is contained in:
@@ -2,18 +2,18 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kra/internal/biz/system"
|
||||
|
||||
"kra/internal/biz"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type DepartmentService struct{ uc *biz.DepartmentUsecase }
|
||||
type DepartmentService struct{ uc *system.DepartmentUsecase }
|
||||
|
||||
func NewDepartmentService(uc *biz.DepartmentUsecase) *DepartmentService {
|
||||
func NewDepartmentService(uc *system.DepartmentUsecase) *DepartmentService {
|
||||
return &DepartmentService{uc: uc}
|
||||
}
|
||||
|
||||
func departmentResponse(value *biz.Department) *dto.DepartmentResponse {
|
||||
func departmentResponse(value *system.Department) *dto.DepartmentResponse {
|
||||
var children []*dto.DepartmentResponse
|
||||
if value.Children != nil {
|
||||
children = make([]*dto.DepartmentResponse, 0, len(value.Children))
|
||||
@@ -28,8 +28,8 @@ func departmentResponse(value *biz.Department) *dto.DepartmentResponse {
|
||||
return &dto.DepartmentResponse{ID: value.ID, CreatedAt: value.CreatedAt, UpdatedAt: value.UpdatedAt, DeletedAt: nil, Name: value.Name, ParentID: value.ParentID, Ancestors: value.Ancestors, Sort: value.Sort, LeaderID: value.LeaderID, Leader: leader, Status: value.Status, Children: children, NamePath: value.NamePath}
|
||||
}
|
||||
|
||||
func departmentDomain(value *dto.DepartmentRequest) *biz.Department {
|
||||
return &biz.Department{ID: value.ID, Name: value.Name, ParentID: value.ParentID, Sort: value.Sort, LeaderID: value.LeaderID, Status: value.Status}
|
||||
func departmentDomain(value *dto.DepartmentRequest) *system.Department {
|
||||
return &system.Department{ID: value.ID, Name: value.Name, ParentID: value.ParentID, Sort: value.Sort, LeaderID: value.LeaderID, Status: value.Status}
|
||||
}
|
||||
|
||||
func (s *DepartmentService) Departments(ctx context.Context, name string) ([]*dto.DepartmentResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user