position

package
v0.0.0-...-1bd4bba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreatedSuccess = "添加职位成功!"
	CreatedFail    = "添加职位失败!"
	UpdatedSuccess = "修改职位成功!"
	UpdatedFail    = "修改职位失败!"
	DeletedSuccess = "删除职位成功!"
	DeletedFail    = "删除职位失败!"

	ErrorNotExist    = "职位不存在!"
	ErrorNameRepeat  = "职位名称重复,请重新输入!"
	ErrorCodeRepeat  = "职位编码重复,请重新输入!"
	ErrorExistStaffs = "该职位下有员工,无法删除!"
)
View Source
const (
	FieldID   = "id"
	FieldName = "name"
	FieldCode = "code"

	FieldStatus    = "status"
	FieldSort      = "sort"
	FieldRemark    = "remark"
	FieldCreatedAt = "created_at"
	FieldUpdatedAt = "updated_at"
	FieldCreatedBy = "created_by"
	FieldUpdatedBy = "updated_by"

	Table = "system_positions"
)

Variables

Functions

func InitRoutes

func InitRoutes(route fiber.Router)

Types

type CreateInput

type CreateInput struct {
	Name      string `zh:"职位名称" json:"name" validate:"required,min=2,max=32"`
	Code      string `zh:"职位编码" json:"code" validate:"required,min=2,max=64"`
	Status    string `zh:"状态" json:"status" validate:"required,oneof=Disable Enable"`
	Sort      int32  `zh:"排序" json:"sort" validate:"number,gt=0"`
	Remark    string `zh:"备注" json:"remark" validate:"omitempty,max=128"`
	CreatedBy string `zh:"创建人员" json:"created_by" validate:"omitempty"`
}

type DeleteInput

type DeleteInput struct {
	ID string `zh:"唯一标识符" json:"id" validate:"required"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler() *Handler

func (*Handler) Create

func (h *Handler) Create(c *fiber.Ctx) error

func (*Handler) Delete

func (h *Handler) Delete(c *fiber.Ctx) error

func (*Handler) QueryAll

func (h *Handler) QueryAll(c *fiber.Ctx) error

func (*Handler) QueryPage

func (h *Handler) QueryPage(c *fiber.Ctx) error

func (*Handler) Update

func (h *Handler) Update(c *fiber.Ctx) error

type Position

type Position struct {
	ID        string `db:"id" json:"id"`
	Name      string `db:"name" json:"name"`
	Code      string `db:"code" json:"code"`
	Status    string `db:"status" json:"status"`
	Sort      int32  `db:"sort" json:"sort"`
	Remark    string `db:"remark" json:"remark,omitempty"`
	CreatedAt int64  `db:"created_at" json:"-"`
	UpdatedAt int64  `db:"updated_at" json:"updated_at"`
	CreatedBy string `db:"created_by" json:"-"`
	UpdatedBy string `db:"updated_by" json:"updated_by"`
}

type PositionOutput

type PositionOutput struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Code   string `json:"code"`
	Status string `json:"status"`
	Sort   int32  `json:"sort"`
}

type Repository

type Repository struct{}

func NewRepository

func NewRepository() *Repository

func (*Repository) Create

func (r *Repository) Create(e *Position, db *sqlx.DB) error

func (*Repository) Delete

func (r *Repository) Delete(e *Position, db *sqlx.DB) error

func (*Repository) QueryAll

func (r *Repository) QueryAll(w *WhereParams, db *sqlx.DB) ([]*Position, error)

func (*Repository) QueryCount

func (r *Repository) QueryCount(w *WhereParams, db *sqlx.DB) (uint64, error)

func (*Repository) QueryPage

func (r *Repository) QueryPage(w *WhereParams, db *sqlx.DB) ([]*Position, error)

func (*Repository) Update

func (r *Repository) Update(e *Position, db *sqlx.DB) error

func (*Repository) ValidationFields

func (r *Repository) ValidationFields(c *Position, db *sqlx.DB) (*Position, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService() *Service

func (*Service) Create

func (s *Service) Create(r *CreateInput) error

func (*Service) Delete

func (s *Service) Delete(r *DeleteInput) error

func (*Service) QueryAll

func (s *Service) QueryAll(w *WhereParams) ([]*PositionOutput, error)

func (*Service) QueryPage

func (s *Service) QueryPage(w *WhereParams) ([]*PositionOutput, uint64, error)

func (*Service) Update

func (s *Service) Update(r *UpdateInput) error

type UpdateInput

type UpdateInput struct {
	ID        string `zh:"唯一标识符" json:"id" validate:"required"`
	Name      string `zh:"职位名称" json:"name" validate:"omitempty,min=2,max=32"`
	Code      string `zh:"职位编码" json:"code" validate:"omitempty,min=2,max=64"`
	Status    string `zh:"状态" json:"status" validate:"required,oneof=Disable Enable"`
	Sort      int32  `zh:"排序" json:"sort" validate:"omitempty,number,gt=0"`
	Remark    string `zh:"备注" json:"remark" validate:"omitempty,max=128"`
	UpdatedBy string `zh:"更新人员" json:"updated_by" validate:"omitempty"`
}

type WhereParams

type WhereParams struct {
	Name     string `zh:"职位名称" query:"name" json:"name" validate:"omitempty,max=32"`
	Code     string `zh:"职位编码" query:"code" json:"code" validate:"omitempty,max=64"`
	Status   string `zh:"状态" query:"status" json:"status" validate:"omitempty,oneof=Disable Enable"`
	Remark   string `zh:"备注" query:"remark" json:"remark" validate:"omitempty,max=128"`
	PageSize uint64 `zh:"分页数量" query:"pageSize" json:"pageSize" validate:"omitempty,number,gt=0,max=50"`
	Current  uint64 `zh:"页数" query:"current" json:"current" validate:"omitempty,number,gt=0"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL