Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create temporary tables through background in springboot

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to create a temporary table through the background in springboot". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to create a temporary table through the background in springboot" can help you solve the problem.

How to create temporary tables in the background by springboot

In fact, the principle of creating temporary tables is the same as that of adding, deleting, modifying and checking, except that you can write a sql statement to create a temporary table in xml, but not only add, delete, modify and check statements in xml.

1. Get a xml first.

Write a modification header tag in xml. Because you are creating a temporary table, if you want to change the table name, you need to receive a parameter $(tableName) at the table name, and then the xml file will be written.

2. Write the corresponding method in mapper

At this point, you need to add @ Param to the parameters. Only by adding this note can you receive the parameters I passed in xml.

3, and then call this method in the service layer and the Controller layer

Then pass in the desired table name in postman, and the table can be generated.

The creation and deletion of temporary tables under springboot mybatis can be used to check and remove duplicates / * create temporary tables * / @ Update ({"drop temporary table if exists ${tableName};", "create temporary table ${tableName} select doctor_id from crm_speaker where 1x2"}) void createTemoraryTable (@ Param ("tableName") String tableName) / * Save data to temporary table to verify data duplication * / @ Insert ("" + "insert into ${tableName} (doctor_id) values" + "+" ("+" # {doct.doctorId) JdbcType=VARCHAR} "+") void insertBatchCheckDatas (@ Param ("list") List dOs, @ Param ("tableName") String tableName) / * Delete temporary tables * / @ Update ({"drop temporary table if exists ${tableName}"}) void dropTemporaryTable (@ Param ("tableName") String tableName). That's all for "how to create temporary tables through the background in springboot". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report