forked from kidgrow-microservices-platform

kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysHospitalServiceImpl.java
@@ -157,30 +157,30 @@
        //科室数据
        SysDepartment sysDepartment=departmentMapper.selectById(departmentId);
        //医院数据
        SysHospital sysHospital = baseMapper.selectById(id);
        if (sysHospital == null) {
            return ResultBody.failed("医院数据不存在!");
        }
        //SysHospital sysHospital = baseMapper.selectById(id);
//        if (sysHospital == null) {
//            return ResultBody.failed("医院数据不存在!");
//        }
        if (sysDepartment == null) {
            return ResultBody.failed("科室数据不存在!");
        }
        //医院下的所有科室数据
        Map<String,Object> columnMap=new HashMap<String,Object>();
        columnMap.put("org_parent_id",sysHospital.getOrgId());
        columnMap.put("is_del",0);
        columnMap.put("enabled",1);
        List<SysOrganization> sysOrganizationList=sysOrganizationMapper.selectByMap(columnMap);
        //如果这个医院下有多个科室,禁用只对当前科室有效,否则也要禁用医院
        if(sysOrganizationList.size()==1)
        {
            sysHospital.setIsDel(true);
            baseMapper.updateById(sysHospital);
            SysOrganization sysOrganizationH=sysOrganizationMapper.selectById(sysHospital.getOrgId());
            if (sysOrganizationH != null) {
                sysOrganizationH.setIsDel(true);
                sysOrganizationMapper.updateById(sysOrganizationH);
            }
        }
//        Map<String,Object> columnMap=new HashMap<String,Object>();
//        columnMap.put("org_parent_id",sysHospital.getOrgId());
//        columnMap.put("is_del",0);
//        columnMap.put("enabled",1);
//        List<SysOrganization> sysOrganizationList=sysOrganizationMapper.selectByMap(columnMap);
//        //如果这个医院下有多个科室,删除只对当前科室有效,否则也要删除医院
//        if(sysOrganizationList.size()==1)
//        {
//            sysHospital.setIsDel(true);
//            baseMapper.updateById(sysHospital);
//            SysOrganization sysOrganizationH=sysOrganizationMapper.selectById(sysHospital.getOrgId());
//            if (sysOrganizationH != null) {
//                sysOrganizationH.setIsDel(true);
//                sysOrganizationMapper.updateById(sysOrganizationH);
//            }
//        }
        sysDepartment.setIsDel(true);
        int j=departmentMapper.updateById(sysDepartment);
        //删除组织数据
@@ -189,7 +189,7 @@
            sysOrganizationD.setIsDel(true);
            sysOrganizationMapper.updateById(sysOrganizationD);
        }
        return (j>0) ? ResultBody.ok().data(sysHospital).msg("删除成功") : ResultBody.failed("删除失败");
        return (j>0) ? ResultBody.ok().data(sysDepartment).msg("科室删除成功") : ResultBody.failed("科室删除失败");
    }
    /**