审查视图

pkg/infrastructure/dao/evaluation_project.go 941 字节
tangxvhui authored
1 2
package dao
3 4 5 6 7
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"
)
tangxvhui authored
8 9 10 11 12 13 14 15 16 17 18 19 20 21

type EvaluationProjectDao struct {
	transactionContext *pgTransaction.TransactionContext
}

func NewEvaluationProjectDao(options map[string]interface{}) *EvaluationProjectDao {
	var transactionContext *pgTransaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pgTransaction.TransactionContext)
	}
	return &EvaluationProjectDao{
		transactionContext: transactionContext,
	}
}
22 23 24 25 26 27 28 29 30

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