Search in sources :

Example 11 with Member

use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.

the class MemberUpdateService method update.

@Transactional
public void update(UpdateRequest req) {
    dao = sqlSessionTemplate.getMapper(MemberDao2.class);
    Member member = dao.selectById(req.getId());
    if (member == null) {
        throw new MemberNotFoundException("회원 없음 : " + req.getId());
    }
    dao.updateMember(req.toMember());
}
Also used : MemberDao2(com.bitcamp.mvc.dao.MemberDao2) Member(com.bitcamp.mvc.model.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with Member

use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.

the class MemberListXlsView method buildExcelDocument.

@SuppressWarnings("unchecked")
@Override
protected void buildExcelDocument(Map<String, Object> model, HSSFWorkbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception {
    HSSFSheet sheet = createFirstSheet(workbook);
    createColumnLabel(sheet);
    List<Member> memberList = (List<Member>) model.get("memberListXls");
    int rowNum = 1;
    for (Member member : memberList) {
        createMemberListRow(sheet, member, rowNum++);
    }
    String fileName = "memberList.xls";
    response.setContentType("Application/Msexcel");
    response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";");
}
Also used : HSSFSheet(org.apache.poi.hssf.usermodel.HSSFSheet) List(java.util.List) Member(com.bitcamp.mvc.model.Member)

Example 13 with Member

use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.

the class MemberUpdateController method update.

@RequestMapping(value = "/member/update/{id}", method = RequestMethod.POST)
public String update(@PathVariable("id") Long memId, UpdateRequest updateRequest, RedirectAttributes redirectAttributes, HttpServletRequest request) throws Exception {
    // 이메일 주소 얻기
    Member member = memberFindByIdService.findById(memId);
    // 업로드 폴더 시스템 물리적 경로 찾기
    String uploadURI = "/uploadfile/memberphoto";
    String dir = request.getSession().getServletContext().getRealPath(uploadURI);
    // 업로드 파일의 물리적 저장
    if (!updateRequest.getPhotofile().isEmpty()) {
        updateRequest.getPhotofile().transferTo(new File(dir, member.getEmail()));
    }
    memberUpdateService.update(updateRequest);
    redirectAttributes.addFlashAttribute("SUCCESS_MSG", memId + "번 회원 수정 성공");
    return "redirect:/member/list";
}
Also used : Member(com.bitcamp.mvc.model.Member) File(java.io.File) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with Member

use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.

the class MemberUpdateController method form.

@RequestMapping(value = "/member/update/{id}", method = RequestMethod.GET)
public String form(@PathVariable("id") Long memId, Model model) {
    Member member = memberFindByIdService.findById(memId);
    model.addAttribute("name", member.getName());
    model.addAttribute("id", memId);
    return "member/memberUpdateForm";
}
Also used : Member(com.bitcamp.mvc.model.Member) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with Member

use of com.bitcamp.mvc.model.Member in project bitcampSCOpen2017 by ryuyj.

the class MemberRowMapper method mapRow.

@Override
public Member mapRow(ResultSet rs, int rowNum) throws SQLException {
    Member member = new Member(rs.getString("EMAIL"), rs.getString("PASSWORD"), rs.getString("NAME"), rs.getTimestamp("REGDATE"), rs.getString("PHOTO"));
    member.setId(rs.getLong("ID"));
    return member;
}
Also used : Member(com.bitcamp.mvc.model.Member)

Aggregations

Member (com.bitcamp.mvc.model.Member)15 MemberDao2 (com.bitcamp.mvc.dao.MemberDao2)6 Transactional (org.springframework.transaction.annotation.Transactional)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 File (java.io.File)2 ObjectError (org.springframework.validation.ObjectError)2 MemberListXml (com.bitcamp.mvc.model.MemberListXml)1 MemberXml (com.bitcamp.mvc.model.MemberXml)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Cookie (javax.servlet.http.Cookie)1 HSSFSheet (org.apache.poi.hssf.usermodel.HSSFSheet)1