当前位置:网站首页>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();
}
边栏推荐
- Integrated monitoring solution for power environment of small and medium-sized computer rooms
- #981 Time Based Key-Value Store
- #113 Path Sum II
- EU officially released the data act, Ukraine was attacked by DDoS again, kitchen appliance giant Meiya was attacked, internal data leakage network security weekly
- Data visualization diagram microblog forwarding diagram
- Experiment 7-2-6 print Yanghui triangle (20 points)
- Graphics2D类基本使用
- Teambition 协作应用心得分享|社区征文
- GNS installation and configuration
- Main stages of garbage collection in ZGC
猜你喜欢

@loadbalance annotation of resttemplate

Solution of multi machine room dynamic loop status network touch screen monitoring

Data visualization - biaxial comparison effect

一级指针&二级指针知识点梳理

#113 Path Sum II

Experiment 7-2-6 print Yanghui triangle (20 points)

Lake shore PT-100 platinum resistance temperature sensor

leetcode:207. 课程表

leetcode:210. 课程表 II

#141 Linked List Cycle
随机推荐
Rearrangement exercises
Experiment 7-2-6 print Yanghui triangle (20 points)
The Post-00 financial woman with a monthly salary of 2W conquered the boss with this set of report template
InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY EB3E94ADBE1229CF
Ubuntu16.04 completely delete MySQL database
Gather function in pytorch_
同花顺能开户吗,在APP上可以直接开通券商安全吗
Lake shore PT-100 platinum resistance temperature sensor
同花顺能开户吗,在APP上可以直接开通券商安全吗 ,证券开户怎么开户流程
GPU giant NVIDIA suffered a "devastating" network attack, and the number one malware shut down its botnet infrastructure | global network security hotspot on February 28
Understanding of functions
remote: Support for password authentication was removed on August 13, 2021
USB机械键盘改蓝牙键盘
torch. unique()
Delphi XE7的蓝牙 Bluetooth
The salted fish has been transmitted for 5W times, and the latest spring recruit face-to-face test questions of bytes have been leaked
Introduction to the characteristics of balancer decentralized exchange market capitalization robot
Solution of multi machine room dynamic loop status network touch screen monitoring
Product Manager: "click here to jump to any page I want to jump" -- decoupling efficiency improving artifact "unified hop routing"
Is it safe to open an account in flush? How to open an account online to buy stocks