@@ -50,6 +50,4 @@ public class AccidentController { | |||
} | |||
} |
@@ -36,6 +36,14 @@ public class DeptController { | |||
return deptService.getListTree(); | |||
} | |||
/** | |||
* 根据当前租户获取部门列表 | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult getListByTenantId(){ | |||
return deptService.getListByTenantId(); | |||
} | |||
/** | |||
* 查询当前部门树形列表 | |||
*/ |
@@ -3,12 +3,10 @@ package com.tuoheng.admin.service.dept; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||
import com.tuoheng.admin.service.accident.query.QueryAccidentPageListService; | |||
import com.tuoheng.admin.service.dept.add.AddDeptService; | |||
import com.tuoheng.admin.service.dept.delete.DeleteDeptService; | |||
import com.tuoheng.admin.service.dept.query.QueryChildListService; | |||
import com.tuoheng.admin.service.dept.query.QueryDeptInfoService; | |||
import com.tuoheng.admin.service.dept.query.QueryListTreeByDeptIdService; | |||
import com.tuoheng.admin.service.dept.query.QueryListTreeService; | |||
import com.tuoheng.admin.service.dept.query.*; | |||
import com.tuoheng.admin.service.dept.update.UpdateDeptService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -50,6 +48,9 @@ public class DeptServiceImpl implements IDeptService { | |||
@Autowired | |||
private DeleteDeptService deleteDeptService; | |||
@Autowired | |||
private QueryListByTenantIdService queryListByTenantIdService; | |||
/** | |||
* 查询部门树形列表 | |||
* | |||
@@ -124,4 +125,13 @@ public class DeptServiceImpl implements IDeptService { | |||
public JsonResult deleteById(String id) { | |||
return deleteDeptService.deleteById(id); | |||
} | |||
/** | |||
* 根据当前租户id获取部门列表 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getListByTenantId() { | |||
return queryListByTenantIdService.getListByTenantId(); | |||
} | |||
} |
@@ -68,4 +68,12 @@ public interface IDeptService { | |||
* @return 结果 | |||
*/ | |||
JsonResult deleteById(String id); | |||
/** | |||
* 根据租户获取部门列表 | |||
* @return | |||
*/ | |||
JsonResult getListByTenantId(); | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.service.dept.query; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/8 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class QueryListByTenantIdService { | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
/** | |||
* 根据租户id获取部门列表 | |||
* @return | |||
*/ | |||
public JsonResult getListByTenantId() { | |||
//获取当前登录用户租户id | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
if(null == tenantId){ | |||
return JsonResult.error("当前租户不存在"); | |||
} | |||
//根据当前租户查询部门列表 | |||
List<Dept> deptList = deptMapper.selectList(Wrappers.<Dept>lambdaQuery() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getMark, MarkEnum.VALID.getCode())); | |||
return JsonResult.success(deptList); | |||
} | |||
} |