jiangping
2023-08-18 807e22533146d9e1f13a4cf706b9fc62bb204a81
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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));
    }
}