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

import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.base.mapper.SheepPedigreeMapper;
import com.zhyc.module.base.domain.SheepPedigree;
import com.zhyc.module.base.service.ISheepPedigreeService;

/**
 * VIEWService业务层处理
 * 
 * @author ruoyi
 * @date 2026-02-04
 */
@Service
public class SheepPedigreeServiceImpl implements ISheepPedigreeService 
{
    @Autowired
    private SheepPedigreeMapper sheepPedigreeMapper;

    /**
     * 查询VIEW
     * 
     * @param id VIEW主键
     * @return VIEW
     */
    @Override
    public SheepPedigree selectSheepPedigreeById(Long id)
    {
        return sheepPedigreeMapper.selectSheepPedigreeById(id);
    }

    /**
     * 查询VIEW列表
     * 
     * @param sheepPedigree VIEW
     * @return VIEW
     */
    @Override
    public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree)
    {
        return sheepPedigreeMapper.selectSheepPedigreeList(sheepPedigree);
    }

    /**
     * 新增VIEW
     * 
     * @param sheepPedigree VIEW
     * @return 结果
     */
    @Override
    public int insertSheepPedigree(SheepPedigree sheepPedigree)
    {
        sheepPedigree.setCreateTime(DateUtils.getNowDate());
        return sheepPedigreeMapper.insertSheepPedigree(sheepPedigree);
    }

    /**
     * 修改VIEW
     * 
     * @param sheepPedigree VIEW
     * @return 结果
     */
    @Override
    public int updateSheepPedigree(SheepPedigree sheepPedigree)
    {
        sheepPedigree.setUpdateTime(DateUtils.getNowDate());
        return sheepPedigreeMapper.updateSheepPedigree(sheepPedigree);
    }

    /**
     * 批量删除VIEW
     * 
     * @param ids 需要删除的VIEW主键
     * @return 结果
     */
    @Override
    public int deleteSheepPedigreeByIds(Long[] ids)
    {
        return sheepPedigreeMapper.deleteSheepPedigreeByIds(ids);
    }

    /**
     * 删除VIEW信息
     * 
     * @param id VIEW主键
     * @return 结果
     */
    @Override
    public int deleteSheepPedigreeById(Long id)
    {
        return sheepPedigreeMapper.deleteSheepPedigreeById(id);
    }

    @Override
    public String getBreedNameById(Long id) {
        if (id == null) { // int类型id为空直接返回空
            return "";
        }
        return sheepPedigreeMapper.selectBreedNameById(id);
    }
}
