package com.yeejoin.amos.boot.module.ugp.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProblemCodeLibDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProblemCodeLib;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProblemCodeLibMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IProblemCodeLibService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, ProblemCodeLib, ProblemCodeLibMapper> implements IProblemCodeLibService {

    @Resource
    private ProblemCodeLibMapper problemCodeLibMapper;

    public IPage<ProblemCodeLib> queryProblemCodeInfoPage(Page<ProblemCodeLib> page) {
        LambdaQueryWrapper<ProblemCodeLib> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ProblemCodeLib::getIsDelete, Boolean.FALSE);
        return problemCodeLibMapper.selectPage(page, lambdaQueryWrapper);
    }

    public List<ProblemCodeLib> queryProblemCodeInfoList() {
        LambdaQueryWrapper<ProblemCodeLib> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ProblemCodeLib::getIsDelete, Boolean.FALSE);
        return problemCodeLibMapper.selectList(lambdaQueryWrapper);
    }
}
