select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag,d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret, d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url, d.app_user_id, d.handling_charge_type,withdraw_handling_charge, d.create_by, d.create_time,d.collection_code from sys_dept d insert into sys_dept( dept_id, parent_id, dept_name, ancestors, order_num, leader, phone, email, status, create_by, platform_service_fee, handling_charge, separate_account, is_use_platform_app, domain, appid, app_name, app_secret, merchant_id, api_v3_key, notify_url, private_key_path, merchant_serial_number, refund_notify_url, app_user_id, handling_charge_type, withdraw_handling_charge, collection_code, create_time )values( #{deptId}, #{parentId}, #{deptName}, #{ancestors}, #{orderNum}, #{leader}, #{phone}, #{email}, #{status}, #{createBy}, #{platformServiceFee}, #{handlingCharge}, #{separateAccount}, #{isUsePlatformApp}, #{domain}, #{appid}, #{appName}, #{appSecret}, #{merchantId}, #{apiV3Key}, #{notifyUrl}, #{privateKeyPath}, #{merchantSerialNumber}, #{refundNotifyUrl}, #{appUserId}, #{handlingChargeType}, #{withdrawHandlingCharge}, #{collectionCode}, sysdate() ) update sys_dept parent_id = #{parentId}, dept_name = #{deptName}, ancestors = #{ancestors}, order_num = #{orderNum}, leader = #{leader}, phone = #{phone}, email = #{email}, status = #{status}, update_by = #{updateBy}, platform_service_fee = #{platformServiceFee}, handling_charge = #{handlingCharge}, separate_account = #{separateAccount}, is_use_platform_app = #{isUsePlatformApp}, domain = #{domain}, appid = #{appid}, app_name = #{appName}, app_secret = #{appSecret}, merchant_id = #{merchantId}, api_v3_key = #{apiV3Key}, notify_url = #{notifyUrl}, private_key_path = #{privateKeyPath}, merchant_serial_number = #{merchantSerialNumber}, refund_notify_url = #{refundNotifyUrl}, app_user_id = #{appUserId}, handling_charge_type = #{handlingChargeType}, withdraw_handling_charge = #{withdrawHandlingCharge}, collection_code = #{collectionCode}, 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 balance = balance + #{amount} where dept_id = #{deptId} update sys_dept set del_flag = '2' where dept_id = #{deptId}