com.baomidou
mybatisplus-spring-boot-starter
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/controller/DictController.java b/pig-admin-service/src/main/java/com/github/pig/admin/controller/DictController.java
index 8fe78217..613c79ba 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/controller/DictController.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/controller/DictController.java
@@ -6,15 +6,14 @@ import com.baomidou.mybatisplus.plugins.Page;
import com.github.pig.admin.entity.SysDict;
import com.github.pig.admin.service.SysDictService;
import com.github.pig.common.constant.CommonConstant;
+import com.github.pig.common.util.Query;
import com.github.pig.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
-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;
+import org.springframework.web.bind.annotation.*;
import java.util.List;
+import java.util.Map;
/**
*
@@ -44,17 +43,13 @@ public class DictController extends BaseController {
/**
* 分页查询字典信息
*
- * @param page 分页对象
- * @param limit 每页限制
+ * @param params 分页对象
* @return 分页对象
*/
@RequestMapping("/dictPage")
- public Page dictPage(Integer page, Integer limit) {
- SysDict condition = new SysDict();
- condition.setDelFlag(CommonConstant.STATUS_NORMAL);
- EntityWrapper wrapper = new EntityWrapper(condition);
- wrapper.orderBy("createTime", false);
- return sysDictService.selectPage(new Page<>(page, limit), wrapper);
+ public Page dictPage(@RequestParam Map params) {
+ params.put(CommonConstant.DEL_FLAG, CommonConstant.STATUS_NORMAL);
+ return sysDictService.selectPage(new Query<>(params),new EntityWrapper<>());
}
/**
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/controller/LogController.java b/pig-admin-service/src/main/java/com/github/pig/admin/controller/LogController.java
index c1743337..6547e8d3 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/controller/LogController.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/controller/LogController.java
@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.plugins.Page;
import com.github.pig.admin.service.SysLogService;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.entity.SysLog;
+import com.github.pig.common.util.Query;
import com.github.pig.common.util.UserUtils;
import com.github.pig.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
+import java.util.Map;
/**
*
@@ -36,17 +38,13 @@ public class LogController extends BaseController {
/**
* 分页查询日志信息
*
- * @param page 分页对象
- * @param limit 每页限制
+ * @param params 分页对象
* @return 分页对象
*/
@RequestMapping("/logPage")
- public Page logPage(Integer page, Integer limit) {
- SysLog condition = new SysLog();
- condition.setDelFlag(CommonConstant.STATUS_NORMAL);
- EntityWrapper wrapper = new EntityWrapper(condition);
- wrapper.orderBy("createTime", false);
- return sysLogService.selectPage(new Page<>(page, limit), wrapper);
+ public Page logPage(@RequestParam Map params) {
+ params.put(CommonConstant.DEL_FLAG, CommonConstant.STATUS_NORMAL);
+ return sysLogService.selectPage(new Query<>(params),new EntityWrapper<>());
}
/**
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/controller/RoleController.java b/pig-admin-service/src/main/java/com/github/pig/admin/controller/RoleController.java
index 593b11cb..a56dab02 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/controller/RoleController.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/controller/RoleController.java
@@ -7,6 +7,7 @@ import com.github.pig.admin.entity.SysRoleMenu;
import com.github.pig.admin.service.SysRoleMenuService;
import com.github.pig.admin.service.SysRoleService;
import com.github.pig.common.constant.CommonConstant;
+import com.github.pig.common.util.Query;
import com.github.pig.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author lengleng
@@ -85,15 +87,13 @@ public class RoleController extends BaseController {
/**
* 分页查询角色信息
*
- * @param page 分页对象
- * @param limit 每页限制
+ * @param params 分页对象
* @return 分页对象
*/
@RequestMapping("/rolePage")
- public Page rolePage(Integer page, Integer limit) {
- SysRole condition = new SysRole();
- condition.setDelFlag(CommonConstant.STATUS_NORMAL);
- return sysRoleService.selectPage(new Page<>(page, limit), new EntityWrapper<>(condition));
+ public Page rolePage(@RequestParam Map params) {
+ params.put(CommonConstant.DEL_FLAG, CommonConstant.STATUS_NORMAL);
+ return sysRoleService.selectPage(new Query<>(params),new EntityWrapper<>());
}
/**
@@ -104,7 +104,7 @@ public class RoleController extends BaseController {
* @return success、false
*/
@PutMapping("/roleMenuUpd")
- @CacheEvict(value = "menu_details",allEntries = true)
+ @CacheEvict(value = "menu_details", allEntries = true)
public Boolean roleMenuUpd(Integer roleId, @RequestParam("menuIds[]") Integer[] menuIds) {
SysRoleMenu condition = new SysRoleMenu();
condition.setRoleId(roleId);
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java b/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java
index 1a35c9b8..4e9465f3 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java
@@ -11,6 +11,7 @@ import com.github.pig.admin.service.SysMenuService;
import com.github.pig.admin.service.SysUserRoleService;
import com.github.pig.admin.service.UserService;
import com.github.pig.common.constant.CommonConstant;
+import com.github.pig.common.util.Query;
import com.github.pig.common.util.UserUtils;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.web.BaseController;
@@ -165,8 +166,8 @@ public class UserController extends BaseController {
* @return 用户集合
*/
@RequestMapping("/userPage")
- public Page userPage(Integer page, Integer limit, SysUser sysUser) {
- return userService.selectWithRolePage(new Page<>(page, limit), sysUser);
+ public Page userPage(@RequestParam Map params) {
+ return userService.selectWithRolePage(new Query(params));
}
/**
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserMapper.java b/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserMapper.java
index 022315d9..dcd9e9ef 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserMapper.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/mapper/SysUserMapper.java
@@ -1,11 +1,12 @@
package com.github.pig.admin.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
-import com.baomidou.mybatisplus.plugins.Page;
import com.github.pig.admin.entity.SysUser;
+import com.github.pig.common.util.Query;
import com.github.pig.common.vo.UserVo;
import java.util.List;
+import java.util.Map;
/**
*
@@ -27,9 +28,8 @@ public interface SysUserMapper extends BaseMapper {
/**
* 分页查询用户信息(含角色)
*
- * @param page
- * @param sysUser
+ * @param query 查询条件
* @return
*/
- List selectUserVoPage(Page page, SysUser sysUser);
+ List selectUserVoPage(Query query, Map params);
}
\ No newline at end of file
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/service/UserService.java b/pig-admin-service/src/main/java/com/github/pig/admin/service/UserService.java
index adf433f0..3e5e1ffc 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/service/UserService.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/service/UserService.java
@@ -3,6 +3,7 @@ package com.github.pig.admin.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.github.pig.admin.entity.SysUser;
+import com.github.pig.common.util.Query;
import com.github.pig.common.vo.UserVo;
/**
@@ -21,11 +22,10 @@ public interface UserService extends IService {
/**
* 分页查询用户信息(含有角色信息)
*
- * @param page 分页对象
- * @param sysUser 查询条件
+ * @param query 查询条件
* @return
*/
- Page selectWithRolePage(Page page, SysUser sysUser);
+ Page selectWithRolePage(Query query);
/**
* 清除用户缓存
diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/UserServiceImpl.java b/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/UserServiceImpl.java
index b1f69807..bb49b224 100644
--- a/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/UserServiceImpl.java
+++ b/pig-admin-service/src/main/java/com/github/pig/admin/service/impl/UserServiceImpl.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pig.admin.entity.SysUser;
import com.github.pig.admin.mapper.SysUserMapper;
import com.github.pig.admin.service.UserService;
+import com.github.pig.common.util.Query;
import com.github.pig.common.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
@@ -27,9 +28,9 @@ public class UserServiceImpl extends ServiceImpl impleme
}
@Override
- public Page selectWithRolePage(Page page, SysUser sysUser) {
- page.setRecords(sysUserMapper.selectUserVoPage(page, sysUser));
- return page;
+ public Page selectWithRolePage(Query query) {
+ query.setRecords(sysUserMapper.selectUserVoPage(query,query.getCondition()));
+ return query;
}
@Override
diff --git a/pig-common/pom.xml b/pig-common/pom.xml
index dfb12713..7ccbd172 100644
--- a/pig-common/pom.xml
+++ b/pig-common/pom.xml
@@ -56,6 +56,12 @@
jasypt-spring-boot-starter
1.16
+
+