package com.xinyilu.system.service.motionprescriptioninfo.impl;

import java.util.List;

import com.xinyilu.common.utils.DateUtils;
import com.xinyilu.system.domain.motionprescriptioninfo.MotionPrescriptionDict;
import com.xinyilu.system.mapper.motionprescriptioninfo.MotionPrescriptionDictMapper;
import com.xinyilu.system.service.motionprescriptioninfo.IMotionPrescriptionDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 运动处方字典Service业务层处理
 *
 * @author xinyilu
 * @date 2022-08-01
 */
@Service
public class MotionPrescriptionDictServiceImpl implements IMotionPrescriptionDictService {
    @Autowired
    private MotionPrescriptionDictMapper motionPrescriptionDictMapper;

    /**
     * 查询运动处方字典
     *
     * @param id 运动处方字典主键
     * @return 运动处方字典
     */
    @Override
    public MotionPrescriptionDict selectMotionPrescriptionDictById(Long id) {
        return motionPrescriptionDictMapper.selectMotionPrescriptionDictById(id);
    }

    /**
     * 查询运动处方字典列表
     *
     * @param motionPrescriptionDict 运动处方字典
     * @return 运动处方字典
     */
    @Override
    public List<MotionPrescriptionDict> selectMotionPrescriptionDictList(MotionPrescriptionDict motionPrescriptionDict) {
        return motionPrescriptionDictMapper.selectMotionPrescriptionDictList(motionPrescriptionDict);
    }

    /**
     * 新增运动处方字典
     *
     * @param motionPrescriptionDict 运动处方字典
     * @return 结果
     */
    @Override
    public int insertMotionPrescriptionDict(MotionPrescriptionDict motionPrescriptionDict) {
        motionPrescriptionDict.setCreateTime(DateUtils.getNowDate());
        //是否删除
        motionPrescriptionDict.setDelFlag(0);
        return motionPrescriptionDictMapper.insertMotionPrescriptionDict(motionPrescriptionDict);
    }

    /**
     * 修改运动处方字典
     *
     * @param motionPrescriptionDict 运动处方字典
     * @return 结果
     */
    @Override
    public int updateMotionPrescriptionDict(MotionPrescriptionDict motionPrescriptionDict) {
        motionPrescriptionDict.setUpdateTime(DateUtils.getNowDate());
        //是否删除
        motionPrescriptionDict.setDelFlag(0);
        return motionPrescriptionDictMapper.updateMotionPrescriptionDict(motionPrescriptionDict);
    }

    /**
     * 批量删除运动处方字典
     *
     * @param ids 需要删除的运动处方字典主键
     * @return 结果
     */
    @Override
    public int deleteMotionPrescriptionDictByIds(Long[] ids) {
        return motionPrescriptionDictMapper.deleteMotionPrescriptionDictByIds(ids);
    }

    /**
     * 删除运动处方字典信息
     *
     * @param id 运动处方字典主键
     * @return 结果
     */
    @Override
    public int deleteMotionPrescriptionDictById(Long id) {
        return motionPrescriptionDictMapper.deleteMotionPrescriptionDictById(id);
    }

    /**
     * 批量删除运动处方字典
     *
     * @param ids 需要删除的运动处方字典主键
     * @return 结果
     */
    @Override
    public int updateMotionPrescriptionDictById(Long[] ids) {
        return motionPrescriptionDictMapper.updateMotionPrescriptionDictById(ids);
    }

}
