package com.ssm.service.impl.system;

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.system.SysPositionMapper;
import com.ssm.model.system.SysPosition;
import com.ssm.service.system.SysPositionService;
import com.ssm.util.page.BeanUtil;
import com.ssm.util.page.PagedResult;
@Service
public class SysPositionServiceImpl implements SysPositionService {

	@Autowired
	private SysPositionMapper sysPositionMapper;
	@Override
	public PagedResult<SysPosition> getPostionFind(SysPosition sysPosition,Integer pageNo,
			Integer pageSize) {
		// TODO Auto-generated method stub
		pageNo = pageNo == null?1:pageNo;  
	    pageSize = pageSize == null?10:pageSize;
	    PageHelper.startPage(pageNo,pageSize);  //startPage是告诉拦截器说我要开始分页了。分页参数是这两个。  
	    List<SysPosition> list = sysPositionMapper.getPostionFind(sysPosition);
		PagedResult<SysPosition> pagedResult = BeanUtil.toPagedResult(list);  
		return pagedResult;
	}
	
	/**
	 * 删除职位
	 * */
	@Override
	public void deleteSysPostion(Integer positionid) {
		// TODO Auto-generated method stub
		this.sysPositionMapper.deleteSysPostion(positionid);
	}

	@Override
	public Integer QuerySysPostionId(Integer depid) {
		// TODO Auto-generated method stub
		return sysPositionMapper.QuerySysPostionId(depid);
	}

	@Override
	public void insertSelective(SysPosition sysPosition) {
		// TODO Auto-generated method stub
		sysPositionMapper.insertSelective(sysPosition);
	}

	@Override
	public SysPosition selectByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return sysPositionMapper.selectByPrimaryKey(id);
	}

	@Override
	public void updateByPrimaryKeySelective(SysPosition sysPosition) {
		// TODO Auto-generated method stub
		sysPositionMapper.updateByPrimaryKeySelective(sysPosition);
	}

	@Override
	public List<SysPosition> selectAllPostion() {
		return sysPositionMapper.selectAllPostion();
	}

}
