mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
init add function command for create seed depretitaion standard
This commit is contained in:
@@ -51,7 +51,7 @@ type ExpenseDepreciationRepository interface {
|
||||
DeleteSnapshotsFromDate(ctx context.Context, fromDate time.Time, farmIDs []uint) error
|
||||
DeleteSnapshotsByFarmIDs(ctx context.Context, farmIDs []uint) error
|
||||
GetLatestTransferInputsByFarms(ctx context.Context, period time.Time, farmIDs []uint) ([]FarmDepreciationLatestTransferRow, error)
|
||||
GetMultiplicationPercentages(ctx context.Context, houseTypes []string, maxDay int) (map[string]map[int]float64, map[string]*time.Time, error)
|
||||
GetMultiplicationPercentages(ctx context.Context, houseTypes []string, maxDay int, projectFlockID uint) (map[string]map[int]float64, map[string]*time.Time, error)
|
||||
GetLatestManualInputsByFarms(ctx context.Context, areaIDs, locationIDs, projectFlockIDs []int64) ([]FarmDepreciationManualInputRow, error)
|
||||
UpsertManualInput(ctx context.Context, row *entity.FarmDepreciationManualInput) error
|
||||
DB() *gorm.DB
|
||||
@@ -245,6 +245,7 @@ func (r *expenseDepreciationRepository) GetMultiplicationPercentages(
|
||||
ctx context.Context,
|
||||
houseTypes []string,
|
||||
maxDay int,
|
||||
projectFlockID uint,
|
||||
) (map[string]map[int]float64, map[string]*time.Time, error) {
|
||||
result := make(map[string]map[int]float64)
|
||||
effectiveDates := make(map[string]*time.Time)
|
||||
@@ -258,8 +259,9 @@ func (r *expenseDepreciationRepository) GetMultiplicationPercentages(
|
||||
house_type::text AS house_type, day, multiplication_percentage, effective_date
|
||||
FROM house_depreciation_standards
|
||||
WHERE house_type::text IN ? AND day <= ?
|
||||
ORDER BY house_type, day, effective_date DESC NULLS LAST
|
||||
`, houseTypes, maxDay).Scan(&rows).Error; err != nil {
|
||||
AND (project_flock_id = ? OR project_flock_id IS NULL)
|
||||
ORDER BY house_type, day, (project_flock_id IS NOT NULL) DESC, effective_date DESC NULLS LAST
|
||||
`, houseTypes, maxDay, projectFlockID).Scan(&rows).Error; err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user