package com.zd.laboratory.service.impl;

import java.util.List;

import com.zd.common.core.utils.DateUtils;
import com.zd.common.core.utils.SecurityUtils;
import com.zd.common.security.utils.SaveUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.laboratory.mapper.LabGradeManageRuleUserMapper;
import com.zd.laboratory.domain.LabGradeManageRuleUser;
import com.zd.laboratory.service.ILabGradeManageRuleUserService;

/**
 * 分级管控确认人员Service业务层处理
 *
 * @author liubo
 * @date 2022-02-10
 */
@Service
public class LabGradeManageRuleUserServiceImpl implements ILabGradeManageRuleUserService {
    @Autowired
    private LabGradeManageRuleUserMapper labGradeManageRuleUserMapper;

    /**
     * 查询分级管控确认人员
     *
     * @param id 分级管控确认人员主键
     * @return 分级管控确认人员
     */
    @Override
    public LabGradeManageRuleUser selectLabGradeManageRuleUserById(Long id) {
        return labGradeManageRuleUserMapper.selectLabGradeManageRuleUserById(id);
    }

    /**
     * 查询分级管控确认人员列表
     *
     * @param labGradeManageRuleUser 分级管控确认人员
     * @return 分级管控确认人员
     */
    @Override
    public List<LabGradeManageRuleUser> selectLabGradeManageRuleUserList(LabGradeManageRuleUser labGradeManageRuleUser) {
        return labGradeManageRuleUserMapper.selectLabGradeManageRuleUserList(labGradeManageRuleUser);
    }

    /**
     * 新增分级管控确认人员
     *
     * @param labGradeManageRuleUser 分级管控确认人员
     * @return 结果
     */
    @Override
    public int insertLabGradeManageRuleUser(LabGradeManageRuleUser labGradeManageRuleUser) {
        //设置其他公共字段
        SaveUtil.setCommonAttr(labGradeManageRuleUser);
        labGradeManageRuleUser.setUpdateTime(DateUtils.getNowDate());
        return labGradeManageRuleUserMapper.insertLabGradeManageRuleUser(labGradeManageRuleUser);
    }

    /**
     * 修改分级管控确认人员
     *
     * @param labGradeManageRuleUser 分级管控确认人员
     * @return 结果
     */
    @Override
    public int updateLabGradeManageRuleUser(LabGradeManageRuleUser labGradeManageRuleUser) {
        // labGradeManageRuleUser.setUpdateTime(DateUtils.getNowDate());
        labGradeManageRuleUser.setUpdateBy(SecurityUtils.getUsername());
        return labGradeManageRuleUserMapper.updateLabGradeManageRuleUser(labGradeManageRuleUser);
    }

    /**
     * 批量删除分级管控确认人员
     *
     * @param ids 需要删除的分级管控确认人员主键
     * @return 结果
     */
    @Override
    public int deleteLabGradeManageRuleUserByIds(Long[] ids) {
        return labGradeManageRuleUserMapper.deleteLabGradeManageRuleUserByIds(ids);
    }

    /**
     * 删除分级管控确认人员信息
     *
     * @param id 分级管控确认人员主键
     * @return 结果
     */
    @Override
    public int deleteLabGradeManageRuleUserById(Long id) {
        return labGradeManageRuleUserMapper.deleteLabGradeManageRuleUserById(id);
    }
}
