|
|
@ -2,6 +2,7 @@ package com.dreamchaser.depository_manage.service.impl; |
|
|
|
|
|
|
|
|
import com.dreamchaser.depository_manage.entity.Depository; |
|
|
import com.dreamchaser.depository_manage.entity.Depository; |
|
|
import com.dreamchaser.depository_manage.entity.MaterialType; |
|
|
import com.dreamchaser.depository_manage.entity.MaterialType; |
|
|
|
|
|
import com.dreamchaser.depository_manage.entity.UserByPort; |
|
|
import com.dreamchaser.depository_manage.exception.MyException; |
|
|
import com.dreamchaser.depository_manage.exception.MyException; |
|
|
import com.dreamchaser.depository_manage.mapper.DepositoryMapper; |
|
|
import com.dreamchaser.depository_manage.mapper.DepositoryMapper; |
|
|
import com.dreamchaser.depository_manage.mapper.MaterialTypeMapper; |
|
|
import com.dreamchaser.depository_manage.mapper.MaterialTypeMapper; |
|
|
@ -10,6 +11,7 @@ import com.dreamchaser.depository_manage.pojo.RoleAndDepository; |
|
|
import com.dreamchaser.depository_manage.pojo.RoleAndMaterialType; |
|
|
import com.dreamchaser.depository_manage.pojo.RoleAndMaterialType; |
|
|
import com.dreamchaser.depository_manage.service.RoleService; |
|
|
import com.dreamchaser.depository_manage.service.RoleService; |
|
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@ -385,12 +387,33 @@ public class RoleServiceImpl implements RoleService { |
|
|
} else if ("post".equals(type)) { |
|
|
} else if ("post".equals(type)) { |
|
|
// 如果是对岗位赋权
|
|
|
// 如果是对岗位赋权
|
|
|
map.put("type", 2); |
|
|
map.put("type", 2); |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
throw new MyException("未知参数错误"); |
|
|
throw new MyException("未知参数错误"); |
|
|
} |
|
|
} |
|
|
return roleMapper.findDepositoryIdForWarehouseVisiblePermissionByCondition(map); |
|
|
return roleMapper.findDepositoryIdForWarehouseVisiblePermissionByCondition(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于查询当前用户所被赋予的可见仓库 |
|
|
|
|
|
* @param userToken 待查询用户 |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<Integer> findDepositoryIdForWareHouseVisiblePermissionByUser(UserByPort userToken) { |
|
|
|
|
|
Map<String,Object> paramForFindDepositoryId = new HashMap<>(); |
|
|
|
|
|
paramForFindDepositoryId.put("type",1); |
|
|
|
|
|
paramForFindDepositoryId.put("uid",userToken.getId()); |
|
|
|
|
|
// 查询该用户是否存在单独设置的仓库
|
|
|
|
|
|
List<Integer> depositoryIdListForPerson = roleMapper.findDepositoryIdForWarehouseVisiblePermissionByCondition(paramForFindDepositoryId); |
|
|
|
|
|
paramForFindDepositoryId.put("type",2); |
|
|
|
|
|
paramForFindDepositoryId.put("uid",userToken.getPosition()); |
|
|
|
|
|
// 查询该用户职位是否存在设计的仓库
|
|
|
|
|
|
List<Integer> depositoryIdListForPost = roleMapper.findDepositoryIdForWarehouseVisiblePermissionByCondition(paramForFindDepositoryId); |
|
|
|
|
|
// 取并集
|
|
|
|
|
|
return (List<Integer>) CollectionUtils.union(depositoryIdListForPerson, depositoryIdListForPost); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前仓库的子仓库 |
|
|
* 获取当前仓库的子仓库 |
|
|
|