package com.zd.laboratory.service.impl;

import java.util.List;

import com.zd.common.core.domain.per.PerPrefix;
import com.zd.common.core.utils.DateUtils;
import com.zd.common.core.utils.SecurityUtils;
import com.zd.common.datascope.annotation.DataScope;
import com.zd.common.security.utils.SaveUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.laboratory.mapper.LabNoticeconfigMapper;
import com.zd.laboratory.domain.LabNoticeconfig;
import com.zd.laboratory.service.ILabNoticeconfigService;

/**
 * 通知配置Service业务层处理
 * 
 * @author zd
 * @date 2022-03-09
 */
@Service
public class LabNoticeconfigServiceImpl implements ILabNoticeconfigService 
{
    @Autowired
    private LabNoticeconfigMapper labNoticeconfigMapper;

    /**
     * 查询通知配置
     * 
     * @param id 通知配置主键
     * @return 通知配置
     */
    @Override
    public LabNoticeconfig selectLabNoticeconfigById(Long id)
    {
        return labNoticeconfigMapper.selectLabNoticeconfigById(id);
    }

    /**
     * 查询通知配置列表
     * 
     * @param labNoticeconfig 通知配置
     * @return 通知配置
     */
    @Override
    @DataScope(deptAlias = "t", permi = PerPrefix.LABORATORY_NOTICECONFIG)
    public List<LabNoticeconfig> selectLabNoticeconfigList(LabNoticeconfig labNoticeconfig)
    {
        return labNoticeconfigMapper.selectLabNoticeconfigList(labNoticeconfig);
    }

    /**
     * 新增通知配置
     * 
     * @param labNoticeconfig 通知配置
     * @return 结果
     */
    @Override
    public int insertLabNoticeconfig(LabNoticeconfig labNoticeconfig)
    {
        SaveUtil.setCommonAttr(labNoticeconfig);
        return labNoticeconfigMapper.insertLabNoticeconfig(labNoticeconfig);
    }

    /**
     * 修改通知配置
     * 
     * @param labNoticeconfig 通知配置
     * @return 结果
     */
    @Override
    public int updateLabNoticeconfig(LabNoticeconfig labNoticeconfig)
    {
        labNoticeconfig.setUpdateTime(DateUtils.getNowDate());
        labNoticeconfig.setUpdateBy(SecurityUtils.getUsername());
        return labNoticeconfigMapper.updateLabNoticeconfig(labNoticeconfig);
    }

    /**
     * 批量删除通知配置
     * 
     * @param ids 需要删除的通知配置主键
     * @return 结果
     */
    @Override
    public int deleteLabNoticeconfigByIds(Long[] ids)
    {
        return labNoticeconfigMapper.deleteLabNoticeconfigByIds(ids);
    }

    /**
     * 删除通知配置信息
     * 
     * @param id 通知配置主键
     * @return 结果
     */
    @Override
    public int deleteLabNoticeconfigById(Long id)
    {
        return labNoticeconfigMapper.deleteLabNoticeconfigById(id);
    }
}
