Search in sources :

Example 6 with TbMember

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;
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember) XmallException(cn.exrick.common.exception.XmallException) Date(java.util.Date)

Example 7 with TbMember

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;
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember)

Example 8 with TbMember

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;
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember) TbMemberExample(cn.exrick.manager.pojo.TbMemberExample) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 9 with TbMember

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;
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember) TbMemberExample(cn.exrick.manager.pojo.TbMemberExample) XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 10 with TbMember

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;
}
Also used : TbMember(cn.exrick.manager.pojo.TbMember)

Aggregations

TbMember (cn.exrick.manager.pojo.TbMember)17 XmallException (cn.exrick.common.exception.XmallException)12 TbMemberExample (cn.exrick.manager.pojo.TbMemberExample)5 Date (java.util.Date)5 DataTablesResult (cn.exrick.common.pojo.DataTablesResult)2 Member (cn.exrick.manager.dto.front.Member)2 PageInfo (com.github.pagehelper.PageInfo)2 Gson (com.google.gson.Gson)2