Bläddra i källkod

还原分页方式

tags/v2.5.3
xiaoying 11 månader sedan
förälder
incheckning
48eaf1c2d0
3 ändrade filer med 13 tillägg och 9 borttagningar
  1. +1
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/TenantMapper.java
  2. +11
    -6
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java
  3. +1
    -1
      tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml

+ 1
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/TenantMapper.java Visa fil

@@ -1,7 +1,6 @@
package com.tuoheng.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.model.dto.OidcTenantDto;
import com.tuoheng.model.dto.TTenant;
import com.tuoheng.model.po.TenantPo;
@@ -25,7 +24,7 @@ public interface TenantMapper {

TTenant getByCode(@Param("code") String code);

Page<TenantVo> findListByPage(@Param("page") IPage page, @Param("query") TenantQuery query);
List<TenantVo> findList(@Param("query") TenantQuery query);

void updateById(TenantPo tenantPo);


+ 11
- 6
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java Visa fil

@@ -331,10 +331,8 @@ public class TenantServiceImpl implements TenantService {
//分页参数校验
query.checkParam();
//开启分页
// 设置分页参数
IPage<TenantVo> pageDate = new Page<>(query.getPage(), query.getLimit());
IPage<TenantVo> tenantVos = tenantMapper.findListByPage(pageDate,query);
List<TenantVo> collect = tenantVos.getRecords().stream().map(x -> {
List<TenantVo> tenantVos = tenantMapper.findList(query);
List<TenantVo> collect = tenantVos.stream().map(x -> {
TenantVo vo = new TenantVo();
BeanUtils.copyProperties(x, vo);
//并不是真正意义上的租户id
@@ -385,8 +383,15 @@ public class TenantServiceImpl implements TenantService {
vo.setList(businessSystemVoList);
return vo;
}).filter(x -> x != null).collect(Collectors.toList());
pageDate.setRecords(collect);
return JsonResult.success(pageDate);
//粗暴的分页
Integer pageNum = query.getPage();
Integer pageSize = query.getLimit();
int startIndex = (pageNum - 1) * pageSize;
int endIndex = Math.min(startIndex + pageSize, collect.size());
List<TenantVo> subList = collect.subList(startIndex, endIndex);
IPage<TenantVo> page = new Page<>(pageNum, pageSize);
page.setTotal(collect.size());
return JsonResult.success(page.setRecords(subList));
}

/**

+ 1
- 1
tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml Visa fil

@@ -42,7 +42,7 @@
where code = #{code}
and enabled = 1
</select>
<select id="findListByPage" resultType="com.tuoheng.model.vo.TenantVo">
<select id="findList" resultType="com.tuoheng.model.vo.TenantVo">
SELECT t.id, t.user_id userId, t.remark, t.code tenantCode,
t.name tenantName,t.customer,t.customer_phone
,t.province_code,t.province_name,t.city_code,t.city_name,t.district_code,t.district_name,u.username

Laddar…
Avbryt
Spara