package com.ruoyi.cai.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cai.domain.Union;
import com.ruoyi.cai.dto.admin.vo.UnionAdminVo;
import com.ruoyi.cai.mapper.UnionMapper;
import com.ruoyi.cai.service.UnionService;
import com.ruoyi.common.core.domain.PageQuery;
import org.springframework.stereotype.Service;

/**
 * 工会列表Service业务层处理
 *
 * @author 77
 * @date 2023-12-22
 */
@Service
public class UnionServiceImpl extends ServiceImpl<UnionMapper, Union> implements UnionService {

    @Override
    public Page<UnionAdminVo> pageAdmin(PageQuery pageQuery, UnionAdminVo bo) {
        return baseMapper.pageAdmin(pageQuery.build(),bo);
    }

    @Override
    public Union getByUserId(Long userId) {
        return this.getOne(Wrappers.lambdaQuery(Union.class).eq(Union::getUserId,userId).last("limit 1"));
    }
}
