com.macro.mall.model.UmsAdmin Java Examples
The following examples show how to use
com.macro.mall.model.UmsAdmin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UmsAdminController.java From mall-swarm with Apache License 2.0 | 7 votes |
@ApiOperation(value = "获取当前登录用户信息") @RequestMapping(value = "/info", method = RequestMethod.GET) @ResponseBody public CommonResult getAdminInfo(Principal principal) { if(principal==null){ return CommonResult.unauthorized(null); } String username = principal.getName(); UmsAdmin umsAdmin = adminService.getAdminByUsername(username); Map<String, Object> data = new HashMap<>(); data.put("username", umsAdmin.getUsername()); data.put("roles", new String[]{"TEST"}); data.put("menus", roleService.getMenuList(umsAdmin.getId())); data.put("icon", umsAdmin.getIcon()); return CommonResult.success(data); }
Example #2
Source File: SecurityConfig.java From macrozheng-mall with MIT License | 6 votes |
@Bean public UserDetailsService userDetailsService() { //获取登录用户信息 return new UserDetailsService() { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { UmsAdminExample example = new UmsAdminExample(); example.createCriteria().andUsernameEqualTo(username); List<UmsAdmin> umsAdminList = umsAdminMapper.selectByExample(example); if (umsAdminList != null && umsAdminList.size() > 0) { return new AdminUserDetails(umsAdminList.get(0)); } throw new UsernameNotFoundException("用户名或密码错误"); } }; }
Example #3
Source File: SecurityConfig.java From mall with Apache License 2.0 | 6 votes |
@Bean public UserDetailsService userDetailsService() { //获取登录用户信息 return new UserDetailsService() { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { UmsAdminExample example = new UmsAdminExample(); example.createCriteria().andUsernameEqualTo(username); List<UmsAdmin> umsAdminList = umsAdminMapper.selectByExample(example); if (umsAdminList != null && umsAdminList.size() > 0) { return new AdminUserDetails(umsAdminList.get(0)); } throw new UsernameNotFoundException("用户名或密码错误"); } }; }
Example #4
Source File: UmsAdminController.java From mall with Apache License 2.0 | 6 votes |
@ApiOperation(value = "获取当前登录用户信息") @RequestMapping(value = "/info", method = RequestMethod.GET) @ResponseBody public CommonResult getAdminInfo(Principal principal) { if(principal==null){ return CommonResult.unauthorized(null); } String username = principal.getName(); UmsAdmin umsAdmin = adminService.getAdminByUsername(username); Map<String, Object> data = new HashMap<>(); data.put("username", umsAdmin.getUsername()); data.put("roles", new String[]{"TEST"}); data.put("menus", roleService.getMenuList(umsAdmin.getId())); data.put("icon", umsAdmin.getIcon()); return CommonResult.success(data); }
Example #5
Source File: SecurityConfig.java From macrozheng with Apache License 2.0 | 6 votes |
@Bean public UserDetailsService userDetailsService() { //获取登录用户信息 return new UserDetailsService() { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { UmsAdminExample example = new UmsAdminExample(); example.createCriteria().andUsernameEqualTo(username); List<UmsAdmin> umsAdminList = umsAdminMapper.selectByExample(example); if (umsAdminList != null && umsAdminList.size() > 0) { return new AdminUserDetails(umsAdminList.get(0)); } throw new UsernameNotFoundException("用户名或密码错误"); } }; }
Example #6
Source File: SecurityConfig.java From macrozheng with Apache License 2.0 | 5 votes |
@Bean public UserDetailsService userDetailsService() { //获取登录用户信息 return username -> { UmsAdmin admin = adminService.getAdminByUsername(username); if (admin != null) { List<UmsPermission> permissionList = adminService.getPermissionList(admin.getId()); return new AdminUserDetails(admin,permissionList); } throw new UsernameNotFoundException("用户名或密码错误"); }; }
Example #7
Source File: UmsAdminController.java From mall-swarm with Apache License 2.0 | 5 votes |
@ApiOperation("修改帐号状态") @RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST) @ResponseBody public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) { UmsAdmin umsAdmin = new UmsAdmin(); umsAdmin.setStatus(status); int count = adminService.update(id,umsAdmin); if (count > 0) { return CommonResult.success(count); } return CommonResult.failed(); }
Example #8
Source File: UmsAdminController.java From mall-swarm with Apache License 2.0 | 5 votes |
@ApiOperation("修改指定用户信息") @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) @ResponseBody public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) { int count = adminService.update(id, admin); if (count > 0) { return CommonResult.success(count); } return CommonResult.failed(); }
Example #9
Source File: UmsAdminController.java From mall-swarm with Apache License 2.0 | 5 votes |
@ApiOperation("获取指定用户信息") @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public CommonResult<UmsAdmin> getItem(@PathVariable Long id) { UmsAdmin admin = adminService.getItem(id); return CommonResult.success(admin); }
Example #10
Source File: UmsAdminController.java From mall-swarm with Apache License 2.0 | 5 votes |
@ApiOperation("根据用户名或姓名分页获取用户列表") @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { List<UmsAdmin> adminList = adminService.list(keyword, pageSize, pageNum); return CommonResult.success(CommonPage.restPage(adminList)); }
Example #11
Source File: UmsAdminController.java From mall-swarm with Apache License 2.0 | 5 votes |
@ApiOperation(value = "用户注册") @RequestMapping(value = "/register", method = RequestMethod.POST) @ResponseBody public CommonResult<UmsAdmin> register(@RequestBody UmsAdminParam umsAdminParam, BindingResult result) { UmsAdmin umsAdmin = adminService.register(umsAdminParam); if (umsAdmin == null) { CommonResult.failed(); } return CommonResult.success(umsAdmin); }
Example #12
Source File: UmsAdminCacheServiceImpl.java From mall with Apache License 2.0 | 5 votes |
@Override public void delAdmin(Long adminId) { UmsAdmin admin = adminService.getItem(adminId); if (admin != null) { String key = REDIS_DATABASE + ":" + REDIS_KEY_ADMIN + ":" + admin.getUsername(); redisService.del(key); } }
Example #13
Source File: UmsAdminController.java From mall with Apache License 2.0 | 5 votes |
@ApiOperation("修改帐号状态") @RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST) @ResponseBody public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) { UmsAdmin umsAdmin = new UmsAdmin(); umsAdmin.setStatus(status); int count = adminService.update(id,umsAdmin); if (count > 0) { return CommonResult.success(count); } return CommonResult.failed(); }
Example #14
Source File: UmsAdminController.java From macrozheng-mall with MIT License | 5 votes |
@ApiOperation("获取指定用户信息") @RequestMapping(value = "/update/{id}",method = RequestMethod.POST) @ResponseBody public Object update(@PathVariable Long id,@RequestBody UmsAdmin admin){ int count = adminService.update(id,admin); if(count>0){ return new CommonResult().success(count); } return new CommonResult().failed(); }
Example #15
Source File: SecurityConfig.java From macrozheng-mall with MIT License | 5 votes |
@Bean public UserDetailsService userDetailsService() { //获取登录用户信息 return username -> { UmsAdmin admin = adminService.getAdminByUsername(username); if (admin != null) { List<UmsPermission> permissionList = adminService.getPermissionList(admin.getId()); return new AdminUserDetails(admin,permissionList); } throw new UsernameNotFoundException("用户名或密码错误"); }; }
Example #16
Source File: UmsAdminController.java From mall with Apache License 2.0 | 5 votes |
@ApiOperation("修改指定用户信息") @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) @ResponseBody public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) { int count = adminService.update(id, admin); if (count > 0) { return CommonResult.success(count); } return CommonResult.failed(); }
Example #17
Source File: UmsAdminController.java From mall with Apache License 2.0 | 5 votes |
@ApiOperation("根据用户名或姓名分页获取用户列表") @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { List<UmsAdmin> adminList = adminService.list(keyword, pageSize, pageNum); return CommonResult.success(CommonPage.restPage(adminList)); }
Example #18
Source File: UmsAdminController.java From macrozheng-mall with MIT License | 5 votes |
@ApiOperation("根据用户名或姓名分页获取用户列表") @RequestMapping(value = "/list",method = RequestMethod.GET) @ResponseBody public Object list(@RequestParam(value = "name",required = false) String name, @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){ List<UmsAdmin> adminList = adminService.list(name,pageSize,pageNum); return new CommonResult().pageSuccess(adminList); }
Example #19
Source File: UmsAdminController.java From macrozheng with Apache License 2.0 | 5 votes |
@ApiOperation(value = "获取当前登录用户信息") @RequestMapping(value = "/info", method = RequestMethod.GET) @ResponseBody public CommonResult getAdminInfo(Principal principal) { String username = principal.getName(); UmsAdmin umsAdmin = adminService.getAdminByUsername(username); Map<String, Object> data = new HashMap<>(); data.put("username", umsAdmin.getUsername()); data.put("roles", new String[]{"TEST"}); data.put("icon", umsAdmin.getIcon()); return CommonResult.success(data); }
Example #20
Source File: UmsAdminController.java From macrozheng with Apache License 2.0 | 5 votes |
@ApiOperation("根据用户名或姓名分页获取用户列表") @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "name", required = false) String name, @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { List<UmsAdmin> adminList = adminService.list(name, pageSize, pageNum); return CommonResult.success(CommonPage.restPage(adminList)); }
Example #21
Source File: UmsAdminController.java From macrozheng-mall with MIT License | 5 votes |
@ApiOperation("获取指定用户信息") @RequestMapping(value = "/{id}",method = RequestMethod.GET) @ResponseBody public Object getItem(@PathVariable Long id){ UmsAdmin admin = adminService.getItem(id); return new CommonResult().success(admin); }
Example #22
Source File: UmsAdminController.java From mall with Apache License 2.0 | 5 votes |
@ApiOperation(value = "用户注册") @RequestMapping(value = "/register", method = RequestMethod.POST) @ResponseBody public CommonResult<UmsAdmin> register(@RequestBody UmsAdminParam umsAdminParam, BindingResult result) { UmsAdmin umsAdmin = adminService.register(umsAdminParam); if (umsAdmin == null) { CommonResult.failed(); } return CommonResult.success(umsAdmin); }
Example #23
Source File: UmsAdminController.java From macrozheng-mall with MIT License | 5 votes |
@ApiOperation(value = "用户注册") @RequestMapping(value = "/register", method = RequestMethod.POST) @ResponseBody public Object register(@RequestBody UmsAdminParam umsAdminParam, BindingResult result) { UmsAdmin umsAdmin = adminService.register(umsAdminParam); if (umsAdmin == null) { new CommonResult().failed(); } return new CommonResult().success(umsAdmin); }
Example #24
Source File: AdminUserDetails.java From mall-swarm with Apache License 2.0 | 4 votes |
public AdminUserDetails(UmsAdmin umsAdmin,List<UmsResource> resourceList) { this.umsAdmin = umsAdmin; this.resourceList = resourceList; }
Example #25
Source File: UmsAdminCacheServiceImpl.java From mall with Apache License 2.0 | 4 votes |
@Override public UmsAdmin getAdmin(String username) { String key = REDIS_DATABASE + ":" + REDIS_KEY_ADMIN + ":" + username; return (UmsAdmin) redisService.get(key); }
Example #26
Source File: AdminUserDetails.java From macrozheng with Apache License 2.0 | 4 votes |
public AdminUserDetails(UmsAdmin umsAdmin,List<UmsPermission> permissionList) { this.umsAdmin = umsAdmin; this.permissionList = permissionList; }
Example #27
Source File: AdminUserDetails.java From mall with Apache License 2.0 | 4 votes |
public AdminUserDetails(UmsAdmin umsAdmin) { this.umsAdmin = umsAdmin; }
Example #28
Source File: AdminUserDetails.java From macrozheng with Apache License 2.0 | 4 votes |
public AdminUserDetails(UmsAdmin umsAdmin) { this.umsAdmin = umsAdmin; }
Example #29
Source File: AdminUserDetails.java From macrozheng-mall with MIT License | 4 votes |
public AdminUserDetails(UmsAdmin umsAdmin) { this.umsAdmin = umsAdmin; }
Example #30
Source File: AdminUserDetails.java From mall with Apache License 2.0 | 4 votes |
public AdminUserDetails(UmsAdmin umsAdmin,List<UmsResource> resourceList) { this.umsAdmin = umsAdmin; this.resourceList = resourceList; }