- 在 constant.go 中新增员工职位和业务员类型常量定义 - 在 ik3cloud.go 中新增 Position 字段以支持职位相关操作 - 在 staff.go 中实现员工职位和业务员类型的查询方法 - 新增 position.go 文件,实现职位的保存和删除功能
128 lines
3.1 KiB
Go
128 lines
3.1 KiB
Go
package ik3cloud
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.kumo.work/shama/service/client"
|
|
"git.kumo.work/shama/service/ik3cloud/constant"
|
|
"git.kumo.work/shama/service/lib/bean"
|
|
)
|
|
|
|
type staff struct {
|
|
}
|
|
type ArgsStaffList struct {
|
|
Page bean.Page
|
|
Search StaffSearch
|
|
}
|
|
type StaffSearch struct {
|
|
Status int64 // 状态 1=启用 2=停用
|
|
Name string // 姓名
|
|
Phone string // 手机号
|
|
}
|
|
type ReplyStaffList struct {
|
|
List []StaffItem `json:"list"` // 员工列表
|
|
Total int64 `json:"total"` // 总数
|
|
}
|
|
type StaffItem struct {
|
|
Id int64 `json:"id"`
|
|
Number *string `json:"number"` // 工号
|
|
Name *string `json:"name"` // 姓名
|
|
Position *string `json:"position"` // 职位
|
|
Mobile *string `json:"mobile"` // 手机号
|
|
Tel *string `json:"tel"` // 座机
|
|
Status *string `json:"status"` // 状态
|
|
}
|
|
|
|
// List @TITLE 员工列表
|
|
func (s *staff) List(ctx context.Context, args ArgsStaffList) (reply ReplyStaffList, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "List", args, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsStaffSave struct {
|
|
StaffId int64 // 员工id
|
|
Name string // 姓名
|
|
Number string // 编码
|
|
Mobile any // 手机号
|
|
Tel string // 座机
|
|
Email string // 邮箱
|
|
}
|
|
|
|
// Save @TITLE 保存员工
|
|
func (s *staff) Save(ctx context.Context, args ArgsStaffSave) (entity Entity, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Save", args, &entity)
|
|
return
|
|
}
|
|
|
|
// Disable @TITLE 禁用员工
|
|
func (s *staff) Disable(ctx context.Context, args Unique) (err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Disable", args, &reply)
|
|
}
|
|
|
|
// Enable @TITLE 启用员工
|
|
func (s *staff) Enable(ctx context.Context, args Unique) (err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Enable", args, &reply)
|
|
}
|
|
|
|
// Delete @TITLE 删除员工
|
|
func (s *staff) Delete(ctx context.Context, args Unique) (err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
var reply int
|
|
return xClient.Call(ctx, "Delete", args, &reply)
|
|
}
|
|
|
|
type ArgsStaffPosition struct {
|
|
StaffPositionId int64 // 员工职位id
|
|
Number string // 编码
|
|
StaffNumber string // 员工编码
|
|
DepartmentNumber string // 部门编码
|
|
PositionNumber string // 职位编码
|
|
}
|
|
|
|
// Position @TITLE 员工职位
|
|
func (s *staff) Position(ctx context.Context, args ArgsStaffPosition) (entity Entity, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Position", args, &entity)
|
|
return
|
|
}
|
|
|
|
type StaffOperatorItem struct {
|
|
OperatorId int64 // 类型id
|
|
OperatorType constant.OperatorType // 业务类型
|
|
StaffPositionNumbers []string // 员工职位编码
|
|
}
|
|
|
|
// Operator @TITLE 业务类型
|
|
func (s *staff) Operator(ctx context.Context, args []StaffOperatorItem) (entities []Entity, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Operator", args, &entities)
|
|
return
|
|
}
|