作者 Your Name

员工填写绩效的数据模型

  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +//填写评估的类型
  6 +type StaffAssessType string
  7 +
  8 +const (
  9 + AssessSelf StaffAssessType = "self" //自评
  10 + AssessSuper StaffAssessType = "super" //上级评估
  11 + AssessOverall StaffAssessType = "overall" //360评估
  12 +)
  13 +
  14 +//填写评估的状态
  15 +type StaffAssessStatus string
  16 +
  17 +const (
  18 + StaffAssessUnstart StaffAssessStatus = "unstart" //未开始
  19 + StaffAssessUncompleted StaffAssessStatus = "uncompleted" //未完成
  20 + StaffAssessCompleted StaffAssessStatus = "completed" //已完成
  21 +)
  22 +
  23 +// 记录用户需要的评估项
  24 +type StaffAssess struct {
  25 + Id int `json:"id"` //id
  26 + CompanyId int `json:"companyId"` //公司id
  27 + EvaluationProjectId int `json:"evaluationProjectId"` //对应的项目id
  28 + CycleId int64 `json:"cycleId"` //对应的周期id
  29 + TargetUser StaffDesc `json:"targetUser"` //被评估的目标用户
  30 + TargetDepartment []StaffDepartment `json:"targetDepartment"` //被评估的目标用户所在的部门
  31 + Executor StaffDesc `json:"executor"` //填写评估的用户
  32 + Types StaffAssessType `json:"types"` //填写评估对应的类型
  33 + Status StaffAssessStatus `json:"status"` //评估的填写状态
  34 + BeginTime time.Time `json:"beginTime"` //开始时间
  35 + EndTime time.Time `json:"endTime"` //截止时间
  36 + CreatedAt time.Time `json:"createdAt"` //数据创建时间
  37 + UpdatedAt time.Time `json:"updatedAt"` //数据更新时间
  38 + DeletedAt *time.Time `json:"deletedAt"` //数据删除时间
  39 +}
  40 +
  41 +type StaffAssessRepository interface {
  42 + Save(param *StaffAssess) (*StaffAssess, error)
  43 + Remove(id int) error
  44 + FindOne(queryOptions map[string]interface{}) (*StaffAssess, error)
  45 + Find(queryOptions map[string]interface{}) (int, []*StaffAssess, error)
  46 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +//填写的评估内容
  6 +type StaffAssessContent struct {
  7 + Id int //id
  8 + StaffAssessId int //用户需要的评估项id
  9 + SortBy int //排序
  10 + Category string //类别
  11 + Title string //问题标题
  12 + Remark string //填写的反馈
  13 + Rate string //评估填写的值
  14 + ReteResult string //评估的结果
  15 + CreatedAt time.Time //数据创建时间
  16 + UpdatedAt time.Time //数据更新时间
  17 +}
  18 +
  19 +type StaffAssessContentRepository interface {
  20 + Save(param *StaffAssessContent) (*StaffAssessContent, error)
  21 + Remove(id int) error
  22 + FindOne(queryOptions map[string]interface{}) (*StaffAssessContent, error)
  23 + Find(queryOptions map[string]interface{}) (int, []*StaffAssessContent, error)
  24 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +//评估任务重复执行的方式
  6 +type AssessTaskRepeatWay string
  7 +
  8 +const (
  9 + AssessTaskRepeatDay AssessTaskRepeatWay = "day" //按天重复
  10 + AssessTaskRepeatWeek AssessTaskRepeatWay = "week" //按周重复
  11 + AssessTaskRepeatMonth AssessTaskRepeatWay = "month" //按月
  12 + AssessTaskRepeatMonthDouble AssessTaskRepeatWay = "month_double" //按双月
  13 + AssessTaskRepeatQuarter AssessTaskRepeatWay = "quarter" //按季度
  14 + AssessTaskRepeatYearHalf AssessTaskRepeatWay = "year_half" //按半年
  15 + AssessTaskRepeatYear AssessTaskRepeatWay = "year" //按年
  16 +)
  17 +
  18 +// 执行评估的任务列表
  19 +type StaffAssessTask struct {
  20 + Id int `json:"id"`
  21 + CompanyId int `json:"companyId"` //公司id
  22 + EvaluationProjectId int `json:"evaluationProjectId"` //项目id
  23 + CycleId int64 `json:"cycleId"` //对应的周期id
  24 + Types StaffAssessType `json:"types"` //填写评估对应的类型
  25 + BeginTime time.Time `json:"beginTime"` //开始时间
  26 + EndTime time.Time `json:"endTime"` //截止时间
  27 + RepeatWay AssessTaskRepeatWay `json:"repeatWay"` //重复执行的方式
  28 + NextActiveTime int64 `json:"nextActveTime"` //下一次执行的任务的时间
  29 + CreatedAt time.Time `json:"createdAt"` //数据创建时间
  30 + UpdatedAt time.Time `json:"updatedAt"` //数据更新时间
  31 + DeletedAt time.Time `json:"deletedAt"` //数据删除时间
  32 +}
  33 +
  34 +type StaffAssessTaskRepository interface {
  35 + Save(param *StaffAssessTask) (*StaffAssessTask, error)
  36 + Remove(id int) error
  37 + FindOne(queryOptions map[string]interface{}) (*StaffAssessTask, error)
  38 + Find(queryOptions map[string]interface{}) (int, []*StaffAssessTask, error)
  39 +}
  40 +
  41 +//计算下一次执行任务的时间
  42 +func (task *StaffAssessTask) NewNextActveTime() {
  43 + if task.NextActiveTime == 0 {
  44 + task.NextActiveTime = task.BeginTime.Unix()
  45 + }
  46 + //Todo 根据重复执行的方式,计算下一次执行的时间点
  47 +}
  1 +package domain
  2 +
  3 +//员工基本信息描述
  4 +type StaffDesc struct {
  5 + UserId int `json:"userId"` //用户id
  6 + Account string `json:"account"` //用户的账号
  7 + UserName string `json:"userName"` //用户的名称
  8 +}
  9 +
  10 +//员工的部门
  11 +type StaffDepartment struct {
  12 + DepartmentId int `json:"departmentId"` //部门id
  13 + DepartmentName string `json:"departmentName"` //部门名称
  14 +}
1 -package domain  
2 -  
3 -import "time"  
4 -  
5 -type StaffEvaluationType string  
6 -  
7 -const (  
8 - EvaluationSelf StaffEvaluationType = "self" //自评  
9 - EvaluationSuper StaffEvaluationType = "super" //上级评估  
10 - EvaluationOverall StaffEvaluationType = "overall" //360评估  
11 -)  
12 -  
13 -// 需要填写评估的用户  
14 -type StaffEvaluation struct {  
15 - Id int //id  
16 - EvaluationProjectId int //对应的项目id  
17 - CycleId int64 //对应的周期id  
18 - TargetUserId int //被评估的目标用户  
19 - ExecutorId int //填写评估的用户  
20 - Types StaffEvaluationType //填写评估对应的类型  
21 - BeginTime time.Time //开始时间  
22 - EndTime time.Time //截止时间  
23 - CreatedAt time.Time //数据创建时间  
24 - UpdatedAt time.Time //数据更新时间  
25 -}  
26 -  
27 -//用户填写的评估  
28 -type StaffEvaluationContent struct {  
29 -}  
  1 +package models
  2 +
  3 +import (
  4 + "time"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  7 +)
  8 +
  9 +// 记录用户需要的评估项
  10 +type StaffAssess struct {
  11 + tableName struct{} `pg:"staff_assess" comment:"记录用户需要的评估项"`
  12 + Id int `pg:",pk"` //id
  13 + CompanyId int `comment:"公司id"` //公司id
  14 + EvaluationProjectId int `comment:"对应的项目id"` //对应的项目id
  15 + CycleId int64 `comment:"对应的周期id"` //对应的周期id
  16 + TargetUser domain.StaffDesc `comment:"被评估的目标用户"` //被评估的目标用户
  17 + TargetDepartment []domain.StaffDepartment `comment:"被评估的用户所在的部门"` //被评估的用户所在的部门
  18 + Executor domain.StaffDesc `comment:"填写评估的用户"` //填写评估的用户
  19 + Types string `comment:"填写评估对应的类型"` //填写评估对应的类型
  20 + Status string `comment:"评估的填写状态"` //评估的填写状态
  21 + BeginTime time.Time `comment:"开始时间"` //开始时间
  22 + EndTime time.Time `comment:"截止时间"` //截止时间
  23 + CreatedAt time.Time `comment:"数据创建时间"` //数据创建时间
  24 + UpdatedAt time.Time `comment:"数据更新时间"` //数据更新时间
  25 + DeletedAt *time.Time `comment:"数据删除时间"` //数据删除时间
  26 +}
  1 +package models
  2 +
  3 +import "time"
  4 +
  5 +//填写的评估内容
  6 +type StaffAssessContent struct {
  7 + tableName struct{} `pg:"staff_assess_content" comment:"填写的评估项"`
  8 + Id int `pg:",pk"` //id
  9 + StaffAssessId int //用户需要的评估项id
  10 + SortBy int //排序
  11 + Category string //类别
  12 + Title string //问题标题
  13 + Remark string //填写的反馈
  14 + Rate string //评估填写的值
  15 + ReteResult string //评估的结果
  16 + CreatedAt time.Time //数据创建时间
  17 + UpdatedAt time.Time //数据更新时间
  18 +}
  19 +
  20 +type StaffAssessContentRepository interface {
  21 + Save(param *StaffAssessContent) (*StaffAssessContent, error)
  22 + Remove(id int) error
  23 + FindOne(queryOptions map[string]interface{}) (*StaffAssessContent, error)
  24 + Find(queryOptions map[string]interface{}) (int, []*StaffAssessContent, error)
  25 +}
  1 +package models
  2 +
  3 +import "time"
  4 +
  5 +// 执行评估的任务列表
  6 +type StaffAssessTask struct {
  7 + tableName struct{} `pg:"staff_assess_task" comment:"执行评估的任务列表"`
  8 + Id int `pg:",pk"`
  9 + CompanyId int `` //公司id
  10 + EvaluationProjectId int //项目id
  11 + CycleId int64 //对应的周期id
  12 + Types string //填写评估对应的类型
  13 + BeginTime time.Time //开始时间
  14 + EndTime time.Time //截止时间
  15 + RepeatWay string //重复执行的方式
  16 + NextActiveTime int64 //下一次执行的任务的时间,时间戳(秒)
  17 + CreatedAt time.Time //数据创建时间
  18 + UpdatedAt time.Time //数据更新时间
  19 + DeletedAt time.Time //数据删除时间
  20 +}
  1 +package repository
  2 +
  3 +import (
  4 + "errors"
  5 + "fmt"
  6 + "time"
  7 +
  8 + "github.com/go-pg/pg/v10"
  9 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  10 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  11 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
  12 +)
  13 +
  14 +type StaffAssessContentRepository struct {
  15 + transactionContext *pgTransaction.TransactionContext
  16 +}
  17 +
  18 +var _ domain.StaffAssessContentRepository = (*StaffAssessContentRepository)(nil)
  19 +
  20 +func NewStaffEvaluationRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessContentRepository {
  21 + return &StaffAssessContentRepository{transactionContext: transactionContext}
  22 +}
  23 +
  24 +func (repo *StaffAssessContentRepository) TransformToDomain(d *models.StaffAssessContent) *domain.StaffAssessContent {
  25 + return &domain.StaffAssessContent{}
  26 +}
  27 +
  28 +func (repo *StaffAssessContentRepository) Save(d *domain.StaffAssessContent) (*domain.StaffAssessContent, error) {
  29 + saveModel := models.StaffAssess{
  30 + Id: d.Id,
  31 + }
  32 + tx := repo.transactionContext.PgTx
  33 + var err error
  34 + if saveModel.Id == 0 {
  35 + _, err = tx.Model(&saveModel).Insert()
  36 + if err != nil {
  37 + return nil, err
  38 + }
  39 + } else {
  40 + _, err = tx.Model(&saveModel).WherePK().Update()
  41 + if err != nil {
  42 + return nil, err
  43 + }
  44 + }
  45 + d.Id = saveModel.Id
  46 + return d, nil
  47 +}
  48 +
  49 +func (repo *StaffAssessContentRepository) Remove(id int) error {
  50 + tx := repo.transactionContext.PgTx
  51 + nowTime := time.Now()
  52 + _, err := tx.Model(&models.StaffAssessContent{}).
  53 + Where("id=?", id).
  54 + Set("deleted_at=?", nowTime).
  55 + Update()
  56 + return err
  57 +}
  58 +
  59 +func (repo *StaffAssessContentRepository) FindOne(queryOptions map[string]interface{}) (*domain.StaffAssessContent, error) {
  60 + tx := repo.transactionContext.PgTx
  61 + m := new(models.StaffAssessContent)
  62 + query := tx.Model(m)
  63 + query.Where("deleted_at isnull")
  64 + if id, ok := queryOptions["id"]; ok {
  65 + query.Where("id=?", id)
  66 + }
  67 + if err := query.First(); err != nil {
  68 + if errors.Is(err, pg.ErrNoRows) {
  69 + return nil, fmt.Errorf("没有此资源")
  70 + } else {
  71 + return nil, err
  72 + }
  73 + }
  74 + u := repo.TransformToDomain(m)
  75 + return u, nil
  76 +}
  77 +
  78 +func (repo *StaffAssessContentRepository) Find(queryOptions map[string]interface{}) (int, []*domain.StaffAssessContent, error) {
  79 + tx := repo.transactionContext.PgTx
  80 + var m []*models.StaffAssessContent
  81 + query := tx.Model(&m).
  82 + Where("deleted_at isnull").Limit(20)
  83 + if companyId, ok := queryOptions["companyId"]; ok {
  84 + query.Where("company_id = ?", companyId)
  85 + }
  86 + if v, ok := queryOptions["limit"].(int); ok {
  87 + query.Limit(v)
  88 + }
  89 + if v, ok := queryOptions["offset"].(int); ok {
  90 + query.Offset(v)
  91 + }
  92 +
  93 + count, err := query.SelectAndCount()
  94 + if err != nil {
  95 + return 0, nil, err
  96 + }
  97 + var arrays []*domain.StaffAssessContent
  98 + for _, v := range m {
  99 + d := repo.TransformToDomain(v)
  100 + arrays = append(arrays, d)
  101 + }
  102 + return count, arrays, nil
  103 +}
  1 +package repository
  2 +
  3 +import (
  4 + "errors"
  5 + "fmt"
  6 + "time"
  7 +
  8 + "github.com/go-pg/pg/v10"
  9 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  10 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  11 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
  12 +)
  13 +
  14 +type StaffAssessRepository struct {
  15 + transactionContext *pgTransaction.TransactionContext
  16 +}
  17 +
  18 +var _ domain.StaffAssessRepository = (*StaffAssessRepository)(nil)
  19 +
  20 +func NewStaffAssessRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessRepository {
  21 + return &StaffAssessRepository{transactionContext: transactionContext}
  22 +}
  23 +
  24 +func (repo *StaffAssessRepository) TransformToDomain(d *models.StaffAssess) *domain.StaffAssess {
  25 + return &domain.StaffAssess{
  26 + Id: d.Id,
  27 + CompanyId: d.CompanyId,
  28 + EvaluationProjectId: d.EvaluationProjectId,
  29 + CycleId: d.CycleId,
  30 + TargetUser: d.TargetUser,
  31 + TargetDepartment: d.TargetDepartment,
  32 + Executor: d.Executor,
  33 + Types: domain.StaffAssessType(d.Types),
  34 + Status: domain.StaffAssessStatus(d.Status),
  35 + BeginTime: d.BeginTime,
  36 + EndTime: d.EndTime,
  37 + CreatedAt: d.EndTime,
  38 + UpdatedAt: d.CreatedAt,
  39 + DeletedAt: d.DeletedAt,
  40 + }
  41 +}
  42 +
  43 +func (repo *StaffAssessRepository) Save(d *domain.StaffAssess) (*domain.StaffAssess, error) {
  44 + saveModel := models.StaffAssess{
  45 + Id: d.Id,
  46 + CompanyId: d.CompanyId,
  47 + EvaluationProjectId: d.EvaluationProjectId,
  48 + CycleId: d.CycleId,
  49 + TargetUser: d.TargetUser,
  50 + TargetDepartment: d.TargetDepartment,
  51 + Executor: d.Executor,
  52 + Types: string(d.Types),
  53 + Status: string(d.Status),
  54 + BeginTime: d.BeginTime,
  55 + EndTime: d.EndTime,
  56 + CreatedAt: d.EndTime,
  57 + UpdatedAt: d.CreatedAt,
  58 + DeletedAt: d.DeletedAt,
  59 + }
  60 + tx := repo.transactionContext.PgTx
  61 + var err error
  62 + if saveModel.Id == 0 {
  63 + _, err = tx.Model(&saveModel).Insert()
  64 + if err != nil {
  65 + return nil, err
  66 + }
  67 + } else {
  68 + _, err = tx.Model(&saveModel).WherePK().Update()
  69 + if err != nil {
  70 + return nil, err
  71 + }
  72 + }
  73 + d.Id = saveModel.Id
  74 + return d, nil
  75 +}
  76 +
  77 +func (repo *StaffAssessRepository) Remove(id int) error {
  78 + tx := repo.transactionContext.PgTx
  79 + nowTime := time.Now()
  80 + _, err := tx.Model(&models.StaffAssess{}).
  81 + Where("id=?", id).
  82 + Set("deleted_at=?", nowTime).
  83 + Update()
  84 + return err
  85 +}
  86 +
  87 +func (repo *StaffAssessRepository) FindOne(queryOptions map[string]interface{}) (*domain.StaffAssess, error) {
  88 + tx := repo.transactionContext.PgTx
  89 + m := new(models.StaffAssess)
  90 + query := tx.Model(m)
  91 + query.Where("deleted_at isnull")
  92 + if id, ok := queryOptions["id"]; ok {
  93 + query.Where("id=?", id)
  94 + }
  95 + if err := query.First(); err != nil {
  96 + if errors.Is(err, pg.ErrNoRows) {
  97 + return nil, fmt.Errorf("没有此资源")
  98 + } else {
  99 + return nil, err
  100 + }
  101 + }
  102 + u := repo.TransformToDomain(m)
  103 + return u, nil
  104 +}
  105 +
  106 +func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (int, []*domain.StaffAssess, error) {
  107 + tx := repo.transactionContext.PgTx
  108 + var m []*models.StaffAssess
  109 + query := tx.Model(&m).
  110 + Where("deleted_at isnull").Limit(20)
  111 + if companyId, ok := queryOptions["companyId"]; ok {
  112 + query.Where("company_id = ?", companyId)
  113 + }
  114 + if v, ok := queryOptions["limit"].(int); ok {
  115 + query.Limit(v)
  116 + }
  117 + if v, ok := queryOptions["offset"].(int); ok {
  118 + query.Offset(v)
  119 + }
  120 +
  121 + count, err := query.SelectAndCount()
  122 + if err != nil {
  123 + return 0, nil, err
  124 + }
  125 + var arrays []*domain.StaffAssess
  126 + for _, v := range m {
  127 + d := repo.TransformToDomain(v)
  128 + arrays = append(arrays, d)
  129 + }
  130 + return count, arrays, nil
  131 +}
  1 +package repository
  2 +
  3 +import (
  4 + "errors"
  5 + "fmt"
  6 + "time"
  7 +
  8 + "github.com/go-pg/pg/v10"
  9 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  10 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  11 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
  12 +)
  13 +
  14 +type StaffAssessTaskRepository struct {
  15 + transactionContext *pgTransaction.TransactionContext
  16 +}
  17 +
  18 +var _ domain.StaffAssessTaskRepository = (*StaffAssessTaskRepository)(nil)
  19 +
  20 +func NewStaffAssessTaskRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessTaskRepository {
  21 + return &StaffAssessTaskRepository{transactionContext: transactionContext}
  22 +}
  23 +
  24 +func (repo *StaffAssessTaskRepository) TransformToDomain(d *models.StaffAssessTask) *domain.StaffAssessTask {
  25 + return &domain.StaffAssessTask{
  26 + Id: d.Id,
  27 + CompanyId: d.CompanyId,
  28 + EvaluationProjectId: d.EvaluationProjectId,
  29 + CycleId: d.CycleId,
  30 + Types: domain.StaffAssessType(d.Types),
  31 + BeginTime: d.BeginTime,
  32 + EndTime: d.EndTime,
  33 + RepeatWay: domain.AssessTaskRepeatWay(d.RepeatWay),
  34 + NextActiveTime: d.NextActiveTime,
  35 + CreatedAt: d.EndTime,
  36 + UpdatedAt: d.CreatedAt,
  37 + DeletedAt: d.DeletedAt,
  38 + }
  39 +}
  40 +
  41 +func (repo *StaffAssessTaskRepository) Save(d *domain.StaffAssessTask) (*domain.StaffAssessTask, error) {
  42 + saveModel := models.StaffAssessTask{
  43 + Id: d.Id,
  44 + CompanyId: d.CompanyId,
  45 + EvaluationProjectId: d.EvaluationProjectId,
  46 + CycleId: d.CycleId,
  47 + Types: string(d.Types),
  48 + BeginTime: d.BeginTime,
  49 + EndTime: d.EndTime,
  50 + RepeatWay: string(d.RepeatWay),
  51 + NextActiveTime: d.NextActiveTime,
  52 + CreatedAt: d.EndTime,
  53 + UpdatedAt: d.CreatedAt,
  54 + DeletedAt: d.DeletedAt,
  55 + }
  56 + tx := repo.transactionContext.PgTx
  57 + var err error
  58 + if saveModel.Id == 0 {
  59 + _, err = tx.Model(&saveModel).Insert()
  60 + if err != nil {
  61 + return nil, err
  62 + }
  63 + } else {
  64 + _, err = tx.Model(&saveModel).WherePK().Update()
  65 + if err != nil {
  66 + return nil, err
  67 + }
  68 + }
  69 + d.Id = saveModel.Id
  70 + return d, nil
  71 +}
  72 +
  73 +func (repo *StaffAssessTaskRepository) Remove(id int) error {
  74 + tx := repo.transactionContext.PgTx
  75 + nowTime := time.Now()
  76 + _, err := tx.Model(&models.StaffAssessTask{}).
  77 + Where("id=?", id).
  78 + Set("deleted_at=?", nowTime).
  79 + Update()
  80 + return err
  81 +}
  82 +
  83 +func (repo *StaffAssessTaskRepository) FindOne(queryOptions map[string]interface{}) (*domain.StaffAssessTask, error) {
  84 + tx := repo.transactionContext.PgTx
  85 + m := new(models.StaffAssessTask)
  86 + query := tx.Model(m)
  87 + query.Where("deleted_at isnull")
  88 + if id, ok := queryOptions["id"]; ok {
  89 + query.Where("id=?", id)
  90 + }
  91 + if err := query.First(); err != nil {
  92 + if errors.Is(err, pg.ErrNoRows) {
  93 + return nil, fmt.Errorf("没有此资源")
  94 + } else {
  95 + return nil, err
  96 + }
  97 + }
  98 + u := repo.TransformToDomain(m)
  99 + return u, nil
  100 +}
  101 +
  102 +func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{}) (int, []*domain.StaffAssessTask, error) {
  103 + tx := repo.transactionContext.PgTx
  104 + var m []*models.StaffAssessTask
  105 + query := tx.Model(&m).
  106 + Where("deleted_at isnull").Limit(20)
  107 + if companyId, ok := queryOptions["companyId"]; ok {
  108 + query.Where("company_id = ?", companyId)
  109 + }
  110 + if v, ok := queryOptions["limit"].(int); ok {
  111 + query.Limit(v)
  112 + }
  113 + if v, ok := queryOptions["offset"].(int); ok {
  114 + query.Offset(v)
  115 + }
  116 +
  117 + count, err := query.SelectAndCount()
  118 + if err != nil {
  119 + return 0, nil, err
  120 + }
  121 + var arrays []*domain.StaffAssessTask
  122 + for _, v := range m {
  123 + d := repo.TransformToDomain(v)
  124 + arrays = append(arrays, d)
  125 + }
  126 + return count, arrays, nil
  127 +}