com.quhaodian.notice.data.service.impl.UserNotificationNumServiceImpl Maven / Gradle / Ivy
package com.quhaodian.notice.data.service.impl;
import com.quhaodian.data.core.Updater;
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 com.quhaodian.data.utils.FilterUtils;
import com.quhaodian.notice.data.dao.UserNotificationNumDao;
import com.quhaodian.notice.data.entity.UserNotificationNum;
import com.quhaodian.notice.data.service.UserNotificationNumService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Created by imake on 2018年01月02日11:12:13.
*/
@Scope("prototype")
@Service
@Transactional
public class UserNotificationNumServiceImpl implements UserNotificationNumService {
private UserNotificationNumDao dao;
@Override
@Transactional(readOnly = true)
public UserNotificationNum findById(Long id) {
return dao.findById(id);
}
@Override
@Transactional
public UserNotificationNum save(UserNotificationNum bean) {
dao.save(bean);
return bean;
}
@Override
@Transactional
public UserNotificationNum update(UserNotificationNum bean) {
Updater updater = new Updater(bean);
return dao.updateByUpdater(updater);
}
@Override
@Transactional
public UserNotificationNum deleteById(Long id) {
UserNotificationNum bean = dao.findById(id);
dao.deleteById(id);
return bean;
}
@Override
@Transactional
public UserNotificationNum[] deleteByIds(Long[] ids) {
UserNotificationNum[] beans = new UserNotificationNum[ids.length];
for (int i = 0, len = ids.length; i < len; i++) {
beans[i] = deleteById(ids[i]);
}
return beans;
}
@Autowired
public void setDao(UserNotificationNumDao 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);
}
}