| | |
| | | public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId); |
| | | boolean isAdmin = SecurityUtils.hasPermi("customer:viewAll"); |
| | | IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId, isAdmin); |
| | | |
| | | List<CustomerVo> records = customerPage.getRecords(); |
| | | if (CollectionUtils.isEmpty(records)) { |
| | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long tenantId = loginUser.getTenantId(); |
| | | customer.setTenantId(tenantId); |
| | | return customerMapper.insert(customer); |
| | | int result = customerMapper.insert(customer); |
| | | |
| | | // 私海新增时同步一条到公海 |
| | | if (customer.getType() != null && customer.getType() == 0) { |
| | | Customer publicSeaCustomer = new Customer(); |
| | | BeanUtils.copyProperties(customer, publicSeaCustomer); |
| | | publicSeaCustomer.setId(null); |
| | | publicSeaCustomer.setType(1); |
| | | publicSeaCustomer.setIsAssigned(0); |
| | | publicSeaCustomer.setUsageUser(loginUser.getUserId()); |
| | | publicSeaCustomer.setUsageStatus(1L); |
| | | customerMapper.insert(publicSeaCustomer); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | public List<CustomerVo> selectCustomerLists(CustomerDto customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | return customerMapper.list(customer, loginUserId); |
| | | boolean isAdmin = SecurityUtils.hasPermi("customer:viewAll"); |
| | | return customerMapper.list(customer, loginUserId, isAdmin); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public List<Map<String, Object>> customerList(Customer customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | boolean isAdmin = SecurityUtils.hasPermi("customer:viewAll"); |
| | | CustomerDto query = new CustomerDto(); |
| | | if (customer != null) { |
| | | BeanUtils.copyProperties(customer, query); |
| | | } |
| | | |
| | | // 复用客户列表的可见性规则,避免把别人的私海客户暴露给当前账号 |
| | | List<CustomerVo> visibleCustomers = customerMapper.list(query, loginUserId); |
| | | List<CustomerVo> visibleCustomers = customerMapper.list(query, loginUserId, isAdmin); |
| | | if (CollectionUtils.isEmpty(visibleCustomers)) { |
| | | return Collections.emptyList(); |
| | | } |