package com.steerinfo.ems.tcm0348.service.impl;

import com.steerinfo.ems.Utils.DateUtils;
import com.steerinfo.ems.tcm0348.mapper.TCm0348Mapper;
import com.steerinfo.ems.tcm0348.model.TCm0348;
import com.steerinfo.ems.tcm0348.service.ITCm0348Service;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.model.ICreatePO;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.framework.service.pagehelper.PageHelper;
import com.steerinfo.framework.service.pagehelper.PageList;
import com.steerinfo.framework.utils.misc.IdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

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

    @Autowired
    IdGenerator idGenerator;
    @Autowired
    private TCm0348Mapper tCm0348Mapper;

    @Override
    protected IBaseMapper<TCm0348, String> getMapper() {
        return tCm0348Mapper;
    }

    public String deleteprevious(Map<String, Object> parameters) {
        tCm0348Mapper.deleteprevious(parameters);
        String time = tCm0348Mapper.checkmaxdate(parameters.get("planid").toString()) == null ? null : DateUtils.changeTime(tCm0348Mapper.checkmaxdate(parameters.get("planid").toString()), 1);
        return time;
    }

    public PageList<TCm0348> dataQuery(Map<String, Object> parameters, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<TCm0348> rows = tCm0348Mapper.dataQuery(parameters);
        PageList pageInfo = new PageList(rows);
        return pageInfo;
    }

    public PageList<TCm0348> qualityassessment(Map<String, Object> parameters, Integer pageNum, Integer pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<TCm0348> rows = tCm0348Mapper.qualityassessment(parameters);
        PageList pageInfo = new PageList(rows);
        return pageInfo;
    }

    public PageList<TCm0348> datacomparison(Map<String, Object> parameters, Integer pageNum, Integer pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<TCm0348> rows = tCm0348Mapper.datacomparison(parameters);
        PageList pageInfo = new PageList(rows);
        return pageInfo;
    }
}
