- 菜谱配料列表中,返回sku的名字与图片
This commit is contained in:
@@ -10,6 +10,20 @@ type FoodRecipeWithAction struct {
|
||||
ActionType int8 `json:"actionType"`
|
||||
}
|
||||
|
||||
type FoodRecipeItemChoiceExt struct {
|
||||
model.FoodRecipeItemChoice
|
||||
|
||||
Img string `orm:"size(255)" json:"img"`
|
||||
SkuName string `json:"skuName"`
|
||||
|
||||
Prefix string `json:"-"`
|
||||
SkuNameName string `orm:"column(sku_name_name)" json:"-"`
|
||||
Unit string `orm:"size(8)" json:"-"`
|
||||
SpecQuality float32 `json:"-"`
|
||||
SpecUnit string `json:"-"`
|
||||
Comment string `json:"-"`
|
||||
}
|
||||
|
||||
func QueryFoodRecipes(db *DaoDB, keyword string, recipeID int, authorID, userID string, offset, pageSize int) (recipeList []*FoodRecipeWithAction, totalCount int, err error) {
|
||||
var sql string
|
||||
var sqlParams []interface{}
|
||||
@@ -91,10 +105,14 @@ func QueryFoodRecipesItems(db *DaoDB, recipeID int) (recipeItemList []*model.Foo
|
||||
return recipeItemList, err
|
||||
}
|
||||
|
||||
func QueryFoodRecipesItemChoices(db *DaoDB, recipeID int) (recipeItemChoiceList []*model.FoodRecipeItemChoice, err error) {
|
||||
func QueryFoodRecipesItemChoices(db *DaoDB, recipeID int) (recipeItemChoiceList []*FoodRecipeItemChoiceExt, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
SELECT t1.*,
|
||||
t2.spec_quality, t2.spec_unit, t2.comment,
|
||||
t3.img, t3.prefix, t3.name sku_name_name, t3.unit
|
||||
FROM food_recipe_item_choice t1
|
||||
LEFT JOIN sku t2 ON t2.id = t1.sku_id
|
||||
LEFT JOIN sku_name t3 ON t3.id = t2.name_id
|
||||
WHERE t1.deleted_at = ? AND t1.recipe_id = ?`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
|
||||
Reference in New Issue
Block a user