package com.ssm.service.impl.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.ssm.mapper.business.SmsRecordMapper;
import com.ssm.model.business.SmsRecord;
import com.ssm.service.business.SmsRecordService;
import com.ssm.util.page.BeanUtil;
import com.ssm.util.page.PagedResult;

@Service
public class SmsRecordServiceImpl implements SmsRecordService {

	@Autowired
	private SmsRecordMapper smsRecordMapper;

	@Override
	public int insertSelective(SmsRecord smsRecord) {
		
		return smsRecordMapper.insertSelective(smsRecord);
	}

	@Override
	public PagedResult<SmsRecord> selectSmsRecord(SmsRecord smsRecord,
			Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null ? 1 : pageNo;
		pageSize = pageSize == null ? 10 : pageSize;
		PageHelper.startPage(pageNo, pageSize);
		List<SmsRecord> list = smsRecordMapper.selectSmsRecord(smsRecord);
		PagedResult<SmsRecord> pageResult = BeanUtil.toPagedResult(list);
		return pageResult;
	}
}
