package com.steerinfo.meterwork.meterworkpreprocess.service.impl;

import com.steerinfo.framework.controller.RESTfulResult;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.meterwork.meterworkpreprocess.model.MeterWorkPreProcess;
import com.steerinfo.meterwork.meterworkpreprocess.mapper.MeterWorkPreProcessMapper;
import com.steerinfo.meterwork.meterworkpreprocess.service.IMeterWorkPreProcessService;
import com.steerinfo.util.FieldsCollector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * MeterWorkPreProcess服务实现：
 * @author generator
 * @version 1.0-SNAPSHORT 2020-10-20 04:40
 * 类描述
 * 修订历史：
 * 日期：2020-10-20
 * 作者：generator
 * 参考：
 * 描述：MeterWorkPreProcess服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "meterWorkPreProcessService")
public class MeterWorkPreProcessServiceImpl extends BaseServiceImpl<MeterWorkPreProcess, String> implements IMeterWorkPreProcessService {

    @Resource
    private MeterWorkPreProcessMapper meterWorkPreProcessMapper;

    @Override
    protected IBaseMapper<MeterWorkPreProcess, String> getMapper() {
        return meterWorkPreProcessMapper;
    }

    @Override
    public RESTfulResult doQueryWf(MeterWorkPreProcess oci){
        RESTfulResult rm=new RESTfulResult();
        try{
            rm.setCode("200");
            Map<String,Object> map= FieldsCollector.beanToMap(oci);
            List<MeterWorkPreProcess> list = meterWorkPreProcessMapper.findWithCondition(map);
            rm.setData(list);
        }catch(Exception ex){
            rm.setCode("500");
            rm.setMessage("查询失败："+ex.getMessage());
        }
        return rm;
    }
}
