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

com.quhaodian.activity.data.service.impl.ActivityServiceImpl Maven / Gradle / Ivy

There is a newer version: 3.3.18-20230117
Show newest version
package com.quhaodian.activity.data.service.impl;

import com.quhaodian.activity.data.dao.ActivityDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.quhaodian.data.core.Updater;
import com.quhaodian.activity.data.entity.Activity;
import com.quhaodian.activity.data.service.ActivityService;

import com.quhaodian.data.page.Filter;
import com.quhaodian.data.page.Order;
import com.quhaodian.data.page.Page;
import com.quhaodian.data.page.Pageable;
import java.util.List;

import com.quhaodian.data.utils.FilterUtils;
import org.springframework.context.annotation.Scope;


/**
* Created by imake on 2017年08月15日09:57:56.
*/


@Scope("prototype")
@Service
@Transactional
public class ActivityServiceImpl implements ActivityService {

	private ActivityDao dao;


	@Override
	@Transactional(readOnly = true)
	public Activity findById(Long id) {
		return dao.findById(id);
	}


	@Override
    @Transactional
	public Activity save(Activity bean) {
		dao.save(bean);
		return bean;
	}

	@Override
    @Transactional
	public Activity update(Activity bean) {
		Updater updater = new Updater(bean);
		return dao.updateByUpdater(updater);
	}

	@Override
    @Transactional
	public Activity deleteById(Long id) {
		Activity bean = dao.findById(id);
        dao.deleteById(id);
		return bean;
	}

	@Override
    @Transactional	
	public Activity[] deleteByIds(Long[] ids) {
		Activity[] beans = new Activity[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}


	@Autowired
	public void setDao(ActivityDao dao) {
		this.dao = dao;
	}

	@Override
    public Page page(Pageable pageable){
         return dao.page(pageable);
    }


    @Override
	public Page page(Pageable pageable, Object search) {
		List filters=	FilterUtils.getFilters(search);
		if (filters!=null) {
			pageable.getFilters().addAll(filters);
		}
		return dao.page(pageable);
	}

    @Override
    public List list(int first, Integer size, List filters, List orders) {
        return dao.list(first,size,filters,orders);}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy