package com.fs.his.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.his.mapper.FsAppVersionMapper;
import com.fs.his.domain.FsAppVersion;
import com.fs.his.service.IFsAppVersionService;

/**
 * app版本Service业务层处理
 *
 * @author fs
 * @date 2023-08-03
 */
@Service
public class FsAppVersionServiceImpl implements IFsAppVersionService
{
    @Autowired
    private FsAppVersionMapper fsAppVersionMapper;

    /**
     * 查询app版本
     *
     * @param versionId app版本主键
     * @return app版本
     */
    @Override
    public FsAppVersion selectFsAppVersionByVersionId(Long versionId)
    {
        return fsAppVersionMapper.selectFsAppVersionByVersionId(versionId);
    }

    /**
     * 查询app版本列表
     *
     * @param fsAppVersion app版本
     * @return app版本
     */
    @Override
    public List<FsAppVersion> selectFsAppVersionList(FsAppVersion fsAppVersion)
    {
        return fsAppVersionMapper.selectFsAppVersionList(fsAppVersion);
    }

    /**
     * 新增app版本
     *
     * @param fsAppVersion app版本
     * @return 结果
     */
    @Override
    public int insertFsAppVersion(FsAppVersion fsAppVersion)
    {
        fsAppVersion.setCreateTime(DateUtils.getNowDate());
        return fsAppVersionMapper.insertFsAppVersion(fsAppVersion);
    }

    /**
     * 修改app版本
     *
     * @param fsAppVersion app版本
     * @return 结果
     */
    @Override
    public int updateFsAppVersion(FsAppVersion fsAppVersion)
    {
        return fsAppVersionMapper.updateFsAppVersion(fsAppVersion);
    }

    /**
     * 批量删除app版本
     *
     * @param versionIds 需要删除的app版本主键
     * @return 结果
     */
    @Override
    public int deleteFsAppVersionByVersionIds(Long[] versionIds)
    {
        return fsAppVersionMapper.deleteFsAppVersionByVersionIds(versionIds);
    }

    /**
     * 删除app版本信息
     *
     * @param versionId app版本主键
     * @return 结果
     */
    @Override
    public int deleteFsAppVersionByVersionId(Long versionId)
    {
        return fsAppVersionMapper.deleteFsAppVersionByVersionId(versionId);
    }

    @Override
    public FsAppVersion getNewAppVersion(Integer appType) {
        return fsAppVersionMapper.getNewAppVersion(appType);
    }

    @Override
    public FsAppVersion getNewUserAppVersion(Integer type) {
        return fsAppVersionMapper.getNewUserAppVersion(type);
    }

    @Override
    public FsAppVersion getNewVersion(Integer appType, int type) {
        return fsAppVersionMapper.getNewVersion1(appType,type);
    }
}
