报价单接近完成
This commit is contained in:
@@ -84,7 +84,21 @@ type ProductPrice struct {
|
||||
}
|
||||
|
||||
func (c *FsProductPriceModel) GetAllSelectBySizeId(ctx context.Context, sizeIds []int64) (prices []*ProductPrice, err error) {
|
||||
|
||||
err = c.db.WithContext(ctx).Model(&ProductPrice{}).Where("size_id IN (?) AND status = ?", sizeIds, 1).Select("id, min_buy_num, step_num, step_price, product_id, size_id, each_box_num").Find(&prices).Error
|
||||
var pprices []*FsProductPrice
|
||||
err = c.db.WithContext(ctx).Model(&FsProductPrice{}).Where("size_id IN (?) AND status = ?", sizeIds, 1).Select("id, min_buy_num, step_num, step_price, product_id, size_id, each_box_num").Find(&pprices).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, p := range pprices {
|
||||
prices = append(prices, &ProductPrice{
|
||||
Id: p.Id,
|
||||
MinBuyNum: *p.MinBuyNum,
|
||||
StepNum: *p.StepNum,
|
||||
StepPrice: *p.StepPrice,
|
||||
ProductId: *p.ProductId,
|
||||
SizeId: *p.SizeId,
|
||||
EachBoxNum: *p.EachBoxNum,
|
||||
})
|
||||
}
|
||||
return prices, err
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ type CapacityId struct {
|
||||
Capacity string `json:"capacity"`
|
||||
}
|
||||
|
||||
func (c *FsProductSizeModel) GetAllSelectIdAndCapacityByIds(ctx context.Context, sizeIds []int64) (sizes []CapacityId, err error) {
|
||||
err = c.db.WithContext(ctx).Where("id IN ?", sizeIds).Select("id, capacity").Find(&sizes).Error
|
||||
func (c *FsProductSizeModel) GetAllSelectIdAndCapacityByIds(ctx context.Context, sizeIds []int64) (sizes []FsProductSize, err error) {
|
||||
err = c.db.WithContext(ctx).Where("id IN ?", sizeIds).Select("id", "capacity").Find(&sizes).Error
|
||||
return sizes, err
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ import "context"
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (m *FsQuotationModel) FindOneOnlyById(ctx context.Context, quotationId int64) (resp FsQuotation, err error) {
|
||||
err = m.db.WithContext(ctx).Model(&resp).Where("`quotation_id` = ?", quotationId).Take(&resp).Error
|
||||
err = m.db.WithContext(ctx).Model(&resp).Where("`id` = ?", quotationId).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import "context"
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (c *FsQuotationProductModel) GetAllByQuotationIdOrderAsc(ctx context.Context, quotationId int64) (resp []FsQuotationProduct, err error) {
|
||||
func (c *FsQuotationProductModel) GetAllByQuotationIdOrderAsc(ctx context.Context, quotationId int64) (resp []*FsQuotationProduct, err error) {
|
||||
err = c.db.WithContext(ctx).Model(&FsQuotationProduct{}).Where("`quotation_id` = ? and `status` = ?", quotationId, 1).Order("sort asc").Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
import "context"
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (c *FsQuotationSalerModel) GetOne(ctx context.Context, salerId int64) (resp FsQuotationSaler, err error) {
|
||||
err = c.db.WithContext(ctx).Model(&resp).Where("`id` = ?", salerId).Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user