package com.fs.hospital.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.hospital.vo.HospitalProductListHVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.hospital.mapper.HospitalProductMapper;
import com.fs.hospital.domain.HospitalProduct;
import com.fs.hospital.service.IHospitalProductService;

/**
 * 诊所商品Service业务层处理
 *
 * @author fs
 * @date 2024-03-12
 */
@Service
public class HospitalProductServiceImpl implements IHospitalProductService
{
    @Autowired
    private HospitalProductMapper hospitalProductMapper;

    /**
     * 查询诊所商品
     *
     * @param productId 诊所商品主键
     * @return 诊所商品
     */
    @Override
    public HospitalProduct selectHospitalProductByProductId(Long productId)
    {
        return hospitalProductMapper.selectHospitalProductByProductId(productId);
    }

    /**
     * 查询诊所商品列表
     *
     * @param hospitalProduct 诊所商品
     * @return 诊所商品
     */
    @Override
    public List<HospitalProduct> selectHospitalProductList(HospitalProduct hospitalProduct)
    {
        return hospitalProductMapper.selectHospitalProductList(hospitalProduct);
    }

    /**
     * 新增诊所商品
     *
     * @param hospitalProduct 诊所商品
     * @return 结果
     */
    @Override
    public int insertHospitalProduct(HospitalProduct hospitalProduct)
    {
        hospitalProduct.setCreateTime(DateUtils.getNowDate());
        return hospitalProductMapper.insertHospitalProduct(hospitalProduct);
    }

    /**
     * 修改诊所商品
     *
     * @param hospitalProduct 诊所商品
     * @return 结果
     */
    @Override
    public int updateHospitalProduct(HospitalProduct hospitalProduct)
    {
        hospitalProduct.setUpdateTime(DateUtils.getNowDate());
        return hospitalProductMapper.updateHospitalProduct(hospitalProduct);
    }

    /**
     * 批量删除诊所商品
     *
     * @param productIds 需要删除的诊所商品主键
     * @return 结果
     */
    @Override
    public int deleteHospitalProductByProductIds(Long[] productIds)
    {
        return hospitalProductMapper.deleteHospitalProductByProductIds(productIds);
    }

    /**
     * 删除诊所商品信息
     *
     * @param productId 诊所商品主键
     * @return 结果
     */
    @Override
    public int deleteHospitalProductByProductId(Long productId)
    {
        return hospitalProductMapper.deleteHospitalProductByProductId(productId);
    }

    @Override
    public List<HospitalProductListHVO> selectHospitalProductListPVO(HospitalProduct hospitalProduct) {
        return hospitalProductMapper.selectHospitalProductListPVO(hospitalProduct);
    }
}
