/** * 自动呼叫导入更新拨打状态 * @throws BaseBizException */ public void autoImportState(String tableName) throws BaseBizException{ StringBuilder sql = new StringBuilder(); try { if (tableName != null && !tableName.equals("")) { sql.append(" update hp_accounts"); sql.append(" set auto_result1=("); sql.append(" case when a.CALL_RESULT1 in(1,2,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,4106,4128,4353,4356,4882) then '10200'"); sql.append(" when a.CALL_RESULT1 in(5,6,4102,4640) then '10600' end),"); sql.append(" auto_result2=("); sql.append(" case when a.CALL_RESULT2 in(1,2,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,4106,4128,4353,4356,4882) then '10200'"); sql.append(" when a.CALL_RESULT2 in(5,6,4102,4640) then '10600' end),"); sql.append(" auto_result3=("); sql.append(" case when a.CALL_RESULT3 in(1,2,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,4106,4128,4353,4356,4882) then '10200'"); sql.append(" when a.CALL_RESULT3 in(5,6,4102,4640) then '10600' end),"); sql.append(" auto_result4=("); sql.append(" case when a.CALL_RESULT4 in(1,2,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,4106,4128,4353,4356,4882) then '10200'"); sql.append(" when a.CALL_RESULT4 in(5,6,4102,4640) then '10600' end)"); sql.append(" from ").append(snt.hpcc.util.Constant.DATE_NAME).append(".dbo.").append(tableName).append(" a"); sql.append(" where a.ACCOUNT_ID = hp_accounts.pk_id"); } } catch (DataAccessException e) { log.error(e,e); throw new BaseBizException("数据库访问出错",e); } this.getCommonDAO().update(sql.toString());// getCommonDAO()链接的是其中一个库那么上面另一个库的表前面就要加上" 库名.dbo.",库名最好写在一个实体里 }