This commit is contained in:
haomingming 2026-01-06 15:33:38 +08:00
parent 226b106997
commit ffbc1c83c2

View File

@ -210,7 +210,12 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
// 处方编号
if req.PrescriptionCode != "" {
query = query.Where("prescription_code = ?", req.PrescriptionCode)
// 处方编号存在于处方表中这里通过处方表查询出对应的处方ID再反查商品订单
subQuery := global.Db.Model(&model.OrderPrescription{}).
Select("order_prescription_id").
Where("prescription_code = ?", req.PrescriptionCode)
query = query.Where("order_prescription_id IN (?)", subQuery)
}
// 订单编号