赞
踩
SSM后台接受到前台传递过来的数据,后台用List接受,需要在后台判断是否有重复数据。
主要利用了set会去重。
- List<String> mobileList = new ArrayList<String>();
- for (PiaoHouFrontBookInfoFormViewModel p : model.getBookInfoList()) {
- mobileList.add(p.getMobile());
- }
- Set<String> set=new HashSet<String>(mobileList);
- boolean mobileresult= mobileList.size() == set.size() ? true : false;
- if(!mobileresult) {
- //说明有重复手机号
- return JsonResult.jsonWsReturn(Status.ERROR.getCode(), "所有乘客手机号不能重复!",
- Status.ERROR_MSG_BY_SELF.getCode());
- }
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。