审查视图

src/main/java/com/example/demo/service/imp/UserServiceImp.java 1.4 KB
朱兆平 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
package com.example.demo.service.imp;

import com.example.demo.mapper.UserMapper;
import com.example.demo.model.User;
import com.example.demo.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service(value = "userService")
public class UserServiceImp implements UserService{

    @Autowired
    private UserMapper userMapper;

   public int deleteByPrimaryKey(Integer userId){
        return userMapper.deleteByPrimaryKey(userId);
    }

    public int insert(User record){
        return userMapper.insert(record);
    }

    public int insertSelective(User record){
        return userMapper.insertSelective(record);
    }

    public User selectByPrimaryKey(Integer userId){
        return  userMapper.selectByPrimaryKey(userId);
    }

    public int updateByPrimaryKeySelective(User record){
        return userMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(User record){
        return userMapper.updateByPrimaryKey(record);
    }

    public PageInfo<User> findAllUser(int pageNum, int pageSize){
        PageHelper.startPage(pageNum,pageSize);
        List<User> users = userMapper.selectUsers();
        PageInfo<User> result = new PageInfo<User>(users);
        return result;

    }
}