@Override
public Integer UpdateOrgManage(String orgName, String bindNo, String fromUserName, String wxName) {
KeyHolder key=new GeneratedKeyHolder();
jdbcTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
String sql="update sm_org set wx_open_id=?,wx_name=? where bind_no=? and name=?";
PreparedStatement preState=con.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
preState.setString(1,fromUserName);
preState.setString(2,wxName);
preState.setString(3,bindNo);
preState.setString(4,orgName);
return preState;
}
}, key);
//从主键持有者中获得主键值
return key.getKeys().get("id");
}
网友评论