package com.ruoyi.cgb.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.cgb.mapper.CgbWorksInfoMapper;
import com.ruoyi.cgb.domain.CgbWorksInfo;
import com.ruoyi.cgb.service.ICgbWorksInfoService;

/**
 * 作品Service业务层处理
 *
 * @author ruoyi
 * @date 2023-08-16
 */
@Service
public class CgbWorksInfoServiceImpl extends ServiceImpl<CgbWorksInfoMapper, CgbWorksInfo> implements ICgbWorksInfoService {

	
	/**
	 * 查询作品列表
	 *
	 * @param cgbWorksInfo 作品
	 * @return 作品集合
	 * @date 2023-08-16
	 */
	@Override
	public List<CgbWorksInfo> queryList(CgbWorksInfo cgbWorksInfo) {
		QueryWrapper<CgbWorksInfo> queryWrapper = Wrappers.query();
		if (StringUtils.isNotEmpty(cgbWorksInfo.getWorksGroup())) {
			queryWrapper.eq("works_group", cgbWorksInfo.getWorksGroup());
		}

		if (StringUtils.isNotEmpty(cgbWorksInfo.getWorksGroup())) {
			queryWrapper.eq("works_group", cgbWorksInfo.getWorksGroup());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getVideoNo())) {
			queryWrapper.eq("video_no", cgbWorksInfo.getVideoNo());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getApplySubject())) {
			queryWrapper.eq("apply_subject", cgbWorksInfo.getApplySubject());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getWorksName())) {
			queryWrapper.like("works_name", cgbWorksInfo.getWorksName());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getBranchName())) {
			queryWrapper.like("branch_name", cgbWorksInfo.getBranchName());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getVideoTime())) {
			queryWrapper.eq("video_time", cgbWorksInfo.getVideoTime());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getWorksType())) {
			queryWrapper.eq("works_type", cgbWorksInfo.getWorksType());
		}
		if (StringUtils.isNotEmpty(cgbWorksInfo.getStatus())) {
			queryWrapper.eq("status", cgbWorksInfo.getStatus());
		}
		
		queryWrapper.orderByDesc("id");
		return this.list(queryWrapper);
	}
}
