package com.ruoyi.tcZz.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcAqg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcMtlxMapper;
import com.ruoyi.tcZz.domain.TcMtlx;
import com.ruoyi.tcZz.service.ITcMtlxService;

/**
 * 媒体类型Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcMtlxServiceImpl implements ITcMtlxService 
{
    @Autowired
    private TcMtlxMapper tcMtlxMapper;

    /**
     * 查询媒体类型
     * 
     * @param id 媒体类型主键
     * @return 媒体类型
     */
    @Override
    public TcMtlx selectTcMtlxById(Long id)
    {
        return tcMtlxMapper.selectTcMtlxById(id);
    }

    /**
     * 查询媒体类型列表
     * 
     * @param tcMtlx 媒体类型
     * @return 媒体类型
     */
    @Override
    public List<TcMtlx> selectTcMtlxList(TcMtlx tcMtlx)
    {
        return tcMtlxMapper.selectTcMtlxList(tcMtlx);
    }

    /**
     * 新增媒体类型
     * 
     * @param tcMtlx 媒体类型
     * @return 结果
     */
    @Override
    public int insertTcMtlx(TcMtlx tcMtlx)
    {
        tcMtlx.setCreateTime(DateUtils.getNowDate());
        return tcMtlxMapper.insertTcMtlx(tcMtlx);
    }

    /**
     * 修改媒体类型
     * 
     * @param tcMtlx 媒体类型
     * @return 结果
     */
    @Override
    public int updateTcMtlx(TcMtlx tcMtlx)
    {
        tcMtlx.setUpdateTime(DateUtils.getNowDate());
        return tcMtlxMapper.updateTcMtlx(tcMtlx);
    }

    /**
     * 批量删除媒体类型
     * 
     * @param ids 需要删除的媒体类型主键
     * @return 结果
     */
    @Override
    public int deleteTcMtlxByIds(Long[] ids)
    {
        return tcMtlxMapper.deleteTcMtlxByIds(ids);
    }

    /**
     * 删除媒体类型信息
     * 
     * @param id 媒体类型主键
     * @return 结果
     */
    @Override
    public int deleteTcMtlxById(Long id)
    {
        return tcMtlxMapper.deleteTcMtlxById(id);
    }

    @Override
    public String importUser(List<TcMtlx> tcMtlxList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcMtlxList.isEmpty()) {
            for (TcMtlx tcMtlx : tcMtlxList) {
                tcMtlxMapper.insertTcMtlx(tcMtlx);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

    @Override
    public void updateByisStatus(Integer isStatus,List<String> ids) {
        tcMtlxMapper.updateByisStatus(isStatus,ids);
    }
}
