Commit 09dfbb07 authored by zhangch's avatar zhangch

列表查询条件机构的查询

parent d0eae670
......@@ -22,7 +22,7 @@ public interface DisableApplyMapper extends BaseMapper<ChDisableApply> {
/**
* 查询待遇申请管理列表
*
* @param organId 机构代码
* @param organIds 机构代码集合
* @param isIncludeSubsidiaries 是否包含子机构 0包含,1不包含
* @param provincial 省
* @param city 市
......@@ -32,7 +32,7 @@ public interface DisableApplyMapper extends BaseMapper<ChDisableApply> {
* @param dataFrom 申请来源
* @param srvOrganId 护理机构
*/
Page<DisableVO> disableList(Page<DisableVO> page, String organId, String isIncludeSubsidiaries, String provincial,
Page<DisableVO> disableList(Page<DisableVO> page, List<String> organIds, String isIncludeSubsidiaries, String provincial,
String city, String area, String name, String certiCode,
String dataFrom, String srvOrganId);
......
package com.hungraim.ism.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ism.dao.DisableApplyMapper;
......@@ -32,31 +33,62 @@ public class DisableServiceImpl implements DisableService {
@Autowired
private FndStreetMapper fndStreetMapper;
/**
* 获取机构ids
*
* @param organId 父机构id
* @param organIds 机构list
*/
private void getOrganList(String organId, List<String> organIds) {
QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("STATUS", "1");
queryWrapper.eq("PARENT_ID", organId);
List<ChFndOrgan> organs = fndOrganMapper.selectList(queryWrapper);
if (organs != null && organs.size() != 0) {
for (ChFndOrgan chFndOrgan : organs) {
String childOrganId = chFndOrgan.getOrganId();
organIds.add(childOrganId);
if ("1".equals(chFndOrgan.getIsLeaf())) {
getOrganList(childOrganId, organIds);
}
}
}
}
@Override
public Page<DisableVO> disableList(String organId, String isIncludeSubsidiaries, String districtProvincial, String districtCity,
String districtArea, String realName, String certiCode, String dataFrom,
String srvOrganId, int page, int pageSize) {
//拼接子机构id
if ("0".equals(isIncludeSubsidiaries)) {
boolean flag = true;
while (flag) {
QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("STATUS", "1");
queryWrapper.eq("PARENT_ID", organId);
List<ChFndOrgan> organs = fndOrganMapper.selectList(queryWrapper);
if (organs != null && organs.size() != 0) {
for (ChFndOrgan chFndOrgan : organs) {
organId = organId + "," + chFndOrgan.getOrganId();
if ("2".equals(chFndOrgan.getIsLeaf())) {
flag = false;
}
}
} else {
flag = false;
}
// 没有organId参数的时候,这个集合就为null
List<String> organIds = null;
if (StrUtil.isNotBlank(organId)) {
organIds = new ArrayList<>();
// 先把最顶层id添加到集合
organIds.add(organId);
// 获取子孙机构集合
if ("0".equals(isIncludeSubsidiaries)) {
this.getOrganList(organId, organIds);
// boolean flag = true;
// while (flag) {
// QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("STATUS", "1");
// queryWrapper.eq("PARENT_ID", organId);
// List<ChFndOrgan> organs = fndOrganMapper.selectList(queryWrapper);
// if (organs != null && organs.size() != 0) {
// for (ChFndOrgan chFndOrgan : organs) {
// organId = organId + "," + chFndOrgan.getOrganId();
// if ("2".equals(chFndOrgan.getIsLeaf())) {
// flag = false;
// }
// }
// } else {
// flag = false;
// }
// }
}
}
return disableApplyMapper.disableList(new Page<>(page, pageSize), organId, isIncludeSubsidiaries, districtProvincial,
return disableApplyMapper.disableList(new Page<>(page, pageSize), organIds, isIncludeSubsidiaries, districtProvincial,
districtCity, districtArea, realName, certiCode, dataFrom, srvOrganId);
}
......
......@@ -27,13 +27,11 @@
LEFT JOIN CH_FND_ORGAN o ON a.organ_id = o.ORGAN_ID
LEFT JOIN CH_FND_SRV_MODE m ON a.srv_mode_id = m.SRV_MODE_ID
<where>
<if test="organId != null and organId != ''">
<if test="isIncludeSubsidiaries == '0'">
and a.organ_id in (#{organId})
</if>
<if test="isIncludeSubsidiaries != '0'">
and a.organ_id = #{organId}
</if>
<if test="organIds != null">
and a.organ_id in
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
#{organId}
</foreach>
</if>
<if test="provincial != null and provincial != ''">
and a.DISTRICT_PROVINCIAL = #{provincial}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment