Get the App
SLTechnology News&Howtos  ›  Development  › 

How to create temporary tables through background in springboot

Shulou Source: shulou.com Published: 2022-06-01 01:31:29 10月16日 Update

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.

Tags: Background parameters methods knowledge data annotations industries statements different practical next content principles but only practical practical files articles are in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Apple MySQL Xiaomi vpn