...
|
...
|
@@ -24,6 +24,7 @@ func (repository *CooperationContractChangeLogRepository) nextIdentify() (int64, |
|
|
id, err := IdWorker.NextId()
|
|
|
return id, err
|
|
|
}
|
|
|
|
|
|
func (repository *CooperationContractChangeLogRepository) Save(cooperationContractChangeLog *domain.CooperationContractChangeLog) (*domain.CooperationContractChangeLog, error) {
|
|
|
sqlBuildFields := []string{
|
|
|
"incentives_rule",
|
...
|
...
|
@@ -72,7 +73,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
|
|
cooperationContractChangeLog.Company,
|
|
|
cooperationContractChangeLog.Operator,
|
|
|
cooperationContractChangeLog.UpdatedAt,
|
|
|
cooperationContractChangeLog.DeletedAt,
|
|
|
nil,
|
|
|
cooperationContractChangeLog.CreatedAt,
|
|
|
); err != nil {
|
|
|
return cooperationContractChangeLog, err
|
...
|
...
|
@@ -100,7 +101,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
|
|
cooperationContractChangeLog.Company,
|
|
|
cooperationContractChangeLog.Operator,
|
|
|
cooperationContractChangeLog.UpdatedAt,
|
|
|
cooperationContractChangeLog.DeletedAt,
|
|
|
nil,
|
|
|
cooperationContractChangeLog.CreatedAt,
|
|
|
cooperationContractChangeLog.Identify(),
|
|
|
); err != nil {
|
...
|
...
|
@@ -109,6 +110,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
|
|
}
|
|
|
return cooperationContractChangeLog, nil
|
|
|
}
|
|
|
|
|
|
func (repository *CooperationContractChangeLogRepository) Remove(cooperationContractChangeLog *domain.CooperationContractChangeLog) (*domain.CooperationContractChangeLog, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
cooperationContractChangeLogModel := new(models.CooperationContractChangeLog)
|
...
|
...
|
@@ -118,6 +120,7 @@ func (repository *CooperationContractChangeLogRepository) Remove(cooperationCont |
|
|
}
|
|
|
return cooperationContractChangeLog, nil
|
|
|
}
|
|
|
|
|
|
func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContractChangeLog, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
cooperationContractChangeLogModel := new(models.CooperationContractChangeLog)
|
...
|
...
|
@@ -136,11 +139,18 @@ func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions m |
|
|
return transform.TransformToCooperationContractChangeLogDomainModelFromPgModels(cooperationContractChangeLogModel)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.CooperationContractChangeLog, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
var cooperationContractChangeLogModels []*models.CooperationContractChangeLog
|
|
|
cooperationContractChangeLogs := make([]*domain.CooperationContractChangeLog, 0)
|
|
|
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractChangeLogModels), queryOptions)
|
|
|
if operationType, ok := queryOptions["operationType"]; ok && operationType.(int32) != 0 {
|
|
|
query.Where("operation_type = ?", operationType)
|
|
|
}
|
|
|
if cooperationContractNumber, ok := queryOptions["cooperationContractNumber"]; ok && cooperationContractNumber != "" {
|
|
|
query.Where("cooperation_contract_number ilike ?", fmt.Sprintf("%%%s%%", cooperationContractNumber))
|
|
|
}
|
|
|
offsetLimitFlag := true
|
|
|
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
|
|
|
offsetLimitFlag = offsetLimit.(bool)
|
...
|
...
|
@@ -162,6 +172,7 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[ |
|
|
return int64(count), cooperationContractChangeLogs, nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func NewCooperationContractChangeLogRepository(transactionContext *pgTransaction.TransactionContext) (*CooperationContractChangeLogRepository, error) {
|
|
|
if transactionContext == nil {
|
|
|
return nil, fmt.Errorf("transactionContext参数不能为nil")
|
...
|
...
|
|