添加地区查询部门列表接口

This commit is contained in:
wanggeng 2021-11-06 17:40:55 +08:00
parent a8156ac3d3
commit 3da1d02e1e
5 changed files with 99 additions and 23 deletions

View File

@ -33,18 +33,34 @@ public interface IDepartmentBaseService {
/**
* 部门列表
*
* @param areaCode
* @param departmentParentId
* @return
*/
List<DepartmentDTO> listByAreaCode(String areaCode);
List<DepartmentDTO> listByParentId(String departmentParentId);
/**
* 部门列表
*
* @param areaCode
* @param departmentAreaCode
* @return
*/
List<DepartmentDTO> listAllByAreaCode(String areaCode);
List<DepartmentDTO> listByAreaCode(String departmentAreaCode);
/**
* 部门列表
*
* @param departmentAreaCode
* @return
*/
List<DepartmentDTO> listAllByAreaCode(String departmentAreaCode);
/**
* 部门全部子列表
*
* @param departmentAreaCode
* @return
*/
List<DepartmentDTO> listSubAllByAreaCode(String departmentAreaCode);
/**
* 通过ID获取组织部门详情
@ -74,20 +90,29 @@ public interface IDepartmentBaseService {
/**
* 组织部门列表
*
* @param departmentParentId
* @param departmentAreaCode
* @param page
* @return
*/
SuccessResultList<List<DepartmentDTO>> listPageByAreaCode(String areaCode, ListPage page);
SuccessResultList<List<DepartmentDTO>> listPageByAreaCode(String departmentAreaCode, ListPage page);
/**
* 组织部门列表
*
* @param departmentParentId
* @param departmentAreaCode
* @param page
* @return
*/
SuccessResultList<List<DepartmentDTO>> listPageAllByAreaCode(String areaCode, ListPage page);
SuccessResultList<List<DepartmentDTO>> listPageAllByAreaCode(String departmentAreaCode, ListPage page);
/**
* 组织部门子列表
*
* @param departmentAreaCode
* @param page
* @return
*/
SuccessResultList<List<DepartmentDTO>> listPageSubAllByAreaCode(String departmentAreaCode, ListPage page);
/**
* 组织部门列表递归获取全部内容

View File

@ -44,16 +44,31 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
}
@Override
public List<DepartmentDTO> listByAreaCode(String areaCode) {
public List<DepartmentDTO> listByParentId(String departmentParentId) {
Map<String, Object> params = getHashMap(2);
params.put("departmentAreaCode", areaCode);
params.put("departmentParentId", departmentParentId);
return list(params);
}
@Override
public List<DepartmentDTO> listAllByAreaCode(String areaCode) {
public List<DepartmentDTO> listByAreaCode(String departmentAreaCode) {
Map<String, Object> params = getHashMap(2);
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
params.put("departmentAreaCode", departmentAreaCode);
return list(params);
}
@Override
public List<DepartmentDTO> listAllByAreaCode(String departmentAreaCode) {
Map<String, Object> params = getHashMap(2);
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
return list(params);
}
@Override
public List<DepartmentDTO> listSubAllByAreaCode(String departmentAreaCode) {
Map<String, Object> params = getHashMap(4);
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
params.put("excludeDepartmentAreaCode", departmentAreaCode);
return list(params);
}
@ -80,8 +95,15 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
}
@Override
public SuccessResultList<List<DepartmentDTO>> listPageAllByAreaCode(String areaCode, ListPage page) {
page.getParams().put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
public SuccessResultList<List<DepartmentDTO>> listPageAllByAreaCode(String departmentAreaCode, ListPage page) {
page.getParams().put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
return listPage(page);
}
@Override
public SuccessResultList<List<DepartmentDTO>> listPageSubAllByAreaCode(String departmentAreaCode, ListPage page) {
page.getParams().put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
page.getParams().put("excludeDepartmentAreaCode", departmentAreaCode);
return listPage(page);
}

View File

@ -16,7 +16,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -42,7 +41,7 @@ public class DepartmentResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
public List<DepartmentDTO> list() {
Map<String, Object> params = new HashMap<>(0);
Map<String, Object> params = requestParams();
return departmentService.list(params);
}
@ -53,7 +52,7 @@ public class DepartmentResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list/{departmentParentId}")
public List<DepartmentDTO> list(@PathVariable("departmentParentId") String departmentParentId) {
Map<String, Object> params = new HashMap<>(0);
Map<String, Object> params = requestParams();
params.put("departmentParentId", departmentParentId);
return departmentService.list(params);
}

View File

@ -190,16 +190,31 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
}
@Override
public List<DepartmentDTO> listByAreaCode(String areaCode) {
public List<DepartmentDTO> listByParentId(String departmentParentId) {
Map<String, Object> params = getHashMap(2);
params.put("departmentAreaCode", areaCode);
params.put("departmentParentId", departmentParentId);
return list(params);
}
@Override
public List<DepartmentDTO> listAllByAreaCode(String areaCode) {
public List<DepartmentDTO> listByAreaCode(String departmentAreaCode) {
Map<String, Object> params = getHashMap(2);
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
params.put("departmentAreaCode", departmentAreaCode);
return list(params);
}
@Override
public List<DepartmentDTO> listAllByAreaCode(String departmentAreaCode) {
Map<String, Object> params = getHashMap(2);
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
return list(params);
}
@Override
public List<DepartmentDTO> listSubAllByAreaCode(String departmentAreaCode) {
Map<String, Object> params = getHashMap(4);
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
params.put("excludeDepartmentAreaCode", departmentAreaCode);
return list(params);
}
@ -238,6 +253,13 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
return listPage(page);
}
@Override
public SuccessResultList<List<DepartmentDTO>> listPageSubAllByAreaCode(String departmentAreaCode, ListPage page) {
page.getParams().put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(departmentAreaCode, '0'));
page.getParams().put("excludeDepartmentAreaCode", departmentAreaCode);
return listPage(page);
}
@Override
public DepartmentDTO get(String departmentId) {
Map<String, Object> params = getHashMap(1);

View File

@ -414,7 +414,11 @@
</if>
<if test="departmentAreaCodeLike != null and departmentAreaCodeLike != ''">
AND
department_area_code LIKE CONCAT(#{departmentAreaCode}, '%')
department_area_code LIKE CONCAT(#{departmentAreaCodeLike}, '%')
</if>
<if test="excludeDepartmentAreaCode != null and excludeDepartmentAreaCode != ''">
AND
department_area_code != #{excludeDepartmentAreaCode}
</if>
<choose>
<when test="sort != null and (sort == 'departmentName' or sort == 'departmentNameEn' or sort == 'departmentNameOther' or sort == 'departmentCode' or sort == 'departmentType' or sort == 'departmentState')">
@ -675,7 +679,11 @@
</if>
<if test="departmentAreaCodeLike != null and departmentAreaCodeLike != ''">
AND
department_area_code LIKE CONCAT(#{departmentAreaCode}, '%')
department_area_code LIKE CONCAT(#{departmentAreaCodeLike}, '%')
</if>
<if test="excludeDepartmentAreaCode != null and excludeDepartmentAreaCode != ''">
AND
department_area_code != #{excludeDepartmentAreaCode}
</if>
<if test="departmentType != null and departmentType != ''">
AND