增加简单搜索功能

This commit is contained in:
shuzheng 2017-03-28 22:20:33 +08:00
parent 4acbfd209a
commit 1fd7f66514
7 changed files with 33 additions and 1 deletions

View File

@ -48,6 +48,7 @@ public class UpmsLogController extends BaseController {
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsLogExample upmsLogExample = new UpmsLogExample();
@ -56,6 +57,10 @@ public class UpmsLogController extends BaseController {
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsLogExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsLogExample.or()
.andDescriptionLike("%" + search + "%");
}
List<UpmsLog> rows = upmsLogService.selectByExample(upmsLogExample);
long total = upmsLogService.countByExample(upmsLogExample);
Map<String, Object> result = new HashMap<>();

View File

@ -53,6 +53,7 @@ public class UpmsOrganizationController extends BaseController {
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsOrganizationExample upmsOrganizationExample = new UpmsOrganizationExample();
@ -61,6 +62,10 @@ public class UpmsOrganizationController extends BaseController {
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsOrganizationExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsOrganizationExample.or()
.andNameLike("%" + search + "%");
}
List<UpmsOrganization> rows = upmsOrganizationService.selectByExample(upmsOrganizationExample);
long total = upmsOrganizationService.countByExample(upmsOrganizationExample);
Map<String, Object> result = new HashMap<>();

View File

@ -60,6 +60,7 @@ public class UpmsPermissionController extends BaseController {
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, defaultValue = "0", value = "type") int type,
@RequestParam(required = false, defaultValue = "0", value = "systemId") int systemId,
@RequestParam(required = false, value = "sort") String sort,
@ -77,6 +78,10 @@ public class UpmsPermissionController extends BaseController {
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsPermissionExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsPermissionExample.or()
.andNameLike("%" + search + "%");
}
List<UpmsPermission> rows = upmsPermissionService.selectByExample(upmsPermissionExample);
long total = upmsPermissionService.countByExample(upmsPermissionExample);
Map<String, Object> result = new HashMap<>();

View File

@ -99,6 +99,7 @@ public class UpmsRoleController extends BaseController {
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsRoleExample upmsRoleExample = new UpmsRoleExample();
@ -107,6 +108,10 @@ public class UpmsRoleController extends BaseController {
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsRoleExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsRoleExample.or()
.andTitleLike("%" + search + "%");
}
List<UpmsRole> rows = upmsRoleService.selectByExample(upmsRoleExample);
long total = upmsRoleService.countByExample(upmsRoleExample);
Map<String, Object> result = new HashMap<>();

View File

@ -53,6 +53,7 @@ public class UpmsSystemController extends BaseController {
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsSystemExample upmsSystemExample = new UpmsSystemExample();
@ -61,6 +62,10 @@ public class UpmsSystemController extends BaseController {
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsSystemExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsSystemExample.or()
.andTitleLike("%" + search + "%");
}
List<UpmsSystem> rows = upmsSystemService.selectByExample(upmsSystemExample);
long total = upmsSystemService.countByExample(upmsSystemExample);
Map<String, Object> result = new HashMap<>();

View File

@ -156,6 +156,7 @@ public class UpmsUserController extends BaseController {
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsUserExample upmsUserExample = new UpmsUserExample();
@ -164,6 +165,12 @@ public class UpmsUserController extends BaseController {
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsUserExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsUserExample.or()
.andRealnameLike("%" + search + "%");
upmsUserExample.or()
.andUsernameLike("%" + search + "%");
}
List<UpmsUser> rows = upmsUserService.selectByExample(upmsUserExample);
long total = upmsUserService.countByExample(upmsUserExample);
Map<String, Object> result = new HashMap<>();

View File

@ -31,7 +31,7 @@ $(function() {
url: '${basePath}/manage/session/list',
height: getHeight(),
striped: true,
search: true,
search: false,
showRefresh: true,
showColumns: true,
minimumCountColumns: 2,