...
|
...
|
@@ -42,6 +42,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor |
|
|
"updated_at",
|
|
|
"deleted_at",
|
|
|
"ext",
|
|
|
"product_date",
|
|
|
}
|
|
|
insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_attendance_id", "deleted_at"))
|
|
|
insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlbuilder.RemoveSqlFields(sqlBuildFields, "product_attendance_id", "deleted_at"))
|
...
|
...
|
@@ -67,6 +68,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor |
|
|
&productAttendanceRecord.UpdatedAt,
|
|
|
&productAttendanceRecord.DeletedAt,
|
|
|
&productAttendanceRecord.Ext,
|
|
|
&productAttendanceRecord.ProductDate,
|
|
|
),
|
|
|
fmt.Sprintf("INSERT INTO manufacture.product_attendance_record (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
|
|
|
//productAttendanceRecord.ProductAttendanceId,
|
...
|
...
|
@@ -84,6 +86,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor |
|
|
productAttendanceRecord.UpdatedAt,
|
|
|
//productAttendanceRecord.DeletedAt,
|
|
|
productAttendanceRecord.Ext,
|
|
|
productAttendanceRecord.ProductDate,
|
|
|
); err != nil {
|
|
|
return productAttendanceRecord, err
|
|
|
}
|
...
|
...
|
@@ -105,6 +108,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor |
|
|
&productAttendanceRecord.UpdatedAt,
|
|
|
&productAttendanceRecord.DeletedAt,
|
|
|
&productAttendanceRecord.Ext,
|
|
|
&productAttendanceRecord.ProductDate,
|
|
|
),
|
|
|
fmt.Sprintf("UPDATE manufacture.product_attendance_record SET %s WHERE product_attendance_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
|
|
|
//productAttendanceRecord.ProductAttendanceId,
|
...
|
...
|
@@ -122,6 +126,7 @@ func (repository *ProductAttendanceRecordRepository) Save(productAttendanceRecor |
|
|
productAttendanceRecord.UpdatedAt,
|
|
|
//productAttendanceRecord.DeletedAt,
|
|
|
productAttendanceRecord.Ext,
|
|
|
productAttendanceRecord.ProductDate,
|
|
|
productAttendanceRecord.Identify(),
|
|
|
); err != nil {
|
|
|
return productAttendanceRecord, err
|
...
|
...
|
@@ -189,10 +194,10 @@ func (repository *ProductAttendanceRecordRepository) Find(queryOptions map[strin |
|
|
query.Where(fmt.Sprintf(`work_station->>'sectionName' like '%%%v%%'`, v))
|
|
|
}
|
|
|
if v, ok := queryOptions["signBeginTime"]; ok && !((v.(time.Time)).IsZero()) {
|
|
|
query.Where("created_at>=?", v.(time.Time))
|
|
|
query.Where("product_date>=?", v.(time.Time))
|
|
|
}
|
|
|
if v, ok := queryOptions["signEndTime"]; ok && !((v.(time.Time)).IsZero()) {
|
|
|
query.Where("created_at<?", v.(time.Time))
|
|
|
query.Where("product_date<?", v.(time.Time))
|
|
|
}
|
|
|
if v, ok := queryOptions["employeeType"]; ok && (v.(int)) > 0 {
|
|
|
query.Where("product_worker->>'employeeType'='?'", v.(int))
|
...
|
...
|
|