package com.zhyc.module.feed.service.impl;

import java.util.List;

import com.zhyc.common.annotation.DataScope;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
import com.zhyc.module.feed.domain.SgFormulaList;
import com.zhyc.module.feed.service.ISgFormulaListService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 配方列表Service业务层处理
 *
 * @author HashMap
 * @date 2025-08-09
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SgFormulaListServiceImpl implements ISgFormulaListService {
    private final SgFormulaListMapper sgFormulaListMapper;

    public SgFormulaListServiceImpl(SgFormulaListMapper sgFormulaListMapper) {
        this.sgFormulaListMapper = sgFormulaListMapper;
    }

    /**
     * 查询配方列表
     *
     * @param code 配方列表主键
     * @return 配方列表
     */
    @Override
    public SgFormulaList selectSgFormulaListByCode(Long code) {
        return sgFormulaListMapper.selectSgFormulaListByCode(code);
    }

    /**
     * 查询配方列表列表
     *
     * @param sgFormulaList 配方列表
     * @return 配方列表
     */
    @Override
    @DataScope(deptAlias = "sg_formula_list_alias", userAlias = "sg_formula_list_alias")
    public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) {
        return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
    }

    /**
     * 新增配方列表
     *
     * @param sgFormulaList 配方列表
     * @return 结果
     */
    @Override
    public int insertSgFormulaList(SgFormulaList sgFormulaList) {
        return sgFormulaListMapper.insertSgFormulaList(sgFormulaList);
    }

    /**
     * 修改配方列表
     *
     * @param sgFormulaList 配方列表
     * @return 结果
     */
    @Override
    public int updateSgFormulaList(SgFormulaList sgFormulaList) {
        return sgFormulaListMapper.updateSgFormulaList(sgFormulaList);
    }

    /**
     * 批量删除配方列表
     *
     * @param codes 需要删除的配方列表主键
     * @return 结果
     */
    @Override
    public int deleteSgFormulaListByCodes(Long[] codes) {
        return sgFormulaListMapper.deleteSgFormulaListByCodes(codes);
    }

    /**
     * 删除配方列表信息
     *
     * @param code 配方列表主键
     * @return 结果
     */
    @Override
    public int deleteSgFormulaListByCode(Long code) {
        return sgFormulaListMapper.deleteSgFormulaListByCode(code);
    }

    @Override
    public int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList) {
        return sgFormulaListMapper.deleteSgFormulaListByFormulaIdAndBatchId(sgFormulaList);
    }
}
