package com.fs.hospital.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.hospital.mapper.HospitalConfigMapper;
import com.fs.hospital.domain.HospitalConfig;
import com.fs.hospital.service.IHospitalConfigService;

/**
 * 参数配置Service业务层处理
 *
 * @author fs
 * @date 2024-03-13
 */
@Service
public class HospitalConfigServiceImpl implements IHospitalConfigService
{
    @Autowired
    private HospitalConfigMapper hospitalConfigMapper;

    /**
     * 查询参数配置
     *
     * @param configId 参数配置主键
     * @return 参数配置
     */
    @Override
    public HospitalConfig selectHospitalConfigByConfigId(Long configId)
    {
        return hospitalConfigMapper.selectHospitalConfigByConfigId(configId);
    }


    /**
     * 查询参数配置列表
     *
     * @param hospitalConfig 参数配置
     * @return 参数配置
     */
    @Override
    public List<HospitalConfig> selectHospitalConfigList(HospitalConfig hospitalConfig)
    {
        return hospitalConfigMapper.selectHospitalConfigList(hospitalConfig);
    }

    /**
     * 新增参数配置
     *
     * @param hospitalConfig 参数配置
     * @return 结果
     */
    @Override
    public int insertHospitalConfig(HospitalConfig hospitalConfig)
    {
        hospitalConfig.setCreateTime(DateUtils.getNowDate());
        return hospitalConfigMapper.insertHospitalConfig(hospitalConfig);
    }

    /**
     * 修改参数配置
     *
     * @param hospitalConfig 参数配置
     * @return 结果
     */
    @Override
    public int updateHospitalConfig(HospitalConfig hospitalConfig)
    {
        hospitalConfig.setUpdateTime(DateUtils.getNowDate());
        return hospitalConfigMapper.updateHospitalConfig(hospitalConfig);
    }

    /**
     * 批量删除参数配置
     *
     * @param configIds 需要删除的参数配置主键
     * @return 结果
     */
    @Override
    public int deleteHospitalConfigByConfigIds(Long[] configIds)
    {
        return hospitalConfigMapper.deleteHospitalConfigByConfigIds(configIds);
    }

    /**
     * 删除参数配置信息
     *
     * @param configId 参数配置主键
     * @return 结果
     */
    @Override
    public int deleteHospitalConfigByConfigId(Long configId)
    {
        return hospitalConfigMapper.deleteHospitalConfigByConfigId(configId);
    }

    @Override
    public HospitalConfig selectHospitalConfigByKey(String configKey, Long hospitalId) {
        return hospitalConfigMapper.selectHospitalConfigByKey(configKey, hospitalId);
    }
}
