package com.fs.doctor.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.doctor.mapper.DoctorMsgMapper;
import com.fs.doctor.domain.DoctorMsg;
import com.fs.doctor.service.IDoctorMsgService;

/**
 * 医生消息Service业务层处理
 * 
 * @author fs
 * @date 2025-11-04
 */
@Service
public class DoctorMsgServiceImpl extends ServiceImpl<DoctorMsgMapper, DoctorMsg> implements IDoctorMsgService {

    @Autowired
    private DoctorMsgMapper doctorMsgMapper;

    /**
     * 查询医生消息
     * 
     * @param id 医生消息主键
     * @return 医生消息
     */
    @Override
    public DoctorMsg selectDoctorMsgById(Long id)
    {
        return doctorMsgMapper.selectDoctorMsgById(id);
    }

    /**
     * 查询医生消息列表
     * 
     * @param doctorMsg 医生消息
     * @return 医生消息
     */
    @Override
    public List<DoctorMsg> selectDoctorMsgList(DoctorMsg doctorMsg)
    {
        return doctorMsgMapper.selectDoctorMsgList(doctorMsg);
    }

    /**
     * 新增医生消息
     * 
     * @param doctorMsg 医生消息
     * @return 结果
     */
    @Override
    public int insertDoctorMsg(DoctorMsg doctorMsg)
    {
        doctorMsg.setCreateTime(DateUtils.getNowDate());
        return doctorMsgMapper.insertDoctorMsg(doctorMsg);
    }

    /**
     * 修改医生消息
     * 
     * @param doctorMsg 医生消息
     * @return 结果
     */
    @Override
    public int updateDoctorMsg(DoctorMsg doctorMsg)
    {
        doctorMsg.setUpdateTime(DateUtils.getNowDate());
        return doctorMsgMapper.updateDoctorMsg(doctorMsg);
    }

    /**
     * 批量删除医生消息
     * 
     * @param ids 需要删除的医生消息主键
     * @return 结果
     */
    @Override
    public int deleteDoctorMsgByIds(Long[] ids)
    {
        return doctorMsgMapper.deleteDoctorMsgByIds(ids);
    }

    /**
     * 删除医生消息信息
     * 
     * @param id 医生消息主键
     * @return 结果
     */
    @Override
    public int deleteDoctorMsgById(Long id)
    {
        return doctorMsgMapper.deleteDoctorMsgById(id);
    }

    @Override
    public Long selectDoctorMsgCountsByDoctorId(Long doctorId) {
        return doctorMsgMapper.selectDoctorMsgCountsByDoctorId(doctorId);
    }

    @Override
    public Long selectDoctorMsgCountsByDoctorIdAndType(Long doctorId, int type) {
        return doctorMsgMapper.selectDoctorMsgCountsByDoctorIdAndType(doctorId,type);
    }

    @Override
    public int setAllRead(Long doctorId) {
        return doctorMsgMapper.setAllRead(doctorId);
    }
}
