首页>代码>spring boot+mysql+mybatis+easyUI整合实现简单网站用户后台管理系统>/system/src/main/java/com/kyh/system/Impl/UserServiceImpl.java
package com.kyh.system.Impl;

import com.github.pagehelper.PageHelper;
import com.kyh.system.entity.User;
import com.kyh.system.mapper.UserMapper;
import com.kyh.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

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

    //注入调用数据库操作mapper
    @Autowired
    private UserMapper userMapper;// 出现编译报错 不影响 去掉方法   可以在settings里面的spring bean中设置一下
    /**
     * 添加用户
     * */
    @Override
    public int addUser(User user){
     return  userMapper.insertSelective(user);
    }
    /***
     * 分页查询
     * */
   @Override
    public List<User> findAllUser(int pageNum, int pageSize){
       PageHelper.startPage(pageNum, pageSize);
       return userMapper.selectAllUser();
   }
    /***
     * 通过id 删除用户
     *
     */
   @Override
    public int delete(int key){

       return  userMapper.deleteByPrimaryKey(key);
   }
    /***
     *
     * 修改用户
     */
   @Override
    public int update(User user){
       return userMapper.updateByPrimaryKeySelective(user);
   }

   /**
    * 用户登录
    * */
   public User getUserById(User user){

       return userMapper.selectselectByKeyAndPassword(user);
   };

    @Override
    public int getUsernumber(){
        return userMapper.getUsernumber();
    }

}
最近下载更多
SDASDASDAD  LV1 2023年10月16日
微信网友_6506630663868416  LV1 2023年6月6日
7346040  LV1 2022年11月18日
tanxin  LV3 2022年9月2日
123456789aweq  LV2 2022年7月21日
刘亦菲9527  LV15 2022年3月7日
9843637  LV9 2021年12月13日
Oxygeni  LV7 2021年12月1日
尹恒yingying  LV18 2021年10月23日
exfeckt  LV2 2021年7月15日
最近浏览更多
微信网友_7289626841501696  LV4 2024年12月24日
bluerstar  LV1 2024年10月23日
wwwww816  LV5 2024年5月22日
1941549176  LV4 2024年4月29日
微信网友_6927932988952576  LV12 2024年3月31日
skipple3  LV39 2024年1月22日
WHY-small  LV15 2023年12月20日
暂无贡献等级
fff2003  LV9 2023年11月18日
wnnmmb  LV2 2023年10月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友