| src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/mapper/basic/CustomerMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -129,7 +129,8 @@ @Override public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) { LoginUser loginUser = SecurityUtils.getLoginUser(); Long loginUserId = loginUser.getUserId(); // 超级管理员不受客户领用/共享范围限制,可查看全部客户 Long loginUserId = isSuperAdmin(loginUser) ? null : loginUser.getUserId(); IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId); List<CustomerVo> records = customerPage.getRecords(); @@ -280,10 +281,16 @@ @Override public List<CustomerVo> selectCustomerLists(CustomerDto customer) { LoginUser loginUser = SecurityUtils.getLoginUser(); Long loginUserId = loginUser.getUserId(); // 超级管理员不受客户领用/共享范围限制,可导出全部客户 Long loginUserId = isSuperAdmin(loginUser) ? null : loginUser.getUserId(); return customerMapper.list(customer, loginUserId); } /** 超级管理员:不受客户领用/共享范围限制 */ private boolean isSuperAdmin(LoginUser loginUser) { return loginUser != null && loginUser.getUser() != null && loginUser.getUser().isAdmin(); } @Override public R importData(MultipartFile file, Integer type) { try { src/main/resources/mapper/basic/CustomerMapper.xml
@@ -45,8 +45,9 @@ </if> <!-- 私海查询:type = 0(私海客户)或者 type = 1(公海客户)且已被分配,并且是自己领用、自己创建或者共享给自己的客户 --> <if test="c.type != null and c.type == 0"> and ( (type = #{c.type} or (type = 1 and is_assigned = 1)) and (type = #{c.type} or (type = 1 and is_assigned = 1)) <!-- loginUserId 为空表示超级管理员,不受领用/共享范围限制 --> <if test="loginUserId != null"> and ( c.usage_user = #{loginUserId} or c.create_user = #{loginUserId} @@ -56,7 +57,7 @@ and cu.user_id = #{loginUserId} ) ) ) </if> </if> </where> order by c.id desc @@ -107,8 +108,9 @@ </if> <!-- 私海查询:type = 0(私海客户)或者 type = 1(公海客户)且已被分配,并且是自己领用、自己创建或者共享给自己的客户 --> <if test="c.type != null and c.type == 0"> and ( (type = #{c.type} or (type = 1 and is_assigned = 1)) and (type = #{c.type} or (type = 1 and is_assigned = 1)) <!-- loginUserId 为空表示超级管理员,不受领用/共享范围限制 --> <if test="loginUserId != null"> and ( c.usage_user = #{loginUserId} or c.create_user = #{loginUserId} @@ -118,7 +120,7 @@ and cu.user_id = #{loginUserId} ) ) ) </if> </if> </where> order by c.id desc