package com.sw.mes.grade.service.impl;


import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.core.utils.StringUtils;
import com.sw.mes.grade.dao.RuleTestDataDao;
import com.sw.mes.grade.entity.RuleTestData;
import com.sw.mes.grade.service.RuleTestDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;


/**
* @Author
* @Description：
* @Date: Create in
* @Modified By:
*/
@Service
@Transactional
public class RuleTestDataServiceImpl extends BaseServiceImpl<RuleTestData> implements RuleTestDataService {
    RuleTestDataDao dao;
	@Autowired
    public void setDao(RuleTestDataDao dao) {
        super.setBaseDao(dao);
        this.dao=dao;
    }

    @Override
    public Page<Map<String, Object>> listByPageV2(String version, String startDate, String endDate, String grade, String sectionNo, Integer status, Pageable pageable) {
        if (StringUtils.isBlank(version)) {
            version = null;
        }
        if (StringUtils.isBlank(startDate)) {
            startDate = null;
        }
        if (StringUtils.isBlank(endDate)) {
            endDate = null;
        }
        if (StringUtils.isBlank(sectionNo)) {
            sectionNo = "";
        }
        if (StringUtils.isBlank(grade)) {
            grade = "";
        }
        return dao.listByPageV2(version, startDate, endDate, '%' + grade + '%', '%' + sectionNo + '%', status, pageable);
    }
}
