package com.limap.demo.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.limap.common.utils.StringUtils;
import com.limap.demo.mapper.DemoStudentMapper;
import com.limap.demo.domain.DemoStudent;
import com.limap.demo.service.IDemoStudentService;

/**
 * 单表演示Service业务层处理
 * 
 * @author metaee
 * @date 2023-02-28
 */
@Service
public class DemoStudentServiceImpl extends ServiceImpl<DemoStudentMapper, DemoStudent> implements IDemoStudentService {
    @Autowired
    private DemoStudentMapper demoStudentMapper;
    
    /**
     * 查询单表演示列表
     * 
     * @param demoStudent 单表演示
     * @return 单表演示
     */
    @Override
    public List<DemoStudent> selectDemoStudentList(DemoStudent demoStudent) {
    	LambdaQueryWrapper<DemoStudent> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotEmpty(demoStudent.getStudentName())) {
			queryWrapper.like(DemoStudent::getStudentName, demoStudent.getStudentName());
		}
        if (StringUtils.isNotEmpty(demoStudent.getStudentSex())) {
			queryWrapper.eq(DemoStudent::getStudentSex, demoStudent.getStudentSex());
		}
        if (StringUtils.isNotEmpty(demoStudent.getStatus())) {
			queryWrapper.eq(DemoStudent::getStatus, demoStudent.getStatus());
		}
        return demoStudentMapper.selectList(queryWrapper);
    }
}
