package com.ruoyi.reportpub.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
        import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.reportpub.mapper.RzgNationalRankingInfoMapper;
import com.ruoyi.reportpub.domain.RzgNationalRankingInfo;
import com.ruoyi.reportpub.service.IRzgNationalRankingInfoService;

/**
 * 专利公开-全国排名Service业务层处理
 *
 * @author ruoyi
 * @date 2023-03-27
 */
@Service
public class RzgNationalRankingInfoServiceImpl extends ServiceImpl<RzgNationalRankingInfoMapper, RzgNationalRankingInfo> implements IRzgNationalRankingInfoService {

    /**
     * 查询专利公开-全国排名列表
     *
     * @param rzgNationalRankingInfo 专利公开-全国排名
     * @return 专利公开-全国排名集合
     * @date 2023-03-27
     */
    @Override
    public List<RzgNationalRankingInfo> queryList(RzgNationalRankingInfo rzgNationalRankingInfo) {
        QueryWrapper<RzgNationalRankingInfo> queryWrapper = Wrappers.query();
                if (  StringUtils.isNotNull(rzgNationalRankingInfo.getCityCode())){
                    queryWrapper.eq("city_code", rzgNationalRankingInfo.getCityCode());
                }
                if ( StringUtils.isNotEmpty(rzgNationalRankingInfo.getCityName())  ){
                    queryWrapper.like("city_name", rzgNationalRankingInfo.getCityName());
                }
                if ( StringUtils.isNotEmpty(rzgNationalRankingInfo.getYear())  ){
                    queryWrapper.eq("year", rzgNationalRankingInfo.getYear());
                }
                if ( StringUtils.isNotEmpty(rzgNationalRankingInfo.getMonth())  ){
                    queryWrapper.eq("month", rzgNationalRankingInfo.getMonth());
                }
                if ( StringUtils.isNotEmpty(rzgNationalRankingInfo.getInventionPatentsUmber())  ){
                    queryWrapper.eq("invention_patents_umber", rzgNationalRankingInfo.getInventionPatentsUmber());
                }
                if (  StringUtils.isNotNull(rzgNationalRankingInfo.getStatus())){
                    queryWrapper.eq("status", rzgNationalRankingInfo.getStatus());
                }
        queryWrapper.orderByDesc("id");
        return this.list(queryWrapper);
    }
}
