package com.fs.hisStore.service.impl;

import com.fs.common.utils.DateUtils;
import com.fs.his.mapper.FsMaterialGroupMapper;
import com.fs.hisStore.domain.FsMaterialGroupScrm;
import com.fs.hisStore.mapper.FsMaterialGroupScrmMapper;
import com.fs.hisStore.service.IFsMaterialGroupScrmStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 素材分组Service业务层处理
 *
 * @author fs
 * @date 2023-07-06
 */
@Service
public class FsMaterialGroupScrmStoreServiceImpl implements IFsMaterialGroupScrmStoreService
{
    @Autowired
    private FsMaterialGroupScrmMapper fsMaterialGroupMapper;

    /**
     * 查询素材分组
     *
     * @param groupId 素材分组主键
     * @return 素材分组
     */
    @Override
    public FsMaterialGroupScrm selectFsMaterialGroupByGroupId(Long groupId)
    {
        return fsMaterialGroupMapper.selectFsMaterialGroupById(groupId);
    }

    /**
     * 查询素材分组列表
     *
     * @param fsMaterialGroup 素材分组
     * @return 素材分组
     */
    @Override
    public List<FsMaterialGroupScrm> selectFsMaterialGroupList(FsMaterialGroupScrm fsMaterialGroup)
    {
        return fsMaterialGroupMapper.selectFsMaterialGroupList(fsMaterialGroup);
    }

    /**
     * 新增素材分组
     *
     * @param fsMaterialGroup 素材分组
     * @return 结果
     */
    @Override
    public int insertFsMaterialGroup(FsMaterialGroupScrm fsMaterialGroup)
    {
        fsMaterialGroup.setCreateTime(DateUtils.getNowDate());
        return fsMaterialGroupMapper.insertFsMaterialGroup(fsMaterialGroup);
    }

    /**
     * 修改素材分组
     *
     * @param fsMaterialGroup 素材分组
     * @return 结果
     */
    @Override
    public int updateFsMaterialGroup(FsMaterialGroupScrm fsMaterialGroup)
    {
        fsMaterialGroup.setUpdateTime(DateUtils.getNowDate());
        return fsMaterialGroupMapper.updateFsMaterialGroup(fsMaterialGroup);
    }

    /**
     * 批量删除素材分组
     *
     * @param groupIds 需要删除的素材分组主键
     * @return 结果
     */
    @Override
    public int deleteFsMaterialGroupByGroupIds(Long[] groupIds)
    {
        return fsMaterialGroupMapper.deleteFsMaterialGroupByIds(groupIds);
    }

    /**
     * 删除素材分组信息
     *
     * @param groupId 素材分组主键
     * @return 结果
     */
    @Override
    public int deleteFsMaterialGroupByGroupId(Long groupId)
    {
        return fsMaterialGroupMapper.deleteFsMaterialGroupById(groupId);
    }
}
