当前位置:网站首页>Jdbctemplate inserts and returns the primary key
Jdbctemplate inserts and returns the primary key
2022-06-12 21:26:00 【Besieged city_ city with high walls】
public static int getMemberId(JdbcTemplate jdbcTemplate, int orgId) {
KeyHolder keyHolder = new GeneratedKeyHolder();
jdbcTemplate.update(con -> {
String sql="INSERT INTO t_g_primarykey(ord_id,create_time,day_time) VALUES(?,?,?)";
PreparedStatement ps = con.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS);
ps.setInt(1, orgId);
ps.setLong(2, ComDateUtils.getUnixCurrTime());
ps.setLong(3,DateUtil.getTodayZeroTimeTemp());
return ps;
}, keyHolder);
return Optional.ofNullable(keyHolder.getKey()).orElse(0).intValue();
}
边栏推荐
- Ubuntu16.04 completely delete MySQL database
- Cookies and sessions
- The service did not report any errors MySQL
- The year of the outbreak of financial innovation! All dtinsight products of kangaroo cloud data stack have passed the special test of Xinchuang of ICT Institute
- Solve one-dimensional array prefix sum
- Li Mu [practical machine learning] 1.4 data annotation
- Data visualization - histogram
- Recursively call knowledge points - including example solving binary search, frog jumping steps, reverse order output, factorial, Fibonacci, Hanoi tower.
- 居家办公期间如何提升沟通效率|社区征文
- Library cache lock brought by add trandata
猜你喜欢

Teamwork collaboration application experience sharing | community essay solicitation

GNS安装与配置

leetcode:210. 课程表 II

What's a good gift for the goddess Festival? Gift recommendation for the goddess Festival on March 8

leetcode:210. 課程錶 II

Leetcode: 210. Programme II

ASCII 码对照表

shell语言

阅读笔记 Deep Hough Voting for 3D Object Detection in Point Clouds

Product Manager: "click here to jump to any page I want to jump" -- decoupling efficiency improving artifact "unified hop routing"
随机推荐
在同花顺开户安全么,买股票怎么网上开户
Leetcode: 210. Programme II
#113 Path Sum II
New product release Junda intelligent integrated environmental monitoring terminal
[leetcode] 573 complex multiplication (conversion between characters and numbers)
Main stages of garbage collection in ZGC
test
Can flush open an account? Can you directly open the security of securities companies on the app
Bubble sort
重排数列练习题
Lake shore PT-100 platinum resistance temperature sensor
#886 Possible Bipartition
CUDA out of memory
有向图深拷贝
Lua pattern matching
China hydraulic cylinder linear position sensor market trend report, technical dynamic innovation and market forecast
指针与数组&指针与const&结构体与const
Is it safe to open an account in flush? How to open an account online to buy stocks
Delphi XE7的蓝牙 Bluetooth
Data visualization diagram microblog forwarding diagram