package com.ruoyi.project.sems.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.sems.mapper.TMeasureRecordMapper;
import com.ruoyi.project.sems.domain.TMeasureRecord;
import com.ruoyi.project.sems.service.ITMeasureRecordService;

/**
 * 测厚记录Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-08
 */
@Service("tMeasureRecordService")
public class TMeasureRecordServiceImpl extends ServiceImpl<TMeasureRecordMapper, TMeasureRecord> implements ITMeasureRecordService
{
    @Autowired
    private TMeasureRecordMapper tMeasureRecordMapper;

    /**
     * 查询测厚记录
     *
     * @param id 测厚记录ID
     * @return 测厚记录
     */
    @Override
    public TMeasureRecord selectTMeasureRecordById(Long id)
    {
        return tMeasureRecordMapper.selectTMeasureRecordById(id);
    }

    /**
     * 查询测厚记录列表
     *
     * @param tMeasureRecord 测厚记录
     * @return 测厚记录
     */
    @Override
    public List<TMeasureRecord> selectTMeasureRecordList(TMeasureRecord tMeasureRecord)
    {
        return tMeasureRecordMapper.selectTMeasureRecordList(tMeasureRecord);
    }

    /**
     * 新增测厚记录
     *
     * @param tMeasureRecord 测厚记录
     * @return 结果
     */
    @Override
    public int insertTMeasureRecord(TMeasureRecord tMeasureRecord)
    {
        return tMeasureRecordMapper.insertTMeasureRecord(tMeasureRecord);
    }

    /**
     * 修改测厚记录
     *
     * @param tMeasureRecord 测厚记录
     * @return 结果
     */
    @Override
    public int updateTMeasureRecord(TMeasureRecord tMeasureRecord)
    {
        return tMeasureRecordMapper.updateTMeasureRecord(tMeasureRecord);
    }

    /**
     * 批量删除测厚记录
     *
     * @param ids 需要删除的测厚记录ID
     * @return 结果
     */
    @Override
    public int deleteTMeasureRecordByIds(Long[] ids)
    {
        return tMeasureRecordMapper.deleteTMeasureRecordByIds(ids);
    }

    /**
     * 删除测厚记录信息
     *
     * @param id 测厚记录ID
     * @return 结果
     */
    @Override
    public int deleteTMeasureRecordById(Long id)
    {
        return tMeasureRecordMapper.deleteTMeasureRecordById(id);
    }

    @Override
    public List<TMeasureRecord> queryRecords(String measureId) {
        return this.list(new QueryWrapper<TMeasureRecord>().eq(!StringUtils.isEmpty(measureId),"MEASURE_ID", measureId).eq("del_flag", 0) .orderByDesc("MEASURE_DATE"));
    }

    @Override
    public void deleteTMeasureRecordByDate(TMeasureRecord t) {
        tMeasureRecordMapper.deleteTMeasureRecordByDate(t);
    }
}
