|
@@ -95,7 +95,7 @@ public class UserController extends ControllerSupport {
|
|
public PageInfo<FullUserInfo> getAllUser(@PathVariable Integer curPage,
|
|
public PageInfo<FullUserInfo> getAllUser(@PathVariable Integer curPage,
|
|
@PathVariable Integer pageSize, @RequestParam Long rootOrgId,
|
|
@PathVariable Integer pageSize, @RequestParam Long rootOrgId,
|
|
@RequestParam String loginName, @RequestParam String name, @RequestParam String enable,
|
|
@RequestParam String loginName, @RequestParam String name, @RequestParam String enable,
|
|
- @RequestParam Long roleId, @RequestParam String type) {
|
|
|
|
|
|
+ @RequestParam(required = false) Long roleId, @RequestParam String type) {
|
|
|
|
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
if ((!isSuperAdmin()) && (!rootOrgId.equals(accessUser.getRootOrgId()))) {
|
|
if ((!isSuperAdmin()) && (!rootOrgId.equals(accessUser.getRootOrgId()))) {
|
|
@@ -110,21 +110,28 @@ public class UserController extends ControllerSupport {
|
|
throw new StatusException("B-150004", "机构错误");
|
|
throw new StatusException("B-150004", "机构错误");
|
|
}
|
|
}
|
|
|
|
|
|
- RoleEntity roleEntity = roleRepo.findOne(roleId);
|
|
|
|
- if (null == roleEntity) {
|
|
|
|
- throw new StatusException("B-150002", "角色不存在");
|
|
|
|
|
|
+ String roleCode = null;
|
|
|
|
+ if (null != roleId) {
|
|
|
|
+ RoleEntity roleEntity = roleRepo.findOne(roleId);
|
|
|
|
+ if (null == roleEntity) {
|
|
|
|
+ throw new StatusException("B-150002", "角色不存在");
|
|
|
|
+ }
|
|
|
|
+ roleCode = roleEntity.getCode();
|
|
}
|
|
}
|
|
|
|
|
|
- String roleCode = roleEntity.getCode();
|
|
|
|
-
|
|
|
|
Pageable pageable = new PageRequest(curPage - 1, pageSize, Sort.Direction.DESC,
|
|
Pageable pageable = new PageRequest(curPage - 1, pageSize, Sort.Direction.DESC,
|
|
- "updateTime");
|
|
|
|
|
|
+ "update_time");
|
|
|
|
+
|
|
|
|
+ loginName = toSqlSearchPattern(loginName);
|
|
|
|
+ name = toSqlSearchPattern(name);
|
|
|
|
|
|
- loginName = "%" + loginName.trim() + "%";
|
|
|
|
- name = "%" + name.trim() + "%";
|
|
|
|
|
|
+ Page<UserEntity> userList = null;
|
|
|
|
+ if (null == roleCode) {
|
|
|
|
+ userList = userRepo.findAll(rootOrgId, name, loginName, type, pageable);
|
|
|
|
+ } else {
|
|
|
|
+ userList = userRepo.findAll(rootOrgId, name, loginName, type, roleCode, pageable);
|
|
|
|
+ }
|
|
|
|
|
|
- Page<UserEntity> userList = userRepo.findAll(rootOrgId, name, loginName, type, roleCode,
|
|
|
|
- pageable);
|
|
|
|
Iterator<UserEntity> iterator = userList.iterator();
|
|
Iterator<UserEntity> iterator = userList.iterator();
|
|
|
|
|
|
List<FullUserInfo> fullUserInfoList = Lists.newArrayList();
|
|
List<FullUserInfo> fullUserInfoList = Lists.newArrayList();
|
|
@@ -135,6 +142,8 @@ public class UserController extends ControllerSupport {
|
|
bean.setLoginName(next.getLoginName());
|
|
bean.setLoginName(next.getLoginName());
|
|
bean.setName(next.getName());
|
|
bean.setName(next.getName());
|
|
bean.setRootOrgId(next.getRootOrgId());
|
|
bean.setRootOrgId(next.getRootOrgId());
|
|
|
|
+ bean.setUpdateTime(next.getUpdateTime());
|
|
|
|
+ bean.setCreationTime(next.getCreationTime());
|
|
bean.setOrgId(next.getOrgId());
|
|
bean.setOrgId(next.getOrgId());
|
|
if (null != bean.getOrgId()) {
|
|
if (null != bean.getOrgId()) {
|
|
Org org = orgRepo.findOne(Long.valueOf(bean.getOrgId()));
|
|
Org org = orgRepo.findOne(Long.valueOf(bean.getOrgId()));
|