|
@@ -9,10 +9,12 @@ import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.apache.shiro.subject.Subject;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.aspect.annotation.PermissionData;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.constant.SymbolConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.IpUtils;
|
|
|
import org.jeecg.common.util.Md5Util;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.config.JeecgBaseConfig;
|
|
@@ -95,27 +97,16 @@ public class SysPermissionController {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- //@RequiresPermissions("system:permission:list")
|
|
|
- @RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
+ @RequiresPermissions("system:permission:list")
|
|
|
+ @RequestMapping(value = "/sqlList", method = RequestMethod.GET)
|
|
|
+ @PermissionData
|
|
|
public Result<List<SysPermissionTree>> list(SysPermission sysPermission, HttpServletRequest req) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
Result<List<SysPermissionTree>> result = new Result<>();
|
|
|
try {
|
|
|
-// LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>();
|
|
|
-// query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
|
|
|
-// query.orderByAsc(SysPermission::getSortNo);
|
|
|
-//
|
|
|
-// //支持通过菜单名字,模糊查询
|
|
|
-// if(oConvertUtils.isNotEmpty(sysPermission.getName())){
|
|
|
-// query.like(SysPermission::getName, sysPermission.getName());
|
|
|
-// }
|
|
|
-// //通过应用id条件查询
|
|
|
-// if(oConvertUtils.isNotEmpty(sysPermission.getAppId())){
|
|
|
-// query.eq(SysPermission::getAppId, sysPermission.getAppId());
|
|
|
-// }
|
|
|
-// List<SysPermission> list = sysPermissionService.list(query);
|
|
|
sysPermission.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
- List<SysPermission> list = sysPermissionService.listAndAppName(sysPermission);
|
|
|
+// List<SysPermission> list = sysPermissionService.listAndAppName(sysPermission);
|
|
|
+ List<SysPermission> list = sysPermissionService.listAndAppNameWithPermission(sysPermission);
|
|
|
List<SysPermissionTree> treeList = new ArrayList<>();
|
|
|
|
|
|
//如果有菜单名查询条件,则平铺数据 不做上下级
|
|
@@ -149,17 +140,13 @@ public class SysPermissionController {
|
|
|
sysPermission.setAppId(appId);
|
|
|
sysPermission.setBusiness(business);
|
|
|
sysPermission.setPermission(permission);
|
|
|
- System.out.println(type);
|
|
|
- System.out.println(sysPermission);
|
|
|
|
|
|
try{
|
|
|
List<SysPermissionReportVO> list = new ArrayList<>();
|
|
|
if("role".equals(type)){
|
|
|
list = sysPermissionService.reportRole(sysPermission);
|
|
|
- System.out.println(list);
|
|
|
}else {
|
|
|
list = sysPermissionService.reportUser(sysPermission);
|
|
|
- System.out.println(list);
|
|
|
}
|
|
|
|
|
|
result.setResult(list);
|
|
@@ -816,7 +803,12 @@ public class SysPermissionController {
|
|
|
.eq(SysUserPermission::getUserId,userId);
|
|
|
SysUserPermission sysUserPermission = sysUserPermissionService.getOne(query);
|
|
|
if(sysUserPermission ==null) {
|
|
|
- return Result.error("请先保存用户菜单权限!");
|
|
|
+ String permission= sysUserPermissionService.getOneByUserId(userId, permissionId);
|
|
|
+ if (permission == null){
|
|
|
+ return Result.error("请先保存用户菜单权限!");
|
|
|
+ }
|
|
|
+ SysUserPermission newUserPermission = new SysUserPermission(userId, permissionId).setDataRuleIds(dataRuleIds).setOperateDate(new Date());
|
|
|
+ sysUserPermissionService.save(newUserPermission);
|
|
|
}else {
|
|
|
sysUserPermission.setDataRuleIds(dataRuleIds);
|
|
|
this.sysUserPermissionService.updateById(sysUserPermission);
|