Browse Source

修正分页配置类

tags/v2.4.0
xiaoying 1 year ago
parent
commit
1f954a10ca
12 changed files with 81 additions and 17 deletions
  1. +2
    -2
      tuoheng_oidc_admin/pom.xml
  2. +36
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/config/MybatisPlusConfig.java
  3. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/constant/HhzUrlConstant.java
  4. +12
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/TenantController.java
  5. +2
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/TenantMapper.java
  6. +2
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientUserSevice.java
  7. +23
    -14
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java
  8. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/constant/HhzUrlConstant.class
  9. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/controller/TenantController.class
  10. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/TenantMapper.class
  11. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/service/ClientUserSevice.class
  12. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class

+ 2
- 2
tuoheng_oidc_admin/pom.xml View File

@@ -32,12 +32,12 @@
<scope>test</scope>
</dependency>

<!--mybatis-plus 起始依赖 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
<version>3.5.1</version>
</dependency>

<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>

+ 36
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/config/MybatisPlusConfig.java View File

@@ -0,0 +1,36 @@
package com.tuoheng.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusConfig {

/**
* 插件注册
*
* @param paginationInnerInterceptor 分页插件
* @return MybatisPlus拦截器
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(PaginationInnerInterceptor paginationInnerInterceptor) {
MybatisPlusInterceptor mp = new MybatisPlusInterceptor();
mp.addInnerInterceptor(paginationInnerInterceptor);
return mp;
}

//分页插件
@Bean
public PaginationInnerInterceptor paginationInnerInterceptor() {
PaginationInnerInterceptor pii = new PaginationInnerInterceptor();
pii.setMaxLimit(20L);
pii.setDbType(DbType.MYSQL);
//当超过最大页数时不会报错
pii.setOverflow(true);
return pii;
}

}

+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/constant/HhzUrlConstant.java View File

@@ -11,5 +11,9 @@ public class HhzUrlConstant {
* 创建租户
*/
public static String CREATE_TENANT = "/oidcTenant/add";
/**
* 编辑租户
*/
public static String UPDATE_TENANT = "/oidcTenant/edit";

}

+ 12
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/TenantController.java View File

@@ -49,4 +49,16 @@ public class TenantController {
return clientUserSevice.findTenants(query);
}

/**
* 更新业务租户信息及密码接口
* @param dto
* @param loginUser
* @return
*/
@PostMapping("/edit")
public JsonResult edit(@RequestBody OidcTenantDto dto,@CurrentUser LoginUser loginUser){
return clientUserSevice.editTenant(dto,loginUser);

}

}

+ 2
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/TenantMapper.java View File

@@ -23,5 +23,6 @@ public interface TenantMapper {

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

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

}

+ 2
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientUserSevice.java View File

@@ -35,4 +35,6 @@ public interface ClientUserSevice {

JsonResult findTenants(TenantQuery query);

JsonResult editTenant(OidcTenantDto dto, LoginUser loginUser);

}

+ 23
- 14
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java View File

@@ -1,5 +1,6 @@
package com.tuoheng.service.impl;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -255,14 +256,11 @@ public class ClientUserServiceImpl implements ClientUserSevice {
return JsonResult.error("分页参数不能为空");
}
//开启分页
PageHelper.startPage(query.getPage(),query.getLimit());
List<TenantPo> tenantList = tenantMapper.findList(query);
List<TenantVo> list = new ArrayList<>();
for (TenantPo tenantPo : tenantList) {
TenantVo vo = new TenantVo();
vo.setCode(tenantPo.getCode());
vo.setName(tenantPo.getName());
Long userId = tenantPo.getUserId();
IPage<TenantVo> page = new Page<>(query.getPage(), query.getLimit());
IPage<TenantPo> pageData = tenantMapper.findList(page,query);
pageData.convert(x -> {
TenantVo vo = Convert.convert(TenantVo.class, x);
Long userId = x.getUserId();
List<AuthoritiesPo> poList = authoritiesMapper.selectByUserId(userId);
UserPo userPo = clientUserMapper.selectByUserId(userId);
if (null != userPo) {
@@ -278,13 +276,24 @@ public class ClientUserServiceImpl implements ClientUserSevice {
businessSystemVoList.add(businessSystemVo);
}
vo.setList(businessSystemVoList);
list.add(vo);
}
PageInfo<TenantVo> tenantVoPageInfo = new PageInfo<>(list);
//添加总条数
tenantVoPageInfo.setTotal(list.size());
return vo;
});
return JsonResult.success(pageData);
}

/**
* 更新业务平台租户的相关基本信息
*
* @param dto
* @param loginUser
* @return
*/
@Override
public JsonResult editTenant(OidcTenantDto dto, LoginUser loginUser) {


return JsonResult.success(tenantVoPageInfo);
//TODO
return null;
}



BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/constant/HhzUrlConstant.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/controller/TenantController.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/TenantMapper.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/service/ClientUserSevice.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class View File


Loading…
Cancel
Save