当前位置:网站首页>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();
}
边栏推荐
- Cookies and sessions
- Research Report on market supply and demand and strategy of hydraulic operating table industry in China
- Market trend report, technical innovation and market forecast of hydraulic chain hoist in China
- Pointer and array & pointer and const & struct and Const
- The Post-00 financial woman with a monthly salary of 2W conquered the boss with this set of report template
- Cv2.lut() (populates the output array with values from the lookup table)
- Mxnet record IO details
- Limit of advanced mathematics
- My way of programming
- Delphi XE7的蓝牙 Bluetooth
猜你喜欢
A high-value MySQL management tool
String Basics
leetcode:210. 課程錶 II
Introduction to the characteristics of balancer decentralized exchange market capitalization robot
Data visualization diagram microblog forwarding diagram
Mxnet record IO details
My way of programming
Fill in the checklist & lt; int> Have default values? [repeat] - fill list & lt; int> with default values? [duplicate]
nn. PReLU(planes)
一级指针&二级指针知识点梳理
随机推荐
atoi超强解析
初步了解认识正则表达式(Regex)
String Basics
Solution of good number pairs
Pytoch distributed training error
Pytorch how to set random number seed to make the result repeatable
Binary search
同花顺能开户吗,在APP上可以直接开通券商安全吗 ,买股票怎么网上开户
递归调用知识点-包含例题求解二分查找、青蛙跳台阶、逆序输出、阶乘、斐波那契、汉诺塔。
好数对的求解
Distributed cloud service developer'allegro Xile technology 'received an angel round financing of US $3million
New product release Junda intelligent integrated environmental monitoring terminal
leetcode:210. Schedule II
RestTemplate的@LoadBalance注解
CUDA out of memory
字符串基础知识
Digital intelligence data depth | Bi goes down the altar? It's not that the market has declined, it's that the story has changed
Rearrangement exercises
选择排序
有向图深拷贝