wt_userlogin.xml :xml对sql进行操作
通过手机号查询身份证信息
<!-- 通过手机号查询身份证信息2018-01-29李雨佳 -->
<select id="queryInfoByUserName" parameterClass="java.util.Map" resultClass="java.util.HashMap">
select code,
username,
realname,
userid,
from cms_user
where username=#username#//手机号
</select>
MemberService.java 接口
//通过手机号查询身份证号2018-01-29
public Map queryIdcard(Map<String, String> inMap) throws Exception;
}
MemberServiceImpl.java 实现类
//通过手机号查询身份证号
public Map queryIdcard(Map<String, String> inMap) throws Exception{
List list = dao.queryForList("wt_userlogin.queryInfoByUserName", inMap);
Map outMap = new HashMap();
if(list.size()==1){
outMap.putAll((Map)list.get(0));
outMap.put("code","1");
}else {
if(list.size()<1){
outMap.put("msg", "该手机号未注册,请注册后再进行登录");
}else{
outMap.put("msg", "该手机号对应"+list.size()+"条用户信息");
}
outMap.put("code", "-1");
}
return outMap;
}
}