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.CgbScoreDetailMapper;
import com.ruoyi.cgb.domain.CgbScoreDetail;
import com.ruoyi.cgb.service.ICgbScoreDetailService;

/**
 * 评分明细Service业务层处理
 *
 * @author ruoyi
 * @date 2023-08-16
 */
@Service
public class CgbScoreDetailServiceImpl extends ServiceImpl<CgbScoreDetailMapper, CgbScoreDetail> implements ICgbScoreDetailService {

    /**
     * 查询评分明细列表
     *
     * @param cgbScoreDetail 评分明细
     * @return 评分明细集合
     * @date 2023-08-16
     */
    @Override
    public List<CgbScoreDetail> queryList(CgbScoreDetail cgbScoreDetail) {
        QueryWrapper<CgbScoreDetail> queryWrapper = Wrappers.query();
                if (  StringUtils.isNotNull(cgbScoreDetail.getSessionId())){
                    queryWrapper.eq("session_id", cgbScoreDetail.getSessionId());
                }
                if ( StringUtils.isNotEmpty(cgbScoreDetail.getWorksGroup())  ){
                    queryWrapper.eq("works_group", cgbScoreDetail.getWorksGroup());
                }
                if ( StringUtils.isNotEmpty(cgbScoreDetail.getCommentId())  ){
                    queryWrapper.eq("comment_id", cgbScoreDetail.getCommentId());
                }
                if (  StringUtils.isNotNull(cgbScoreDetail.getScore1())){
                    queryWrapper.eq("score1", cgbScoreDetail.getScore1());
                }
                if (  StringUtils.isNotNull(cgbScoreDetail.getScore2())){
                    queryWrapper.eq("score2", cgbScoreDetail.getScore2());
                }
                if (  StringUtils.isNotNull(cgbScoreDetail.getScore3())){
                    queryWrapper.eq("score3", cgbScoreDetail.getScore3());
                }
                if (  StringUtils.isNotNull(cgbScoreDetail.getScore4())){
                    queryWrapper.eq("score4", cgbScoreDetail.getScore4());
                }
                if ( StringUtils.isNotEmpty(cgbScoreDetail.getStatus())  ){
                    queryWrapper.eq("status", cgbScoreDetail.getStatus());
                }
        queryWrapper.orderByDesc("id");
        return this.list(queryWrapper);
    }
}
