|
@@ -24,6 +24,7 @@ func (repository *CooperationContractChangeLogRepository) nextIdentify() (int64, |
|
@@ -24,6 +24,7 @@ func (repository *CooperationContractChangeLogRepository) nextIdentify() (int64, |
24
|
id, err := IdWorker.NextId()
|
24
|
id, err := IdWorker.NextId()
|
25
|
return id, err
|
25
|
return id, err
|
26
|
}
|
26
|
}
|
|
|
27
|
+
|
27
|
func (repository *CooperationContractChangeLogRepository) Save(cooperationContractChangeLog *domain.CooperationContractChangeLog) (*domain.CooperationContractChangeLog, error) {
|
28
|
func (repository *CooperationContractChangeLogRepository) Save(cooperationContractChangeLog *domain.CooperationContractChangeLog) (*domain.CooperationContractChangeLog, error) {
|
28
|
sqlBuildFields := []string{
|
29
|
sqlBuildFields := []string{
|
29
|
"incentives_rule",
|
30
|
"incentives_rule",
|
|
@@ -72,7 +73,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
|
@@ -72,7 +73,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
72
|
cooperationContractChangeLog.Company,
|
73
|
cooperationContractChangeLog.Company,
|
73
|
cooperationContractChangeLog.Operator,
|
74
|
cooperationContractChangeLog.Operator,
|
74
|
cooperationContractChangeLog.UpdatedAt,
|
75
|
cooperationContractChangeLog.UpdatedAt,
|
75
|
- cooperationContractChangeLog.DeletedAt,
|
76
|
+ nil,
|
76
|
cooperationContractChangeLog.CreatedAt,
|
77
|
cooperationContractChangeLog.CreatedAt,
|
77
|
); err != nil {
|
78
|
); err != nil {
|
78
|
return cooperationContractChangeLog, err
|
79
|
return cooperationContractChangeLog, err
|
|
@@ -100,7 +101,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
|
@@ -100,7 +101,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
100
|
cooperationContractChangeLog.Company,
|
101
|
cooperationContractChangeLog.Company,
|
101
|
cooperationContractChangeLog.Operator,
|
102
|
cooperationContractChangeLog.Operator,
|
102
|
cooperationContractChangeLog.UpdatedAt,
|
103
|
cooperationContractChangeLog.UpdatedAt,
|
103
|
- cooperationContractChangeLog.DeletedAt,
|
104
|
+ nil,
|
104
|
cooperationContractChangeLog.CreatedAt,
|
105
|
cooperationContractChangeLog.CreatedAt,
|
105
|
cooperationContractChangeLog.Identify(),
|
106
|
cooperationContractChangeLog.Identify(),
|
106
|
); err != nil {
|
107
|
); err != nil {
|
|
@@ -109,6 +110,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
|
@@ -109,6 +110,7 @@ func (repository *CooperationContractChangeLogRepository) Save(cooperationContra |
109
|
}
|
110
|
}
|
110
|
return cooperationContractChangeLog, nil
|
111
|
return cooperationContractChangeLog, nil
|
111
|
}
|
112
|
}
|
|
|
113
|
+
|
112
|
func (repository *CooperationContractChangeLogRepository) Remove(cooperationContractChangeLog *domain.CooperationContractChangeLog) (*domain.CooperationContractChangeLog, error) {
|
114
|
func (repository *CooperationContractChangeLogRepository) Remove(cooperationContractChangeLog *domain.CooperationContractChangeLog) (*domain.CooperationContractChangeLog, error) {
|
113
|
tx := repository.transactionContext.PgTx
|
115
|
tx := repository.transactionContext.PgTx
|
114
|
cooperationContractChangeLogModel := new(models.CooperationContractChangeLog)
|
116
|
cooperationContractChangeLogModel := new(models.CooperationContractChangeLog)
|
|
@@ -118,6 +120,7 @@ func (repository *CooperationContractChangeLogRepository) Remove(cooperationCont |
|
@@ -118,6 +120,7 @@ func (repository *CooperationContractChangeLogRepository) Remove(cooperationCont |
118
|
}
|
120
|
}
|
119
|
return cooperationContractChangeLog, nil
|
121
|
return cooperationContractChangeLog, nil
|
120
|
}
|
122
|
}
|
|
|
123
|
+
|
121
|
func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContractChangeLog, error) {
|
124
|
func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContractChangeLog, error) {
|
122
|
tx := repository.transactionContext.PgTx
|
125
|
tx := repository.transactionContext.PgTx
|
123
|
cooperationContractChangeLogModel := new(models.CooperationContractChangeLog)
|
126
|
cooperationContractChangeLogModel := new(models.CooperationContractChangeLog)
|
|
@@ -136,11 +139,18 @@ func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions m |
|
@@ -136,11 +139,18 @@ func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions m |
136
|
return transform.TransformToCooperationContractChangeLogDomainModelFromPgModels(cooperationContractChangeLogModel)
|
139
|
return transform.TransformToCooperationContractChangeLogDomainModelFromPgModels(cooperationContractChangeLogModel)
|
137
|
}
|
140
|
}
|
138
|
}
|
141
|
}
|
|
|
142
|
+
|
139
|
func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.CooperationContractChangeLog, error) {
|
143
|
func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.CooperationContractChangeLog, error) {
|
140
|
tx := repository.transactionContext.PgTx
|
144
|
tx := repository.transactionContext.PgTx
|
141
|
var cooperationContractChangeLogModels []*models.CooperationContractChangeLog
|
145
|
var cooperationContractChangeLogModels []*models.CooperationContractChangeLog
|
142
|
cooperationContractChangeLogs := make([]*domain.CooperationContractChangeLog, 0)
|
146
|
cooperationContractChangeLogs := make([]*domain.CooperationContractChangeLog, 0)
|
143
|
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractChangeLogModels), queryOptions)
|
147
|
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractChangeLogModels), queryOptions)
|
|
|
148
|
+ if operationType, ok := queryOptions["operationType"]; ok && operationType.(int32) != 0 {
|
|
|
149
|
+ query.Where("operation_type = ?", operationType)
|
|
|
150
|
+ }
|
|
|
151
|
+ if cooperationContractNumber, ok := queryOptions["cooperationContractNumber"]; ok && cooperationContractNumber != "" {
|
|
|
152
|
+ query.Where("cooperation_contract_number ilike ?", fmt.Sprintf("%%%s%%", cooperationContractNumber))
|
|
|
153
|
+ }
|
144
|
offsetLimitFlag := true
|
154
|
offsetLimitFlag := true
|
145
|
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
|
155
|
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
|
146
|
offsetLimitFlag = offsetLimit.(bool)
|
156
|
offsetLimitFlag = offsetLimit.(bool)
|
|
@@ -162,6 +172,7 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[ |
|
@@ -162,6 +172,7 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[ |
162
|
return int64(count), cooperationContractChangeLogs, nil
|
172
|
return int64(count), cooperationContractChangeLogs, nil
|
163
|
}
|
173
|
}
|
164
|
}
|
174
|
}
|
|
|
175
|
+
|
165
|
func NewCooperationContractChangeLogRepository(transactionContext *pgTransaction.TransactionContext) (*CooperationContractChangeLogRepository, error) {
|
176
|
func NewCooperationContractChangeLogRepository(transactionContext *pgTransaction.TransactionContext) (*CooperationContractChangeLogRepository, error) {
|
166
|
if transactionContext == nil {
|
177
|
if transactionContext == nil {
|
167
|
return nil, fmt.Errorf("transactionContext参数不能为nil")
|
178
|
return nil, fmt.Errorf("transactionContext参数不能为nil")
|