SELECT id, department_id, concat( IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select city from automessage_organization_chart where automessage_organization_chart.id=department_id)),''), IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select district from automessage_organization_chart where automessage_organization_chart.id=department_id)),''), IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select village from automessage_organization_chart where automessage_organization_chart.id=department_id)),'') ) AS department_area, (select contact_number from automessage_organization_chart where automessage_organization_chart.id=department_id) as contactNumber, classify_id, matter_name, associate_ids, transaction_num, browse_num, basic_information, accept_conditions, application_material, handling_procedures, rates, create_time, update_time, query_time, associate_names, basic_information_url, accept_conditions_url, application_material_url, handling_procedures_url, rates_url, basic_information_file_name, accept_conditions_file_name, application_material_file_name, handling_procedures_file_name, rates_file_name, operational_guideline_url, set_gist, set_gist_url, set_gist_name, common_problem, common_problem_url, common_problem_name, operational_guideline_video_url, operational_guideline_video_name, operational_guideline_name, transaction_area, transaction_area_url, transaction_area_name, classify_ids, department_ids, (SELECT GROUP_CONCAT(organization_name) FROM automessage_organization_chart WHERE id in (SELECT substring_index(substring_index(department_ids,',', b.help_topic_id + 1), ',', -1) result FROM mysql.help_topic b where b.help_topic_id < (LENGTH(department_ids) - LENGTH(REPLACE(department_ids, ',', '')) + 1))) as departmentNames, (IF((select classify_grade from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id)='2', (select classify_name from automessage_classify_administration where automessage_classify_administration.id=(select parent_id from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id)), (select classify_name from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id))) as classifyName, (select organization_name from automessage_organization_chart where automessage_organization_chart.id=automessage_transaction_event.department_id) as departmentName, concat( (select classify_name from automessage_classify_administration where id=(select parent_id from automessage_classify_administration where id=automessage_transaction_event.classify_id)), '>',(select classify_name from automessage_classify_administration where id=automessage_transaction_event.classify_id) ) sumClassifyName FROM automessage_transaction_event SELECT id, department_id, concat( IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select city from automessage_organization_chart where automessage_organization_chart.id=department_id)),''), IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select district from automessage_organization_chart where automessage_organization_chart.id=department_id)),''), IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select village from automessage_organization_chart where automessage_organization_chart.id=department_id)),'') ) AS department_area, classify_id, (IF((select classify_grade from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id)='2', (select classify_name from automessage_classify_administration where automessage_classify_administration.id=(select parent_id from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id)), (select classify_name from automessage_classify_administration where automessage_classify_administration.id=automessage_transaction_event.classify_id))) as classifyName, (select organization_name from automessage_organization_chart where automessage_organization_chart.id=automessage_transaction_event.department_id) as departmentName, matter_name, associate_ids, associate_names, transaction_num, browse_num, department_ids, (SELECT GROUP_CONCAT(organization_name) FROM automessage_organization_chart WHERE id in (SELECT substring_index(substring_index(department_ids,',', b.help_topic_id + 1), ',', -1) result FROM mysql.help_topic b where b.help_topic_id < (LENGTH(department_ids) - LENGTH(REPLACE(department_ids, ',', '')) + 1))) as departmentNames, create_time, update_time FROM automessage_transaction_event insert into automessage_transaction_event ( id, department_id, department_area, classify_id, matter_name, associate_ids, transaction_num, browse_num, basic_information, accept_conditions, application_material, handling_procedures, rates, associate_names, query_time, basic_information_url, accept_conditions_url, application_material_url, handling_procedures_url, rates_url, basic_information_file_name, accept_conditions_file_name, application_material_file_name, handling_procedures_file_name, rates_file_name, operational_guideline_url, operational_guideline_video_url, set_gist, set_gist_url, set_gist_name, common_problem, common_problem_url, common_problem_name, operational_guideline_video_name, operational_guideline_name, transaction_area, transaction_area_url, transaction_area_name, classify_ids, department_ids, update_time, create_time )values( #{id}, #{departmentId}, #{departmentArea}, #{classifyId}, #{matterName}, #{associateIds}, #{transactionNum}, #{browseNum}, #{basicInformation}, #{acceptConditions}, #{applicationMaterial}, #{handlingProcedures}, #{rates}, #{associateNames}, #{queryTime}, #{basicInformationUrl}, #{acceptConditionsUrl}, #{applicationMaterialUrl}, #{handlingProceduresUrl}, #{ratesUrl}, #{basicInformationFileName}, #{acceptConditionsFileName}, #{applicationMaterialFileName}, #{handlingProceduresFileName}, #{ratesFileName}, #{operationalGuidelineUrl}, #{operationalGuidelineVideoUrl}, #{setGist}, #{setGistUrl}, #{setGistName}, #{commonProblem}, #{commonProblemUrl}, #{commonProblemName}, #{operationalGuidelineVideoName}, #{operationalGuidelineName}, #{transactionArea}, #{transactionAreaUrl}, #{transactionAreaName}, #{classifyIds}, #{departmentIds}, sysdate(), sysdate() ) update automessage_transaction_event id=#{id}, department_id=#{departmentId}, department_area=#{departmentArea}, classify_id=#{classifyId}, matter_name=#{matterName}, associate_ids=#{associateIds}, transaction_num=#{transactionNum}, browse_num=#{browseNum}, basic_information=#{basicInformation}, accept_conditions=#{acceptConditions}, application_material=#{applicationMaterial}, handling_procedures=#{handlingProcedures}, rates=#{rates}, associate_names=#{associateNames}, query_time=#{queryTime}, basic_information_url=#{basicInformationUrl}, accept_conditions_url=#{acceptConditionsUrl}, application_material_url=#{applicationMaterialUrl}, handling_procedures_url=#{handlingProceduresUrl}, rates_url=#{ratesUrl}, basic_information_file_name=#{basicInformationFileName}, accept_conditions_file_name=#{acceptConditionsFileName}, application_material_file_name=#{applicationMaterialFileName}, handling_procedures_file_name=#{handlingProceduresFileName}, rates_file_name=#{ratesFileName}, operational_guideline_url=#{operationalGuidelineUrl}, set_gist=#{setGist}, set_gist_url=#{setGistUrl}, set_gist_name=#{setGistName}, common_problem=#{commonProblem}, common_problem_url=#{commonProblemUrl}, common_problem_name=#{commonProblemName}, operational_guideline_video_url=#{operationalGuidelineVideoUrl}, operational_guideline_video_name=#{operationalGuidelineVideoName}, operational_guideline_name=#{operationalGuidelineName}, transaction_area=#{transactionArea}, transaction_area_url=#{transactionAreaUrl}, transaction_area_name=#{transactionAreaName}, classify_ids=#{classifyIds}, department_ids=#{departmentIds}, update_time=sysdate() where id= #{id} delete from automessage_transaction_event where id= #{Id} update automessage_transaction_event browse_num=browse_num+1,query_time=sysdate() matter_name like concat('%', #{matterName}, '%')