@Repositorypublic class MyDaoImpl extends JdbcDaoSupport implements MyDao { @Autowired private DataSource dataSource; @PostConstruct private void initialize() { setDataSource(dataSource); } public void In(String user, double money) { String sql = "update account set money = money + " + money + " where name=‘" + user + "‘"; this.getJdbcTemplate().update(sql); } public void Out(String user, double money) { String sql = "update account set money = money - ? where name=?"; this.getJdbcTemplate().update(sql, money, user); }}
备忘于此
时间: 2024-11-05 23:28:35