package com.miaxis.app.coach.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.miaxis.app.coach.dto.CoachInfoDTO;
import com.miaxis.app.coach.dto.CoachInfoVO;
import com.miaxis.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.miaxis.app.coach.mapper.CoachInfoMapper;
import com.miaxis.app.coach.domain.CoachInfo;
import com.miaxis.app.coach.service.ICoachInfoService;

/**
 * 教练Service业务层处理
 *
 * @author miaxis
 * @date 2021-01-07
 */
@Service
public class CoachInfoServiceImpl extends ServiceImpl<CoachInfoMapper, CoachInfo> implements ICoachInfoService {
    @Autowired
    private CoachInfoMapper coachInfoMapper;

    /**
     * 查询教练
     *
     * @param coachnum 教练ID
     * @return 教练
     */
    @Override
    public CoachInfo selectCoachInfoById(String coachnum){
        return coachInfoMapper.selectCoachInfoById(coachnum);
    }

    /**
     * 查询教练列表
     *
     * @param coachInfo 教练
     * @return 教练
     */
    @Override
    public List<CoachInfo> selectCoachInfoList(CoachInfo coachInfo){
        return coachInfoMapper.selectCoachInfoList(coachInfo);
    }

    /**
     * 新增教练
     *
     * @param coachInfo 教练
     * @return 结果
     */
    @Override
    public int insertCoachInfo(CoachInfo coachInfo){
        coachInfo.setCreateTime(DateUtils.getNowDate());
        return coachInfoMapper.insertCoachInfo(coachInfo);
    }

    /**
     * 修改教练
     *
     * @param coachInfo 教练
     * @return 结果
     */
    @Override
    public int updateCoachInfo(CoachInfo coachInfo){
        coachInfo.setUpdateTime(DateUtils.getNowDate());
        return coachInfoMapper.updateCoachInfo(coachInfo);
    }

    /**
     * 批量删除教练
     *
     * @param coachnums 需要删除的教练ID
     * @return 结果
     */
    @Override
    public int deleteCoachInfoByIds(String[] coachnums){
        return coachInfoMapper.deleteCoachInfoByIds(coachnums);
    }

    /**
     * 删除教练信息
     *
     * @param coachnum 教练ID
     * @return 结果
     */
    @Override
    public int deleteCoachInfoById(String coachnum){
        return coachInfoMapper.deleteCoachInfoById(coachnum);
    }


    @Override
    public List<CoachInfoVO> selectCoachInfoUrlList(CoachInfoDTO coachInfoDTO) {
        return coachInfoMapper.selectCoachInfoUrlList(coachInfoDTO);
    }
}
