evaluation_cycle.go 929 字节
package dao

import (
	pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
)

type EvaluationCycleDao struct {
	transactionContext *pgTransaction.TransactionContext
}

func NewEvaluationCycleDao(options map[string]interface{}) *EvaluationCycleDao {
	var transactionContext *pgTransaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pgTransaction.TransactionContext)
	}
	return &EvaluationCycleDao{
		transactionContext: transactionContext,
	}
}

func (d *EvaluationCycleDao) UpdateSummaryState(id int64, status domain.ProjectSummaryState) error {
	db := d.transactionContext.PgTx
	_, err := db.Model(&models.EvaluationCycle{}).
		Where("id=?", id).
		Set("summary_state=?", int(status)).
		Update()
	return err
}