コード例 #1
0
 @Override
 public AdminUser loadUserByUsername(String username) {
   AdminUserCriteria criteria = new AdminUserCriteria();
   criteria.createCriteria().andUsernameEqualTo(username);
   List<AdminUser> adminUserList = adminUserMapper.selectByExample(criteria);
   return adminUserList != null && adminUserList.size() == 1 ? adminUserList.get(0) : null;
 }
コード例 #2
0
  @Override
  public int changeUserPassword(int userId, String encryptNewPassword) {
    AdminUser adminUser = new AdminUser();
    adminUser.setPassword(encryptNewPassword);

    AdminUserCriteria criteria = new AdminUserCriteria();
    criteria.createCriteria().andIdEqualTo(userId);
    return adminUserMapper.updateByExampleSelective(adminUser, criteria);
  }
コード例 #3
0
  @Override
  public PagingResult<AdminUser> pagingByCriteria(
      int pageNo, int pageSize, AdminUserCriteria criteria) {
    pageNo = pageNo <= 0 ? 1 : pageNo; // 确保pageNo合法
    pageSize = pageNo <= 0 ? 20 : pageSize; // 确保pageSize合法
    int offset = (pageNo - 1) * pageSize;

    // 构造查询条件
    if (criteria == null) {
      criteria = new AdminUserCriteria();
    }

    criteria.setLimitOffset(offset);
    criteria.setLimitRows(pageSize);

    int count = adminUserMapper.countByExample(criteria);
    List<AdminUser> dataList = adminUserMapper.selectByExample(criteria);
    // 返回分页数据
    return new PagingResult<AdminUser>(pageNo, pageSize, count, dataList);
  }
コード例 #4
0
 @Override
 public int countByCriteria(AdminUserCriteria criteria) {
   return adminUserMapper.countByExample(criteria);
 }
コード例 #5
0
 @Override
 public List<AdminUser> queryByCriteria(AdminUserCriteria criteria) {
   return adminUserMapper.selectByExample(criteria);
 }
コード例 #6
0
 @Override
 public List<AdminUser> queryAll(String orderByClause) {
   AdminUserCriteria criteria = new AdminUserCriteria();
   criteria.setOrderByClause(orderByClause);
   return adminUserMapper.selectByExample(criteria);
 }
コード例 #7
0
 @Override
 public List<AdminUser> queryAll() {
   return adminUserMapper.selectByExample(null);
 }
コード例 #8
0
 @Override
 public AdminUser loadById(Integer id) {
   return adminUserMapper.selectByPrimaryKey(id);
 }
コード例 #9
0
 @Override
 public int deleteById(Integer id) {
   return adminUserMapper.deleteByPrimaryKey(id);
 }
コード例 #10
0
 @Override
 public int updateByCriteria(AdminUser t, AdminUserCriteria criteria) {
   return adminUserMapper.updateByExampleSelective(t, criteria);
 }
コード例 #11
0
 @Override
 public int updateById(AdminUser adminUser) {
   return adminUserMapper.updateByPrimaryKeySelective(adminUser);
 }
コード例 #12
0
 @Override
 public int save(AdminUser adminUser) {
   return adminUserMapper.insert(adminUser);
 }