优化结构

This commit is contained in:
Yvan
2026-08-22 12:13:16 +08:00
parent d987244d0e
commit b27a66e9d3
200 changed files with 1794 additions and 1715 deletions
+6 -6
View File
@@ -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) {