com.quhaodian.web.data.service.impl.WebConfigServiceImpl Maven / Gradle / Ivy
package com.quhaodian.web.data.service.impl;
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.web.data.dao.WebConfigDao;
import com.quhaodian.web.data.entity.WebConfig;
import com.quhaodian.web.data.service.WebConfigService;
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月30日09:46:28.
*/
@Scope("prototype")
@Service
@Transactional
public class WebConfigServiceImpl implements WebConfigService {
private WebConfigDao dao;
@Override
@Transactional(readOnly = true)
public WebConfig findById(Long id) {
return dao.findById(id);
}
@Override
@Transactional
public WebConfig save(WebConfig bean) {
dao.save(bean);
return bean;
}
@Override
@Transactional
public WebConfig update(WebConfig bean) {
Updater updater = new Updater(bean);
return dao.updateByUpdater(updater);
}
@Override
@Transactional
public WebConfig deleteById(Long id) {
WebConfig bean = dao.findById(id);
dao.deleteById(id);
return bean;
}
@Override
@Transactional
public WebConfig[] deleteByIds(Long[] ids) {
WebConfig[] beans = new WebConfig[ids.length];
for (int i = 0,len = ids.length; i < len; i++) {
beans[i] = deleteById(ids[i]);
}
return beans;
}
@Autowired
public void setDao(WebConfigDao 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);}
}