开发者社区 问答 正文

Spring中 jdbctemplate中如何传递参数

private JdbcTemplate jt = null;

    public void setDataSource(DataSource dataSource) {
        jt = new JdbcTemplate(dataSource);
    }

 public void updateEmp(String task_id,String empid) throws Exception {
        String[] aa = empid.split(", ");
        String temp = null;
        for(int i = 0;i<aa.length;i++){
            String te="'"+aa[i]+"'";
            temp = te+","+temp;
            System.out.println(temp);
        }
        String sql = "update jmp_tb_task set  status=2 where task_id =? and empid in ("+temp+") and review=1";
        jt.update(sql,new Object[]{task_id,empid});
    }

这样传参有什么问题,为什么就是不执行

展开
收起
小旋风柴进 2016-03-04 13:58:45 4071 分享 版权
0 条回答
写回答
取消 提交回答