Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
0583e09c47
|
@ -165,8 +165,8 @@ public class DepartmentController extends BaseCrudRestController {
|
||||||
/*
|
/*
|
||||||
* 根据组织ID获取部门kv list
|
* 根据组织ID获取部门kv list
|
||||||
* */
|
* */
|
||||||
@GetMapping("/getDepartment/{orgId}")
|
@GetMapping("/getDepartmentKV/{orgId}")
|
||||||
public JsonResult getDepartment(@PathVariable Long orgId, HttpServletRequest request){
|
public JsonResult getDepartmentKV(@PathVariable Long orgId, HttpServletRequest request){
|
||||||
Wrapper wrapper = null;
|
Wrapper wrapper = null;
|
||||||
//获取部门KV
|
//获取部门KV
|
||||||
wrapper = new QueryWrapper<Department>()
|
wrapper = new QueryWrapper<Department>()
|
||||||
|
@ -178,6 +178,21 @@ public class DepartmentController extends BaseCrudRestController {
|
||||||
return new JsonResult(deptKvList);
|
return new JsonResult(deptKvList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 根据组织ID获取部门list
|
||||||
|
* */
|
||||||
|
@GetMapping("/getDepartmentList/{orgId}")
|
||||||
|
public JsonResult getDepartmentList(@PathVariable Long orgId, HttpServletRequest request) throws Exception {
|
||||||
|
// 构建分页
|
||||||
|
Pagination pagination = buildPagination(request);
|
||||||
|
Wrapper wrapper = new QueryWrapper<Department>()
|
||||||
|
.lambda()
|
||||||
|
.eq(Department::getOrgId, orgId);
|
||||||
|
List<DepartmentVO> voList = departmentService.getViewObjectList(wrapper, pagination, DepartmentVO.class);
|
||||||
|
|
||||||
|
return new JsonResult(voList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BaseService getService() {
|
protected BaseService getService() {
|
||||||
return departmentService;
|
return departmentService;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.diboot.core.binding.RelationsBinder;
|
||||||
import com.diboot.core.controller.BaseCrudRestController;
|
import com.diboot.core.controller.BaseCrudRestController;
|
||||||
import com.diboot.core.service.BaseService;
|
import com.diboot.core.service.BaseService;
|
||||||
import com.diboot.core.service.DictionaryService;
|
import com.diboot.core.service.DictionaryService;
|
||||||
|
import com.diboot.core.util.V;
|
||||||
import com.diboot.core.vo.JsonResult;
|
import com.diboot.core.vo.JsonResult;
|
||||||
import com.diboot.core.vo.KeyValue;
|
import com.diboot.core.vo.KeyValue;
|
||||||
import com.diboot.core.vo.Pagination;
|
import com.diboot.core.vo.Pagination;
|
||||||
|
@ -38,12 +39,11 @@ public class OrganizationController extends BaseCrudRestController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public JsonResult getVOList(HttpServletRequest request) throws Exception{
|
public JsonResult getVOList(HttpServletRequest request) throws Exception{
|
||||||
QueryWrapper<Organization> queryWrapper = buildQuery(request);
|
QueryWrapper<Organization> queryWrapper = buildQuery(request);
|
||||||
|
queryWrapper.lambda().eq(Organization::getParentId, 0);
|
||||||
// 构建分页
|
// 构建分页
|
||||||
Pagination pagination = buildPagination(request);
|
Pagination pagination = buildPagination(request);
|
||||||
// 查询当前页的Entity主表数据
|
// 查询当前页的Entity主表数据
|
||||||
List<Organization> entityList = organizationService.getEntityList(queryWrapper, pagination);
|
List<OrganizationVO> voList = organizationService.getOrganizatioList(queryWrapper, pagination);
|
||||||
//筛选出在列表页展示的字段
|
|
||||||
List<OrganizationVO> voList = RelationsBinder.convertAndBind(entityList, OrganizationVO.class);
|
|
||||||
// 返回结果
|
// 返回结果
|
||||||
return new JsonResult(Status.OK, voList).bindPagination(pagination);
|
return new JsonResult(Status.OK, voList).bindPagination(pagination);
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,11 @@ public class OrganizationController extends BaseCrudRestController {
|
||||||
@GetMapping("/attachMore")
|
@GetMapping("/attachMore")
|
||||||
public JsonResult attachMore(HttpServletRequest request, ModelMap modelMap){
|
public JsonResult attachMore(HttpServletRequest request, ModelMap modelMap){
|
||||||
Wrapper wrapper = null;
|
Wrapper wrapper = null;
|
||||||
//获取组织机构KV
|
//获取父组织机构KV
|
||||||
wrapper = new QueryWrapper<Organization>()
|
wrapper = new QueryWrapper<Organization>()
|
||||||
.lambda()
|
.lambda()
|
||||||
.select(Organization::getName, Organization::getId);
|
.select(Organization::getName, Organization::getId)
|
||||||
|
.eq(Organization::getParentId, 0);
|
||||||
List<KeyValue> orgKvList = organizationService.getKeyValueList(wrapper);
|
List<KeyValue> orgKvList = organizationService.getKeyValueList(wrapper);
|
||||||
modelMap.put("orgKvList", orgKvList);
|
modelMap.put("orgKvList", orgKvList);
|
||||||
|
|
||||||
|
@ -99,6 +100,25 @@ public class OrganizationController extends BaseCrudRestController {
|
||||||
return new JsonResult(modelMap);
|
return new JsonResult(modelMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getOrgTree")
|
||||||
|
public JsonResult getOrgTree() throws Exception{
|
||||||
|
QueryWrapper<Organization> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(Organization::getParentId, 0);
|
||||||
|
List<Organization> orgList = organizationService.getEntityList(queryWrapper);
|
||||||
|
List<OrganizationVO> voList = RelationsBinder.convertAndBind(orgList, OrganizationVO.class);
|
||||||
|
if(V.notEmpty(voList)){
|
||||||
|
for(OrganizationVO vo : voList){
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda()
|
||||||
|
.eq(Organization::getParentId, vo.getId());
|
||||||
|
List<Organization> childList = organizationService.getEntityList(queryWrapper);
|
||||||
|
List<OrganizationVO> childvVoList = RelationsBinder.convertAndBind(childList, OrganizationVO.class);
|
||||||
|
vo.setChildren(childvVoList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new JsonResult(orgList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BaseService getService() {
|
protected BaseService getService() {
|
||||||
return organizationService;
|
return organizationService;
|
||||||
|
|
|
@ -116,8 +116,8 @@ public class PositionController extends BaseCrudRestController {
|
||||||
/*
|
/*
|
||||||
* 根据部门ID获取职位kv list
|
* 根据部门ID获取职位kv list
|
||||||
* */
|
* */
|
||||||
@GetMapping("/getPosition/{deptId}")
|
@GetMapping("/getPositionKV/{deptId}")
|
||||||
public JsonResult getPosition(@PathVariable Long deptId, HttpServletRequest request){
|
public JsonResult getPositionKV(@PathVariable Long deptId, HttpServletRequest request){
|
||||||
Wrapper wrapper = null;
|
Wrapper wrapper = null;
|
||||||
List<Long> positionIdList = new ArrayList<>();
|
List<Long> positionIdList = new ArrayList<>();
|
||||||
wrapper = new LambdaQueryWrapper<PositionDepartment>()
|
wrapper = new LambdaQueryWrapper<PositionDepartment>()
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package com.diboot.example.service;
|
package com.diboot.example.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.diboot.core.service.BaseService;
|
import com.diboot.core.service.BaseService;
|
||||||
|
import com.diboot.core.vo.Pagination;
|
||||||
import com.diboot.example.entity.Organization;
|
import com.diboot.example.entity.Organization;
|
||||||
|
import com.diboot.example.vo.OrganizationVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单位相关Service
|
* 单位相关Service
|
||||||
|
@ -11,4 +16,6 @@ import com.diboot.example.entity.Organization;
|
||||||
*/
|
*/
|
||||||
public interface OrganizationService extends BaseService<Organization> {
|
public interface OrganizationService extends BaseService<Organization> {
|
||||||
|
|
||||||
|
List<OrganizationVO> getOrganizatioList(Wrapper wrapper, Pagination pagination);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
package com.diboot.example.service.impl;
|
package com.diboot.example.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.diboot.core.binding.RelationsBinder;
|
||||||
import com.diboot.core.service.impl.BaseServiceImpl;
|
import com.diboot.core.service.impl.BaseServiceImpl;
|
||||||
|
import com.diboot.core.util.V;
|
||||||
|
import com.diboot.core.vo.Pagination;
|
||||||
import com.diboot.example.entity.Organization;
|
import com.diboot.example.entity.Organization;
|
||||||
import com.diboot.example.mapper.OrganizationMapper;
|
import com.diboot.example.mapper.OrganizationMapper;
|
||||||
import com.diboot.example.service.OrganizationService;
|
import com.diboot.example.service.OrganizationService;
|
||||||
|
import com.diboot.example.vo.OrganizationVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单位相关Service实现
|
* 单位相关Service实现
|
||||||
* @author Mazhicheng
|
* @author Mazhicheng
|
||||||
|
@ -17,4 +25,17 @@ import org.springframework.stereotype.Service;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class OrganizationServiceImpl extends BaseServiceImpl<OrganizationMapper, Organization> implements OrganizationService {
|
public class OrganizationServiceImpl extends BaseServiceImpl<OrganizationMapper, Organization> implements OrganizationService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrganizationVO> getOrganizatioList(Wrapper wrapper, Pagination pagination) {
|
||||||
|
List<OrganizationVO> voList = super.getViewObjectList(wrapper, pagination, OrganizationVO.class);
|
||||||
|
if(V.notEmpty(voList)){
|
||||||
|
for(OrganizationVO vo : voList){
|
||||||
|
wrapper = new LambdaQueryWrapper<Organization>().eq(Organization::getParentId, vo.getId());
|
||||||
|
List<Organization> orgList = super.getEntityList(wrapper);
|
||||||
|
List<OrganizationVO> orgVoList = RelationsBinder.convertAndBind(orgList, OrganizationVO.class);
|
||||||
|
vo.setChildren(orgVoList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return voList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import com.diboot.core.binding.annotation.BindField;
|
||||||
import com.diboot.example.entity.Organization;
|
import com.diboot.example.entity.Organization;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangyongliang
|
* @author wangyongliang
|
||||||
* @version v2.0
|
* @version v2.0
|
||||||
|
@ -22,4 +24,6 @@ public class OrganizationVO extends Organization {
|
||||||
@BindDict(type = "INDUSTRY", field = "industry")
|
@BindDict(type = "INDUSTRY", field = "industry")
|
||||||
private String industryLabel;
|
private String industryLabel;
|
||||||
|
|
||||||
|
private List<OrganizationVO> children;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue