com.wuyu.module.hunter.service.impl.RecruitServiceImpl Maven / Gradle / Ivy
package com.wuyu.module.hunter.service.impl;
import java.util.Collection;
import java.util.List;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.github.dennisit.vplus.data.enums.common.EnableEnum;
import com.github.dennisit.vplus.data.page.Pagination;
import com.github.dennisit.vplus.data.utils.PaginationUtils;
import com.google.common.collect.Lists;
import com.wuyu.module.hunter.entity.Recruit;
import com.wuyu.module.hunter.mapper.RecruitMapper;
import com.wuyu.module.hunter.service.IRecruitService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
@Service
public class RecruitServiceImpl extends ServiceImpl implements IRecruitService {
@Override
public List enable(Collection ids) {
List list = this.selectBatchIds(ids);
if(CollectionUtils.isNotEmpty(list)){
list.stream().forEach(x -> x.setEnabled(EnableEnum.ENABLED.getValue()));
this.updateBatchById(list);
}
return Lists.newArrayList(ids);
}
@Override
public List disable(Collection ids) {
List list = this.selectBatchIds(ids);
if(CollectionUtils.isNotEmpty(list)){
list.stream().forEach(x -> x.setEnabled(EnableEnum.DISABLE.getValue()));
this.updateBatchById(list);
}
return Lists.newArrayList(ids);
}
@Override
public Pagination selectPagination(Page page, Wrapper wrapper) {
return PaginationUtils.builder(selectPage(page, wrapper));
}
@Override
public List selectList(Page page, Wrapper wrapper) {
return PaginationUtils.items(selectPage(page, wrapper));
}
}