select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.deleted, d.create_by, d.create_time, d.department_en_name, d.org_type, d.department_code, d.parent_org_id, d.parent_org_name, d.parent_org_code, d.parent_org_type, d.hosp_id, d.hosp_code, d.hosp_name, d.contact_person, d.contact_phone, d.postal_code, d.official_web, d.plait_bed, d.open_bed, d.build_date, d.over_date, d.peofile, d.standard_dept_code, d.dept_type_code, d.dept_fcus_type_code, d.modality, d.hisksid, d.hisksmc from sys_dept d insert into sys_dept( dept_id, parent_id, dept_name, ancestors, order_num, leader, phone, email, status, department_en_name, org_type, department_code, parent_org_id, parent_org_name, parent_org_code, parent_org_type, hosp_id, hosp_code, hosp_name, contact_person, contact_phone, postal_code, official_web, plait_bed, open_bed, build_date, over_date, peofile, standard_dept_code, dept_type_code, dept_fcus_type_code, create_by, modality, hisksid, hisksmc, create_time )values( #{deptId}, #{parentId}, #{deptName}, #{ancestors}, #{orderNum}, #{leader}, #{phone}, #{email}, #{status}, #{departmentEnName}, #{orgType}, #{departmentCode}, #{parentOrgId}, #{parentOrgName}, #{parentOrgCode}, #{parentOrgType}, #{hospId}, #{hospCode}, #{hospName}, #{contactPerson}, #{contactPhone}, #{postalCode}, #{officialWeb}, #{plaitBed}, #{openBed}, #{buildDate}, #{overDate}, #{peofile}, #{standardDeptCode}, #{deptTypeCode}, #{deptFcusTypeCode}, #{createBy}, #{modality}, #{hisksid}, #{hisksmc}, sysdate() ) update sys_dept parent_id = #{parentId}, dept_name = #{deptName}, ancestors = #{ancestors}, order_num = #{orderNum}, leader = #{leader}, phone = #{phone}, email = #{email}, status = #{status}, department_en_name = #{departmentEnName}, org_type = #{orgType}, department_code = #{departmentCode}, parent_org_id = #{parentOrgId}, parent_org_name = #{parentOrgName}, parent_org_code = #{parentOrgCode}, parent_org_type = #{parentOrgType}, hosp_id = #{hospId}, hosp_code = #{hospCode}, hosp_name = #{hospName}, contact_person = #{contactPerson}, contact_phone = #{contactPhone}, postal_code = #{postalCode}, official_web = #{officialWeb}, plait_bed = #{plaitBed}, open_bed = #{openBed}, build_date = #{buildDate}, over_date = #{overDate}, peofile = #{peofile}, standard_dept_code = #{standardDeptCode}, dept_type_code = #{deptTypeCode}, dept_fcus_type_code = #{deptFcusTypeCode}, update_by = #{updateBy}, modality = #{modality}, hisksid = #{hisksid}, hisksmc = #{hisksmc}, update_time = sysdate() where dept_id = #{deptId} update sys_dept set ancestors = when #{item.deptId} then #{item.ancestors} where dept_id in #{item.deptId} update sys_dept set status = '0' where dept_id in #{deptId} update sys_dept set deleted = '1' where dept_id = #{deptId} update sys_dept set status = #{status} where dept_id = #{deptId}