Преглед изворни кода

根据租户id获取当前部门列表

tags/v1.2.0^2
chengwang пре 1 година
родитељ
комит
e01abcb884
5 измењених фајлова са 77 додато и 6 уклоњено
  1. +0
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java
  2. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/DeptController.java
  3. +14
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/DeptServiceImpl.java
  4. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/IDeptService.java
  5. +47
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListByTenantIdService.java

+ 0
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java Прегледај датотеку

@@ -50,6 +50,4 @@ public class AccidentController {
}




}

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/DeptController.java Прегледај датотеку

@@ -36,6 +36,14 @@ public class DeptController {
return deptService.getListTree();
}

/**
* 根据当前租户获取部门列表
*/
@GetMapping("/list")
public JsonResult getListByTenantId(){
return deptService.getListByTenantId();
}

/**
* 查询当前部门树形列表
*/

+ 14
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/DeptServiceImpl.java Прегледај датотеку

@@ -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();
}
}

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/IDeptService.java Прегледај датотеку

@@ -68,4 +68,12 @@ public interface IDeptService {
* @return 结果
*/
JsonResult deleteById(String id);

/**
* 根据租户获取部门列表
* @return
*/
JsonResult getListByTenantId();


}

+ 47
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListByTenantIdService.java Прегледај датотеку

@@ -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);

}
}

Loading…
Откажи
Сачувај