package com.steerinfo.appservice.appcmmcarweightresults.service.impl;

import com.steerinfo.appservice.appmeterworkcaractual.model.AppMeterWorkCarActual;
import com.steerinfo.appservice.dto.AppMeterWorkCarActualDemo;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.appservice.appcmmcarweightresults.model.AppCmmCarweightresults;
import com.steerinfo.appservice.appcmmcarweightresults.mapper.AppCmmCarweightresultsMapper;
import com.steerinfo.appservice.appcmmcarweightresults.service.IAppCmmCarweightresultsService;
import com.steerinfo.framework.service.pagehelper.PageHelper;
import com.steerinfo.framework.service.pagehelper.PageList;
import com.steerinfo.meterwork.except.MarkerMetException;
import com.steerinfo.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * AppCmmCarweightresults服务实现：
 *
 * @author generator
 * @version 1.0-SNAPSHORT 2021-11-05 11:06
 * 类描述
 * 修订历史：
 * 日期：2021-11-05
 * 作者：generator
 * 参考：
 * 描述：AppCmmCarweightresults服务实现
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 * @see null
 */
@Service(value = "appCmmCarweightresultsService")
public class AppCmmCarweightresultsServiceImpl extends BaseServiceImpl<AppCmmCarweightresults, String> implements IAppCmmCarweightresultsService {

    @Autowired
    private AppCmmCarweightresultsMapper appCmmCarweightresultsMapper;

    @Override
    protected IBaseMapper<AppCmmCarweightresults, String> getMapper() {
        return appCmmCarweightresultsMapper;
    }

    /**
     * params
     *
     * @param params
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageList<AppCmmCarweightresults> selectNetByCarOld(HashMap params, Integer pageNum, Integer pageSize) {
        //是否删除：0=有效，1=无效，2=删除
        params.put("delFlg", "0");
        if (params.get("startTime") == null) {
            throw new MarkerMetException(500, "开始时间不允许为空！！");
        }
        if (params.get("endTime") == null) {
            throw new MarkerMetException(500, "结束时间不允许为空！！");
        }
        PageHelper.startPage(pageNum, pageSize);
        List<AppCmmCarweightresults> list = appCmmCarweightresultsMapper.selectByParameters(params);
        PageList pageInfo = new PageList(list);
        return pageInfo;
    }

    /**
     * 车辆管理-计量实绩-分类查询汇总（旧系统）
     *
     * @param params
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageList<AppCmmCarweightresults> selectSumForAppByCarOld(HashMap params, Integer pageNum, Integer pageSize) {
        //是否删除：0=有效，1=无效，2=删除
        params.put("delFlg", "0");
        if (params.get("startTime") == null) {
            throw new MarkerMetException(500, "开始时间不允许为空！！");
        }
        if (params.get("endTime") == null) {
            throw new MarkerMetException(500, "结束时间不允许为空！！");
        }
        PageHelper.startPage(pageNum, pageSize);
        List<AppCmmCarweightresults> list = appCmmCarweightresultsMapper.selectSumForAppByCarOld(params);
        PageList pageInfo = new PageList(list);
        return pageInfo;
    }

}
