All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wuyu.module.hunter.service.impl.FirmServiceImpl 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.Firm;
import com.wuyu.module.hunter.mapper.FirmMapper;
import com.wuyu.module.hunter.service.IFirmService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;


@Service
public class FirmServiceImpl extends ServiceImpl implements IFirmService {

    @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));
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy