Commit 786001e8 authored by Administrator's avatar Administrator

user

parent d30db6af
...@@ -19,7 +19,7 @@ public abstract class AbstractController { ...@@ -19,7 +19,7 @@ public abstract class AbstractController {
//return (UserEntity) SecurityUtils.getSubject().getPrincipal(); //return (UserEntity) SecurityUtils.getSubject().getPrincipal();
UserEntity ue = new UserEntity(); UserEntity ue = new UserEntity();
ue.setDeptId(1L); ue.setDeptId(1L);
return null; return ue;
} }
protected Long getUserId() { protected Long getUserId() {
......
...@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.govmade.common.utils.Constant; import com.govmade.common.utils.Constant;
import com.govmade.common.utils.PageUtils; import com.govmade.common.utils.PageUtils;
...@@ -52,10 +53,10 @@ public class UserController extends AbstractController { ...@@ -52,10 +53,10 @@ public class UserController extends AbstractController {
* 用户列表 * 用户列表
*/ */
@GetMapping("/list") @GetMapping("/list")
public R list(Map<String, Object> params) { public R list(@RequestParam Map<String, Object> params) {
// 只有超级管理员,才能查看所有用户列表 // 只有超级管理员,才能查看所有用户列表
if (getUserId() != Constant.SUPER_ADMIN) { if (getUserId() == Constant.SUPER_ADMIN) {
params.put("createBy", getUserId()); params.put("createBy", getUserId());
} else { } else {
params.put("deptId", getUser().getDeptId()); // 部门管理员,查看本部门用户列表 params.put("deptId", getUser().getDeptId()); // 部门管理员,查看本部门用户列表
......
...@@ -30,9 +30,10 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements ...@@ -30,9 +30,10 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
// TODO Auto-generated method stub // TODO Auto-generated method stub
String username = (String) params.get("username"); String username = (String) params.get("username");
Long createBy = (Long) params.get("createBy"); Long createBy = (Long) params.get("createBy");
Long deptId = (Long) params.get("deptId");
Page<UserEntity> page = this.selectPage(new Query<UserEntity>(params).getPage(), new EntityWrapper<UserEntity>() Page<UserEntity> page = this.selectPage(new Query<UserEntity>(params).getPage(), new EntityWrapper<UserEntity>()
.eq(StrUtil.isNotBlank(username), "username", username).eq(createBy != null, "create_by", createBy)); .eq(StrUtil.isNotBlank(username), "username", username).eq(deptId != null, "dept_id", deptId).eq(createBy != null, "create_by", createBy));
return new PageUtils(page); return new PageUtils(page);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment