package doumeemes.service.ext.impl;
|
|
import doumeemes.core.constants.ResponseStatus;
|
import doumeemes.core.exception.BusinessException;
|
import doumeemes.core.model.LoginUserInfo;
|
import doumeemes.core.model.PageData;
|
import doumeemes.core.model.PageWrap;
|
import doumeemes.core.utils.Constants;
|
import doumeemes.dao.ext.dto.QueryWarehouseLocationExtDTO;
|
import doumeemes.dao.ext.vo.WarehouseLocationExtListVO;
|
import doumeemes.service.ext.WarehouseLocationExtService;
|
import doumeemes.dao.ext.WarehouseLocationExtMapper;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import org.apache.shiro.SecurityUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
/**
|
* 货位信息Service实现
|
* @author 江蹄蹄
|
* @date 2022/05/05 11:37
|
*/
|
@Service
|
public class WarehouseLocationExtServiceImpl implements WarehouseLocationExtService {
|
|
@Autowired
|
private WarehouseLocationExtMapper warehouseLocationExtMapper;
|
|
@Override
|
public PageData<WarehouseLocationExtListVO> findPage(PageWrap<QueryWarehouseLocationExtDTO> pageWrap) {
|
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
if(!Constants.equalsInteger(user.getType(),Constants.USERTYPE.COM)){
|
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,您无权限进行该操作!");
|
}
|
//只能查看当前根组织的数据
|
pageWrap.getModel().setRootDepartId(user.getRootDepartment().getId());
|
// if(!Constants.equalsInteger(user.getCurComDepartment().getId(),user.getRootDepartment().getId())){
|
//如果当前选择的公司级组织非根组织信息,只能查看当前选择公司级组织数据
|
// pageWrap.getModel().setDepartId(user.getCurComDepartment().getId());
|
// }
|
//数据权限
|
List<Integer> dataPermission = user.getDepartPermissionList();
|
if(dataPermission!=null){
|
pageWrap.getModel().setDepartIds(dataPermission);
|
pageWrap.getModel().setCreateUser(user.getId());
|
}
|
|
PageHelper.startPage(pageWrap.getPage(), pageWrap.getCapacity());
|
List<WarehouseLocationExtListVO> result = warehouseLocationExtMapper.selectList(pageWrap.getModel());
|
return PageData.from(new PageInfo<>(result));
|
}
|
}
|