Search in sources :

Example 1 with MemberDao2

use of com.bitcamp.mvc.dao.MemberDao2 in project bitcampSCOpen2017 by ryuyj.

the class MemberFindByEmailService method findByEmail.

@Transactional
public Member findByEmail(String email) {
    dao = sqlSessionTemplate.getMapper(MemberDao2.class);
    Member member = dao.selectByEmail(email);
    if (member == null) {
        throw new MemberNotFoundException("회원 없음 : " + email);
    }
    return member;
}
Also used : MemberDao2(com.bitcamp.mvc.dao.MemberDao2) Member(com.bitcamp.mvc.model.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with MemberDao2

use of com.bitcamp.mvc.dao.MemberDao2 in project bitcampSCOpen2017 by ryuyj.

the class MemberDeleteService method delete.

@Transactional
public String delete(Long id) {
    dao = sqlSessionTemplate.getMapper(MemberDao2.class);
    Member member = dao.selectById(id);
    if (member == null) {
        throw new MemberNotFoundException("회원 없음 : " + id);
    }
    dao.deleteMember(id);
    return member.getPhoto();
}
Also used : MemberDao2(com.bitcamp.mvc.dao.MemberDao2) Member(com.bitcamp.mvc.model.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with MemberDao2

use of com.bitcamp.mvc.dao.MemberDao2 in project bitcampSCOpen2017 by ryuyj.

the class MemberFindByIdService method findById.

@Transactional
public Member findById(Long id) {
    dao = sqlSessionTemplate.getMapper(MemberDao2.class);
    Member member = dao.selectById(id);
    if (member == null) {
        throw new MemberNotFoundException("회원 없음 : " + id);
    }
    return member;
}
Also used : MemberDao2(com.bitcamp.mvc.dao.MemberDao2) Member(com.bitcamp.mvc.model.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with MemberDao2

use of com.bitcamp.mvc.dao.MemberDao2 in project bitcampSCOpen2017 by ryuyj.

the class MemberLoginService method login.

@Transactional
public Member login(LoginRequest req) {
    dao = sqlSessionTemplate.getMapper(MemberDao2.class);
    Member member = dao.selectByEmail(req.getEmail());
    if (member == null) {
        throw new MemberNotFoundException("회원 없음 : " + req.getEmail());
    }
    if (!member.checkPassword(req.getPassword())) {
        throw new IdPasswordNotMatchingException("비밀번호 다름");
    }
    return member;
}
Also used : MemberDao2(com.bitcamp.mvc.dao.MemberDao2) Member(com.bitcamp.mvc.model.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with MemberDao2

use of com.bitcamp.mvc.dao.MemberDao2 in project bitcampSCOpen2017 by ryuyj.

the class MemberRegisterService method register.

@Transactional
public Member register(RegisterRequest req) {
    dao = sqlSessionTemplate.getMapper(MemberDao2.class);
    Member member = dao.selectByEmail(req.getEmail());
    if (member != null) {
        throw new AlreadyExistingMemberException("이메일 중복 : " + req.getEmail());
    }
    member = req.toMember();
    dao.insertMember(member);
    return member;
}
Also used : MemberDao2(com.bitcamp.mvc.dao.MemberDao2) Member(com.bitcamp.mvc.model.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

MemberDao2 (com.bitcamp.mvc.dao.MemberDao2)6 Member (com.bitcamp.mvc.model.Member)6 Transactional (org.springframework.transaction.annotation.Transactional)6