企标导入功能和角色管理资料中心新增时权限问题
This commit is contained in:
@@ -46,6 +46,8 @@ public class ZlTreeController extends BaseController<ZlTree> {
|
||||
public ResponseMessage addFileMaterial(@RequestBody ZlTree material){
|
||||
material.setId(String.valueOf(UUID.randomUUID()));
|
||||
boolean save = iZlTreeService.save(material);
|
||||
//新增后给所有角色配置权限
|
||||
iZlTreeService.setResource(material);
|
||||
return Result.success(save);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@ package com.adc.da.slrs.zlTree.dao;
|
||||
|
||||
import com.adc.da.slrs.zlTree.entity.ZlTree;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -16,4 +20,5 @@ public interface ZlTreeDao extends BaseMapper<ZlTree> {
|
||||
|
||||
|
||||
int topping(@Param("id") String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.slrs.zlTree.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.zlTree.entity.TreeData;
|
||||
import com.adc.da.slrs.zlTree.entity.ZlTree;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -54,4 +55,6 @@ public interface IZlTreeService extends IService<ZlTree> {
|
||||
ZlTree queryTree(String treeId);
|
||||
|
||||
void subordinateTreeNodes(List<String> treeIds,String parentTreeId);
|
||||
|
||||
void setResource(ZlTree material);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package com.adc.da.slrs.zlTree.service.impl;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
|
||||
import com.adc.da.slrs.sarRole.dao.TsRoleDao;
|
||||
import com.adc.da.slrs.sarRole.entity.TsRoleResourceVO;
|
||||
import com.adc.da.slrs.sarRole.service.ITsRoleService;
|
||||
import com.adc.da.slrs.sarUser.dao.TsUserDao;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import com.adc.da.slrs.tsRoleMeunData.dao.TsRoleMenuDataDao;
|
||||
import com.adc.da.slrs.tsRoleMeunData.service.impl.TsRoleMenuDataServiceImpl;
|
||||
import com.adc.da.slrs.zlTree.dao.ZlTreeDao;
|
||||
import com.adc.da.slrs.zlTree.entity.TreeData;
|
||||
import com.adc.da.slrs.zlTree.entity.ZlTree;
|
||||
@@ -40,6 +46,12 @@ public class ZlTreeServiceImpl extends ServiceImpl<ZlTreeDao, ZlTree> implements
|
||||
@Autowired
|
||||
private ITsUserService tsUserService;
|
||||
|
||||
@Autowired
|
||||
private TsRoleDao tsRoleDao;
|
||||
|
||||
@Autowired
|
||||
TsRoleMenuDataDao tsRoleMenuDataDao;
|
||||
|
||||
@Override
|
||||
public List<TreeData> getLeftTree() {
|
||||
// 获取当前登录人
|
||||
@@ -173,4 +185,19 @@ public class ZlTreeServiceImpl extends ServiceImpl<ZlTreeDao, ZlTree> implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增后给所有角色配置权限
|
||||
* @param material
|
||||
*/
|
||||
@Override
|
||||
public void setResource(ZlTree material) {
|
||||
//获取pid
|
||||
String pId = material.getParentId();
|
||||
List<String> roleIds = tsRoleDao.getResourceId(pId);
|
||||
for (String roleId : roleIds){
|
||||
tsRoleDao.addResource(roleId,material.getId());
|
||||
tsRoleMenuDataDao.save(roleId,material.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user