拓展接口响应

This commit is contained in:
2025-11-21 17:23:57 +08:00
parent 4224be8567
commit 7829ac9931
8 changed files with 142 additions and 49 deletions

View File

@@ -143,7 +143,12 @@ func (s *feedManagementServiceImpl) GetNutrient(ctx context.Context, id uint32)
func (s *feedManagementServiceImpl) ListNutrients(ctx context.Context, req *dto.ListNutrientRequest) (*dto.ListNutrientResponse, error) {
serviceCtx := logs.AddFuncName(ctx, s.ctx, "ListNutrients")
nutrients, total, err := s.recipeSvc.ListNutrients(serviceCtx, req.Page, req.PageSize)
opts := repository.NutrientListOptions{
Name: req.Name,
RawMaterialName: req.RawMaterialName,
OrderBy: req.OrderBy,
}
nutrients, total, err := s.recipeSvc.ListNutrients(serviceCtx, opts, req.Page, req.PageSize)
if err != nil {
return nil, fmt.Errorf("获取营养种类列表失败: %w", err)
}
@@ -218,7 +223,12 @@ func (s *feedManagementServiceImpl) GetRawMaterial(ctx context.Context, id uint3
func (s *feedManagementServiceImpl) ListRawMaterials(ctx context.Context, req *dto.ListRawMaterialRequest) (*dto.ListRawMaterialResponse, error) {
serviceCtx := logs.AddFuncName(ctx, s.ctx, "ListRawMaterials")
rawMaterials, total, err := s.recipeSvc.ListRawMaterials(serviceCtx, req.Page, req.PageSize)
opts := repository.RawMaterialListOptions{
Name: req.Name,
NutrientName: req.NutrientName,
OrderBy: req.OrderBy,
}
rawMaterials, total, err := s.recipeSvc.ListRawMaterials(serviceCtx, opts, req.Page, req.PageSize)
if err != nil {
return nil, fmt.Errorf("获取原料列表失败: %w", err)
}