package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.bu3;

import cn.estsh.i3plus.ext.mes.api.busi.bu3.ISxRepairRecordExtService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesRepairRecordExt;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesRepairRecordExtRepository;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesRepairRecord;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class SxRepairRecordExtService implements ISxRepairRecordExtService {

    @Autowired
    private MesRepairRecordExtRepository repairRecordExtRepository;

    @Override
    public List<MesRepairRecordExt> queryRepairRecordExtListByCreateDatetime(MesRepairRecord repairRecord) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean(repairRecord.getOrganizeCode());
        DdlPreparedPack.timeBuilder(repairRecord.getCreateDateTimeStart(), repairRecord.getCreateDateTimeEnd(), MesExtConstWords.CREATE_DATE_TIME, packBean, true);
        return repairRecordExtRepository.findByHqlWhere(packBean);
    }
}
