use of cn.exrick.manager.pojo.TbMember in project xmall by Exrick.
the class RegisterServiceImpl method register.
@Override
public int register(String userName, String userPwd) {
TbMember tbMember = new TbMember();
tbMember.setUsername(userName);
if (userName.isEmpty() || userPwd.isEmpty()) {
// 用户名密码不能为空
return -1;
}
boolean result = checkData(userName, 1);
if (!result) {
// 该用户名已被注册
return 0;
}
// MD5加密
String md5Pass = DigestUtils.md5DigestAsHex(userPwd.getBytes());
tbMember.setPassword(md5Pass);
tbMember.setState(1);
tbMember.setCreated(new Date());
tbMember.setUpdated(new Date());
if (tbMemberMapper.insert(tbMember) != 1) {
throw new XmallException("注册用户失败");
}
return 1;
}
use of cn.exrick.manager.pojo.TbMember in project xmall by Exrick.
the class MemberServiceImpl method getMemberByEditPhone.
@Override
public TbMember getMemberByEditPhone(Long id, String phone) {
TbMember tbMember = getMemberById(id);
TbMember newTbMember = null;
if (tbMember.getPhone() == null || !tbMember.getPhone().equals(phone)) {
newTbMember = getMemberByPhone(phone);
}
newTbMember.setPassword("");
return newTbMember;
}
use of cn.exrick.manager.pojo.TbMember in project xmall by Exrick.
the class MemberServiceImpl method getMemberByUsername.
@Override
public TbMember getMemberByUsername(String username) {
List<TbMember> list;
TbMemberExample example = new TbMemberExample();
TbMemberExample.Criteria criteria = example.createCriteria();
criteria.andUsernameEqualTo(username);
try {
list = tbMemberMapper.selectByExample(example);
} catch (Exception e) {
throw new XmallException("ID获取会员信息失败");
}
if (!list.isEmpty()) {
list.get(0).setPassword("");
return list.get(0);
}
return null;
}
use of cn.exrick.manager.pojo.TbMember in project xmall by Exrick.
the class MemberServiceImpl method getMemberByPhone.
@Override
public TbMember getMemberByPhone(String phone) {
List<TbMember> list;
TbMemberExample example = new TbMemberExample();
TbMemberExample.Criteria criteria = example.createCriteria();
criteria.andPhoneEqualTo(phone);
try {
list = tbMemberMapper.selectByExample(example);
} catch (Exception e) {
throw new XmallException("Phone获取会员信息失败");
}
if (!list.isEmpty()) {
list.get(0).setPassword("");
return list.get(0);
}
return null;
}
use of cn.exrick.manager.pojo.TbMember in project xmall by Exrick.
the class MemberServiceImpl method getMemberByEditUsername.
@Override
public TbMember getMemberByEditUsername(Long id, String username) {
TbMember tbMember = getMemberById(id);
TbMember newTbMember = null;
if (tbMember.getUsername() == null || !tbMember.getUsername().equals(username)) {
newTbMember = getMemberByUsername(username);
}
newTbMember.setPassword("");
return newTbMember;
}
Aggregations