package com.gyee.runeconomy.service.auto.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyee.common.model.StringUtils;
import com.gyee.runeconomy.mapper.auto.ProBasicFeasibilityStudyMapper;
import com.gyee.runeconomy.model.auto.ProBasicFeasibilityStudy;
import com.gyee.runeconomy.model.auto.ProBasicProjectPlan;
import com.gyee.runeconomy.service.auto.IProBasicFeasibilityStudyService;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.List;

/**
 * <p>
 * 可研电量表 服务实现类
 * </p>
 *
 * @author wang
 * @since 2023-10-18
 */
@Service
public class ProBasicFeasibilityStudyServiceImpl extends ServiceImpl<ProBasicFeasibilityStudyMapper, ProBasicFeasibilityStudy> implements IProBasicFeasibilityStudyService {

    @Override
    public List<ProBasicFeasibilityStudy> getmonthList(String month) {
        QueryWrapper<ProBasicFeasibilityStudy> qw = new QueryWrapper<>();
        Calendar cal = Calendar.getInstance();
        int currentyear = cal.get(Calendar.YEAR);
        if (StringUtils.isNotEmpty(month)) {
            qw.eq("month", month);
            qw.like("year", currentyear);
        }
        List<ProBasicFeasibilityStudy> list = baseMapper.selectList(qw);
        return list;
    }

    public List<ProBasicFeasibilityStudy> getmonthList1(String month, int currentyear) {
        QueryWrapper<ProBasicFeasibilityStudy> qw = new QueryWrapper<>();
        Calendar cal = Calendar.getInstance();
        if (StringUtils.isNotEmpty(month)) {
            qw.eq("month", month);
            qw.like("year", currentyear);
        }
        List<ProBasicFeasibilityStudy> list = baseMapper.selectList(qw);
        return list;
    }

    @Override
    public List<ProBasicFeasibilityStudy> getList(String year) {
        QueryWrapper<ProBasicFeasibilityStudy> qw = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(year)) {
            qw.like("year", year);
        }
        List<ProBasicFeasibilityStudy> list = baseMapper.selectList(qw);
        return list;
    }
}
