for(BacChargeitemModel model : models){            
            //状态为修改或状态为新增
            if(model.getSystemStatus()==null||model.getSystemStatus().equals("0")){    
                //先针对collection中的对象进行查重
                int duplicateCount = 0;
                for(BacChargeitemModel modelOther : models){
                    if(modelOther.getSystemStatus()==null||modelOther.getSystemStatus().equals("0")){
                    if(model.getChargeCode().equals(modelOther.getChargeCode())){
                        duplicateCount++;
                    }
                    }
                }
                if(duplicateCount > 1){
                    throw new RuntimeException(model.getChargeCode()+"重复,请重试");
                }        
                //再对比数据库中的数据进行查重
                Number num = 0;
                String sql = "select count(*) from BAC_CHARGEITEM where CHARGE_CODE = ?";
                num = sqlDao.queryScalar(sql, model.getChargeCode());
                if(num.intValue()>0){
                    throw new RuntimeException(model.getChargeCode()+"重复,请重试");
                }
            }    
        }