fix
This commit is contained in:
@@ -75,3 +75,18 @@ func (d *FsProductModel3dModel) GetAll(ctx context.Context) (resp []FsProductMod
|
||||
err = d.db.WithContext(ctx).Model(&FsProductModel3d{}).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
type GetGroupPartListByProductIdsRsp struct {
|
||||
PartList string `json:"part_list"`
|
||||
ProductId int64 `json:"product_id"`
|
||||
}
|
||||
|
||||
func (d *FsProductModel3dModel) GetGroupPartListByProductIds(ctx context.Context, productIds []int64) (resp []GetGroupPartListByProductIdsRsp, err error) {
|
||||
if len(productIds) == 0 {
|
||||
return
|
||||
}
|
||||
err = d.db.WithContext(ctx).Model(&FsProductModel3d{}).
|
||||
Select("product_id,group_concat(part_list) as part_list").
|
||||
Group("product_id").Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user