package com.qmth.paper.library.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qmth.paper.library.common.bean.dto.SchoolDto;
import com.qmth.paper.library.common.entity.BasicSchool;
import com.qmth.paper.library.common.mapper.BasicSchoolMapper;
import com.qmth.paper.library.common.service.BasicSchoolService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 学校表 服务实现类
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
@Service
public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, BasicSchool> implements BasicSchoolService {

    @Override
    public List<SchoolDto> listSchool() {
        return this.baseMapper.listSchool();
    }

    @Override
    public BasicSchool getBySchoolCode(String schoolCode) {
        QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
        basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, schoolCode);
        return this.getOne(basicSchoolQueryWrapper);
    }
}
