🚀 角色条件分页查询
This commit is contained in:
parent
6e8271a4db
commit
91c1c7612e
|
@ -73,3 +73,16 @@
|
|||
18:31:15:665 INFO 17940 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8800 (http) with context path ''
|
||||
18:31:15:722 INFO 17940 --- [main] com.atguigu.auth.ServiceAuthApplication : Started ServiceAuthApplication in 1.437 seconds (JVM running for 1.865)
|
||||
18:31:21:234 INFO 17940 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
|
||||
18:31:22:813 INFO 19156 --- [main] com.atguigu.auth.ServiceAuthApplication : Starting ServiceAuthApplication on bunny with PID 19156 (G:\java项目\guigu-oa-parent\service-oa\target\classes started by 13199 in G:\java项目\guigu-oa-parent)
|
||||
18:31:22:815 INFO 19156 --- [main] com.atguigu.auth.ServiceAuthApplication : The following profiles are active: dev
|
||||
18:31:23:234 WARN 19156 --- [main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.atguigu.*.mapper]' package. Please check your configuration.
|
||||
18:31:23:384 INFO 19156 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8800 (http)
|
||||
18:31:23:389 INFO 19156 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
|
||||
18:31:23:389 INFO 19156 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
|
||||
18:31:23:424 INFO 19156 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
|
||||
18:31:23:424 INFO 19156 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 586 ms
|
||||
18:31:23:601 INFO 19156 --- [main] com.atguigu.config.MybatisPlusConfig : 注入MybatisPlus配置类...
|
||||
18:31:23:635 INFO 19156 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
|
||||
18:31:24:030 INFO 19156 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8800 (http) with context path ''
|
||||
18:31:24:091 INFO 19156 --- [main] com.atguigu.auth.ServiceAuthApplication : Started ServiceAuthApplication in 1.485 seconds (JVM running for 1.914)
|
||||
18:39:42:950 INFO 19156 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
|
||||
|
|
|
@ -3,10 +3,13 @@ package com.atguigu.auth.controller;
|
|||
import com.atguigu.auth.service.SysRoleService;
|
||||
import com.atguigu.common.result.Result;
|
||||
import com.atguigu.model.system.SysRole;
|
||||
import com.atguigu.vo.system.SysRoleQueryVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
@ -25,4 +28,11 @@ public class SysRoleController {
|
|||
List<SysRole> sysRoleList = sysRoleService.list();
|
||||
return Result.success(sysRoleList);
|
||||
}
|
||||
|
||||
@ApiOperation("角色条件分页查询")
|
||||
@GetMapping("{page}/{limit}")
|
||||
public Result<IPage<SysRole>> pageResult(@PathVariable Long page, @PathVariable Long limit, SysRoleQueryVo sysRoleQueryVo) {
|
||||
IPage<SysRole> sysRoleIPage = sysRoleService.pageResult(page, limit, sysRoleQueryVo);
|
||||
return Result.success(sysRoleIPage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
package com.atguigu.auth.service;
|
||||
|
||||
import com.atguigu.model.system.SysRole;
|
||||
import com.atguigu.vo.system.SysRoleQueryVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface SysRoleService extends IService<SysRole> {
|
||||
/**
|
||||
* 角色条件分页查询
|
||||
*
|
||||
* @param page 当前页
|
||||
* @param limit 每页记录数
|
||||
* @param vo 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysRole> pageResult(Long page, Long limit, SysRoleQueryVo vo);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,32 @@ package com.atguigu.auth.service.impl;
|
|||
import com.atguigu.auth.mapper.SysRoleMapper;
|
||||
import com.atguigu.auth.service.SysRoleService;
|
||||
import com.atguigu.model.system.SysRole;
|
||||
import com.atguigu.vo.system.SysRoleQueryVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Service
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
|
||||
/**
|
||||
* 角色条件分页查询
|
||||
*
|
||||
* @param page 当前页
|
||||
* @param limit 每页记录数
|
||||
* @param vo 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysRole> pageResult(Long page, Long limit, SysRoleQueryVo vo) {
|
||||
Page<SysRole> pageParam = new Page<>(page, limit);
|
||||
|
||||
String roleName = vo.getRoleName();
|
||||
LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(!StringUtils.isEmpty(roleName), SysRole::getRoleName, roleName);
|
||||
|
||||
return page(pageParam, wrapper);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue