|
|
|
@@ -15,8 +15,10 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.simple.common.ResultData; |
|
|
|
import com.simple.domain.po.MallRole; |
|
|
|
import com.simple.domain.po.MallRolePermission; |
|
|
|
import com.simple.domain.po.MallUserInfo; |
|
|
|
import com.simple.domain.po.MallUserRole; |
|
|
|
import com.simple.service.MallRolePermissionService; |
|
|
|
import com.simple.service.MallRoleService; |
|
|
|
import com.simple.service.MallUserInfoService; |
|
|
|
import com.simple.service.MallUserRoleService; |
|
|
|
@@ -43,6 +45,11 @@ public class MallUserInfoController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
MallRoleService mallRoleService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
MallUserRoleService mallUserRoleService; |
|
|
|
@Autowired |
|
|
|
MallRolePermissionService mallRolePermissionService; |
|
|
|
|
|
|
|
@ApiOperation(value = "用户分页接口", response = String.class) |
|
|
|
@GetMapping("lists") |
|
|
|
@@ -181,6 +188,26 @@ public class MallUserInfoController { |
|
|
|
@GetMapping("getUser") |
|
|
|
public ResultData getUserInfo(){ |
|
|
|
MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); |
|
|
|
info.setPassword("保密"); |
|
|
|
// System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); |
|
|
|
MallUserRole ur = new MallUserRole(); |
|
|
|
ur.setUid(info.getId()); |
|
|
|
PageInfo<MallUserRole> page = mallUserRoleService.listAsPage(ur, 1, 1); |
|
|
|
if(page.getSize()>0) { |
|
|
|
Long roleId = page.getList().get(0).getRoleId(); |
|
|
|
MallRolePermission p = new MallRolePermission(); |
|
|
|
p.setRoleId(roleId); |
|
|
|
p.setTenantId(info.getTenantId()); |
|
|
|
PageInfo<MallRolePermission> listAsPage = mallRolePermissionService.listAsPage(p, 1, 100); |
|
|
|
String menus = ""; |
|
|
|
for(MallRolePermission rp :listAsPage.getList()) { |
|
|
|
menus+=rp.getPermissionId()+","; |
|
|
|
} |
|
|
|
if(menus.length()>0) { |
|
|
|
menus = menus.substring(0, menus.length()-1); |
|
|
|
} |
|
|
|
info.setMenus(menus); |
|
|
|
} |
|
|
|
ResultData data = new ResultData(); |
|
|
|
data.data=info; |
|
|
|
return data; |
|
|
|
|