| | |
| | | AuxiliaryUnit string `json:"auxiliaryUnit" gorm:"type:varchar(191);comment:辅助单位"` |
| | | Remark string `gorm:"type:varchar(1024);comment:备注" json:"remark"` |
| | | IsInternalOutput bool `json:"isInternalOutput"` //是否调拨产生的出库 |
| | | DealerType string `json:"dealerType"` //出入库类型 |
| | | |
| | | Cost decimal.Decimal `json:"cost" ` //成本单价 |
| | | SalePrice decimal.Decimal `json:"salePrice" ` //销售单价 |
| | |
| | | } |
| | | return result, nil |
| | | } |
| | | |
| | | type GroupByDealerTypeWarehouse struct { |
| | | DealerType string |
| | | ProductID string |
| | | Sum decimal.Decimal |
| | | } |
| | | |
| | | func (slf *OperationDetailsSearch) GroupMultiSumAmount() ([]*GroupByDealerTypeWarehouse, error) { |
| | | var ( |
| | | db = slf.build() |
| | | result = make([]*GroupByDealerTypeWarehouse, 0) |
| | | ) |
| | | if err := db.Select("sum(amount) as sum, dealer_type, product_id").Group("product_id, dealer_type").Scan(&result).Error; err != nil { |
| | | return nil, fmt.Errorf("select group err: %v", err) |
| | | } |
| | | return result, nil |
| | | } |