feat : spu

This commit is contained in:
2025-03-25 17:34:26 +08:00
parent 6fca649c86
commit 3b7817bf02
4 changed files with 68 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Model;
use App\Constants\Common\CategoryCode;
use App\Constants\Common\GoodCode;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
@@ -102,4 +103,17 @@ class Spu extends Model
return $res->toArray();
}
/**
* @param int $cycle_id
* @return array
*/
public function getCycleIdAddStapleFoodSkuIds(int $cycle_id): array
{
return $this
->leftJoin('sku','sku.spu_id','=','spu.id')
->where('spu.cycle_id',$cycle_id)
->where('spu.category_id',CategoryCode::EXTRA_STAPLE)->pluck('sku.id')
->toArray();
}
}