package com.sys.service;

import com.cku.core.BaseDAOMapper;
import com.cku.core.BaseService;
import com.cku.core.PageBeanResult;
import com.cku.util.PageBean;
import com.sys.dao.SysUserMapper;
import com.sys.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by user on 2016/5/20.
 */
@Service("sysUserServiceImpl")
public class SysUserServiceImpl extends BaseService<SysUser>{
    @Autowired
    private SysUserMapper sysUserMapper;
    @Override
    protected BaseDAOMapper<SysUser> getDAO() {
        return this.sysUserMapper;
    }
    public List<SysUser> selectByUserName(String userName){
        return sysUserMapper.selectByUserName(userName);
    }

    public PageBeanResult<SysUser> selectAll(String userName , PageBean pageBean){
        PageBeanResult<SysUser> result = new PageBeanResult<SysUser>();
        List<SysUser> list = sysUserMapper.selectAll(userName, pageBean.get_limit(),pageBean.get_start());
        result.setList(list);
        result.setTotalCount(sysUserMapper.selectCount(userName));
        return result;
    }
}
