首页>代码>spring boot调用mysql存储过程,mysql存储过程分页 调用存储过程分页>/springboot-procedure/src/main/java/com/simon/springbootprocedure/MybatisCommand.java
package com.simon.springbootprocedure; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author Simon */ @Component public class MybatisCommand { @Resource DataMapper dataMapper; @Autowired public void run() { test_exe_procedure(true); // test_exe_procedure(false); } private void test_exe_procedure(boolean callType) { int _pageindex = 1; int _pageSize = 10; String _tables = "employee"; String _fields = "*"; HashMap<String, Object> mm = new HashMap<>(); mm.put("_pageindex", _pageindex); mm.put("_pageSize", _pageSize); mm.put("_tables", _tables); mm.put("_fields", _fields); mm.put("_where", null); mm.put("_orderby", null); mm.put("_sumfields", null); if (callType) { System.out.println("test_exe_procedure1..."); List<Map<String, Object>> result = dataMapper.test_exe_procedure1(mm); for (Map<String, Object> entry : result) { for (Map.Entry<String, Object> data : entry.entrySet()) { System.out.println(data.getKey() + " : " + data.getValue()); } } } else { System.out.println("test_exe_procedure2..."); dataMapper.test_exe_procedure2(mm); } System.out.println("Get _pageindex: " + mm.get("_pageindex")); System.out.println("Get _pageSize: " + mm.get("_pageSize")); System.out.println("Get _tables: " + mm.get("_tables")); System.out.println("Get _fields: " + mm.get("_fields")); System.out.println("Get _totalcount: " + mm.get("_totalcount")); System.out.println("Get _pagecount: " + mm.get("_pagecount")); System.out.println("Get _sumresult: " + mm.get("_sumresult")); return; } }

helloworldsbsb LV8
6月25日
最代码官方 LV168
2023年2月12日

helloworldsbsb LV8
6月25日
xp95323 LV15
6月10日
pxqtsht LV16
2月21日
mengmeng12323423 LV4
2023年6月17日
zhonghua123 LV2
2023年6月13日
1529860026 LV24
2023年6月1日
syczzxj LV10
2023年5月30日
lingtiejing LV15
2023年5月13日
小帅哥 LV2
2023年5月7日
Rd_s20192753
2023年5月2日
暂无贡献等级