做的一个手机app后台接口,网页上测试是ok的,但是手机端注册会报已经被注册,但是数据库是没有那条数据的,以下是代码:
@RequestMapping(value = "add")
@ResponseBody
public Map<String,Object> add(HttpServletRequest httpServletRequest,String mobile,String password){
MemberQuery query=new MemberQuery();
query.setMobile(mobile);
List<Member> memberList = this.memberService.queryMember(query);
Map<String,Object> result = new HashMap<String, Object>();
if (memberList != null && memberList.size() > 0){
result.put("error","注册失败,此用户名已被使用!");
result.put("status",2);
return result;
}
Member member=new Member();
member.setPassword(password);
member.setMobile(mobile);
this.memberService.addMember(member);
String account = "QY-" + String.format("%05d", member.getId());//根据会员id生成会员账号 QY-00001
member.setAccount(account);
memberService.updateMember(member);
result.put("result","注册成功!");
result.put("status",1);
return result;
}
相关分类