package com.ruoyi.award.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.award.mapper.CPatentAwardMapper;
import com.ruoyi.award.domain.CPatentAward;
import com.ruoyi.award.service.ICPatentAwardService;

/**
 * 中国专利奖Service业务层处理
 *
 * @author ruoyi
 * @date 2023-04-28
 */
@Service
public class CPatentAwardServiceImpl extends ServiceImpl<CPatentAwardMapper, CPatentAward> implements ICPatentAwardService {

    /**
     * 查询中国专利奖列表
     *
     * @param cPatentAward 中国专利奖
     * @return 中国专利奖集合
     * @date 2023-04-28
     */
    @Override
    public List<CPatentAward> queryList(CPatentAward cPatentAward) {
        QueryWrapper<CPatentAward> queryWrapper = Wrappers.query();
                if (  StringUtils.isNotNull(cPatentAward.getPatType())){
                    queryWrapper.eq("pat_type", cPatentAward.getPatType());
                }
                if (  StringUtils.isNotNull(cPatentAward.getPatNum())){
                    queryWrapper.eq("pat_num", cPatentAward.getPatNum());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getPatCountry())  ){
                    queryWrapper.eq("pat_country", cPatentAward.getPatCountry());
                }
                if (  StringUtils.isNotNull(cPatentAward.getSesNum())){
                    queryWrapper.eq("ses_num", cPatentAward.getSesNum());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getAwardYear())  ){
                    queryWrapper.eq("award_year", cPatentAward.getAwardYear());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getAwardName())  ){
                    queryWrapper.like("award_name", cPatentAward.getAwardName());
                }
                if (  StringUtils.isNotNull(cPatentAward.getAwardType())){
                    queryWrapper.eq("award_type", cPatentAward.getAwardType());
                }
                if (  StringUtils.isNotNull(cPatentAward.getAnncDate())){
                    queryWrapper.eq("annc_date", cPatentAward.getAnncDate());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getPatTitle())  ){
                    queryWrapper.eq("pat_title", cPatentAward.getPatTitle());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getPatIntro())  ){
                    queryWrapper.eq("pat_intro", cPatentAward.getPatIntro());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getReference())  ){
                    queryWrapper.eq("reference", cPatentAward.getReference());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getSource())  ){
                    queryWrapper.eq("source", cPatentAward.getSource());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getTimeCreate())  ){
                    queryWrapper.eq("time_create", cPatentAward.getTimeCreate());
                }
                if ( StringUtils.isNotEmpty(cPatentAward.getTimeUpdate())  ){
                    queryWrapper.eq("time_update", cPatentAward.getTimeUpdate());
                }
                if (  StringUtils.isNotNull(cPatentAward.getStatus())){
                    queryWrapper.eq("status", cPatentAward.getStatus());
                }
                if (  StringUtils.isNotNull(cPatentAward.getSysFileId())){
                    queryWrapper.eq("sys_file_id", cPatentAward.getSysFileId());
                }
        queryWrapper.orderByDesc("id");
        return this.list(queryWrapper);
    }
}
