| | |
| | | package com.yckj.service; |
| | | |
| | | import com.yckj.mapper.UserMapper.UserMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yckj.mapper.UserMapper; |
| | | import com.yckj.pojo.User; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class UserService { |
| | | |
| | | @Resource |
| | |
| | | public boolean add(User user) { |
| | | return userMapper.insert(user)>0; |
| | | } |
| | | |
| | | public boolean addBatch(List<User> users) { |
| | | return userMapper.insertBatchSomeColumn(users)==users.size(); |
| | | } |
| | | |
| | | public User getById(int id) { |
| | | return userMapper.selectById(id); |
| | | } |
| | | |
| | | |
| | | |
| | | public List<User> getAll() { |
| | | List<User> users = userMapper.selectList(null); |
| | | return users; |
| | | } |
| | | |
| | | public IPage<User> getAllWithPage(Page page) { |
| | | return userMapper.selectPage(page, null); |
| | | } |
| | | |
| | | public boolean update(User user) { |
| | | return userMapper.updateById(user)>0; |
| | | } |
| | | |
| | | public boolean delete(int id) { |
| | | return userMapper.deleteById(id)>0; |
| | | } |
| | | } |