31 lines
		
	
	
		
			1007 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1007 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package system
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"time"
 | |
| 
 | |
| 	"management/internal/erpserver/model/dto"
 | |
| )
 | |
| 
 | |
| type DepartmentRepository interface {
 | |
| 	Initialize(ctx context.Context) error
 | |
| 	Create(ctx context.Context, obj *Department) error
 | |
| 	Update(ctx context.Context, obj *Department) error
 | |
| 	Get(ctx context.Context, id int32) (*Department, error)
 | |
| 	All(ctx context.Context) ([]*Department, error)
 | |
| 	Count(ctx context.Context, filter dto.SearchDto) (int64, error)
 | |
| 	List(ctx context.Context, filter dto.SearchDto) ([]*Department, error)
 | |
| 	RebuildParentPath(ctx context.Context) error
 | |
| }
 | |
| 
 | |
| type Department struct {
 | |
| 	ID         int32     `db:"id" json:"id"`
 | |
| 	Name       string    `db:"name" json:"name"`
 | |
| 	ParentID   int32     `db:"parent_id" json:"parent_id"`
 | |
| 	ParentPath string    `db:"parent_path" json:"parent_path"`
 | |
| 	Status     int32     `db:"status" json:"status"`
 | |
| 	Sort       int32     `db:"sort" json:"sort"`
 | |
| 	CreatedAt  time.Time `db:"created_at" json:"created_at"`
 | |
| 	UpdatedAt  time.Time `db:"updated_at" json:"updated_at"`
 | |
| }
 |