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 com.zd.system.api.laboratory.domain.LabGradeManageRecordDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zd.laboratory.mapper.LabGradeManageRecordDetailMapper;
import com.zd.laboratory.service.ILabGradeManageRecordDetailService;

/**
 * 管控执行记录详情Service业务层处理
 *
 * @author liubo
 * @date 2022-02-10
 */
@Service
public class LabGradeManageRecordDetailServiceImpl implements ILabGradeManageRecordDetailService {
    @Autowired
    private LabGradeManageRecordDetailMapper labGradeManageRecordDetailMapper;

    /**
     * 查询管控执行记录详情
     *
     * @param id 管控执行记录详情主键
     * @return 管控执行记录详情
     */
    @Override
    public LabGradeManageRecordDetail selectLabGradeManageRecordDetailById(Long id) {
        return labGradeManageRecordDetailMapper.selectLabGradeManageRecordDetailById(id);
    }

    /**
     * 查询管控执行记录详情列表
     *
     * @param labGradeManageRecordDetail 管控执行记录详情
     * @return 管控执行记录详情
     */
    @Override
    public List<LabGradeManageRecordDetail> selectLabGradeManageRecordDetailList(LabGradeManageRecordDetail labGradeManageRecordDetail) {
        return labGradeManageRecordDetailMapper.selectLabGradeManageRecordDetailList(labGradeManageRecordDetail);
    }

    /**
     * 新增管控执行记录详情
     *
     * @param labGradeManageRecordDetail 管控执行记录详情
     * @return 结果
     */
    @Override
    public int insertLabGradeManageRecordDetail(LabGradeManageRecordDetail labGradeManageRecordDetail) {
        //设置其他公共字段
        SaveUtil.setCommonAttr(labGradeManageRecordDetail);
        return labGradeManageRecordDetailMapper.insertLabGradeManageRecordDetail(labGradeManageRecordDetail);
    }

    /**
     * 修改管控执行记录详情
     *
     * @param labGradeManageRecordDetail 管控执行记录详情
     * @return 结果
     */
    @Override
    public int updateLabGradeManageRecordDetail(LabGradeManageRecordDetail labGradeManageRecordDetail) {
        labGradeManageRecordDetail.setUpdateTime(DateUtils.getNowDate());
        labGradeManageRecordDetail.setUpdateBy(SecurityUtils.getUsername());
        return labGradeManageRecordDetailMapper.updateLabGradeManageRecordDetail(labGradeManageRecordDetail);
    }

    /**
     * 批量删除管控执行记录详情
     *
     * @param ids 需要删除的管控执行记录详情主键
     * @return 结果
     */
    @Override
    public int deleteLabGradeManageRecordDetailByIds(Long[] ids) {
        return labGradeManageRecordDetailMapper.deleteLabGradeManageRecordDetailByIds(ids);
    }

    /**
     * 删除管控执行记录详情信息
     *
     * @param id 管控执行记录详情主键
     * @return 结果
     */
    @Override
    public int deleteLabGradeManageRecordDetailById(Long id) {
        return labGradeManageRecordDetailMapper.deleteLabGradeManageRecordDetailById(id);
    }
}
