/** * @name : registerOk * @date : 2015. 6. 25. * @author : 이명진 * @description : 회원가입시 입력된 데이터를 member 테이블에 저장하기 위한 메소드 */ @Override public int registerOk(MemberDto memberDto) { // TODO Auto-generated method stub if (memberDto.getMemberFileName() != null) { return sqlSession.insert("member.dao.mapper.registerOkFile", memberDto); } else { return sqlSession.insert("member.dao.mapper.registerOk", memberDto); } }
/** * @name : blogWrite * @date : 2015. 7. 02. * @author : 황준 * @description : 블로그 작성 */ @Override public HashMap<String, Object> blogWrite(HashMap<String, Object> hashMap) { logger.info("BoardDao blogWrite DAO-------------------------"); int check = sqlSession.insert("dao.BoardMapper.blogWrite", hashMap); if (check > 0) { check = sqlSession.insert("dao.BoardMapper.blogWrite_addr", hashMap); if (check > 0) { check = sqlSession.insert("dao.BoardMapper.blogWrite_point", hashMap); } } hashMap.put("check", check); return hashMap; }
public static void main(String[] args) throws Exception { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:ApplicationContext.xml"); SqlSessionTemplate template = applicationContext.getBean("sqlSessionTemplate", SqlSessionTemplate.class); FileInputStream stream = new FileInputStream(new File("/Users/yanzhao/Desktop/gg.html")); InputStreamReader reader = new InputStreamReader(stream, "utf-8"); BufferedReader bufferedReader = new BufferedReader(reader); String line = null; Map<String, Content> map = new HashMap<String, Content>(); List<String>[] tcodes = new List[10]; while ((line = bufferedReader.readLine()) != null) { String[] params = line.split(" "); Basedata basedata = new Basedata(); basedata.setCode(params[2]); basedata.setLink(params[0]); basedata.setName(params[1]); basedata.setZs(Long.parseLong(params[4])); basedata.setZsabbre(params[3]); System.out.println(JSON.toJSON(basedata)); template.insert("mybatis/mapper.BasedataMapper.insert", basedata); } }
/** * @함수이름 : infoInsert @작성일 : 2015. 12. 7. @개발자 : 전현준 @함수설명 : xml 파일에 넘겨서 관리자 페이지 회사정보 등록 - (footer * 부분) */ @Override public int infoInsert(AdminInfoDto adminInfoDto) { int value = 0; value = sessionTemplate.insert("dao.adminInfoMapper.infoInsert", adminInfoDto); return value; }
/** * @name : getCoupon * @date : 2015. 7. 15. * @author : 황준 * @description :쿠폰 조회 */ @Override public int getCoupon(String member_id, String coupon_no) { HashMap<String, Object> hMap = new HashMap<String, Object>(); hMap.put("member_id", member_id); hMap.put("coupon_no", coupon_no); return sqlSession.insert("dao.BoardMapper.insertCouponIssue", hMap); }
public void reply_insert(BoardDTO dto) { logger.info("\nBoardDAO class reply_insert(BoardDTO)"); logger.info("BoardDAO replyname = " + dto.getReply_name()); logger.info("BoardDAO replycontent =" + dto.getReply_content()); logger.info("BoardDAO hobby_no =" + dto.getHobby_no()); sqlSession.insert("reply_add", dto); } // end reply_insert
public void dbInsert(BoardDTO dto) { logger.info("\nBoardDAO class dbInsert(BoardDTO)"); logger.info("BoardDAO name = " + dto.getName()); logger.info("BoardDAO title =" + dto.getTitle()); logger.info("BoardDAO content =" + dto.getContent()); logger.info("BoardDAO gender =" + dto.getGender()); logger.info("BoardDAO hobby =" + dto.getHobby()); logger.info("BoardDAO filename=" + dto.getImg_file_name()); sqlSession.insert("add", dto); } // end dbInsert
/** * @name : blogWrite_attach * @date : 2015. 7. 02. * @author : 황준 * @description : 블로그 작성(첨부이미지) */ @Override public int blogWrite_attach(HashMap<String, Object> hashMap) { logger.info("BoardDao blogWrite_attach DAO-------------------------"); ArrayList<Attach_fileDto> attachList = (ArrayList<Attach_fileDto>) hashMap.get("attachList"); logger.info("attachList:" + attachList.size()); for (int i = 0; i < attachList.size(); i++) { logger.info(attachList.get(i).getFile_path()); } int check = sqlSession.insert("dao.BoardMapper.blogWrite_attach", hashMap); return check; }
@Override public void insert(App app) { sqlSession.insert("insertApp", app); }
public void writeLog(CoreModel model, String operateType) { String name = model.getClass().getName(); Map<String, Object> param = new HashMap<String, Object>(); param.put("className", name); param.put("outLog", "Y"); List<Table> tableList = sqlSessionTemplate.selectList( "com.delmar.core.mybatis.sql.TableMapper.selectByExample", param); Table table = null; if (tableList != null && tableList.size() > 0) { table = tableList.get(0); } try { if (table != null) { param = new HashMap<String, Object>(); param.put("tableId", table.getId()); List<TableColumn> tableColumnList = sqlSessionTemplate.selectList( "com.delmar.core.mybatis.sql.TableColumnMapper.selectByExample", param); Map<String, Object> obj = new HashMap<String, Object>(); if (tableColumnList != null) { for (TableColumn column : tableColumnList) { obj.put( column.getAttributeName(), PropertyUtils.getProperty(model, column.getAttributeName())); } } Changelog log = new Changelog(); log.setOperateType(operateType); log.setCreated(new Date()); log.setContext(gson.toJson(obj)); if (request != null) { UserInterface user = (UserInterface) request.getSession().getAttribute("loginUser"); if (user != null) { log.setUserId(user.getId()); log.setUsername(user.getUsername()); } else { String userName = SessionContent.getUserId(Thread.currentThread().getId()); log.setUsername(userName); } } else { String userName = SessionContent.getUserId(Thread.currentThread().getId()); log.setUsername(userName); } Object pk = PropertyUtils.getProperty(model, "id"); if (pk != null) log.setPk((Integer) pk); if (StringUtil.isNotEmpty(table.getBuPk())) { Object buPk = PropertyUtils.getProperty(model, table.getBuPk()); if (buPk != null) log.setBuPk(buPk.toString()); } log.setTableId(table.getId()); sqlSessionTemplate.insert("com.delmar.core.mybatis.sql.ChangelogMapper.insert", log); } } catch (Exception e) { logger.error("插入操作日志异常", e); } }
@Override public void addService(ServicePara servicePara) { sqlSession.insert("addService", servicePara); }
/** * 插入操作 * * @param statement SQL语句的Id号(命名空间+name) * @param parameter 参数 */ public int insert(String statement, Object parameter) { return sqlSession.insert(statement, parameter); }
@Override public int join(String queryId, MemberDTO dto) throws DataAccessException { printQueryId(queryId); return sqlMap.insert("insertMember", dto); }
public void addAppclient(RawAppClientDto app) { sqlSession.insert("appclient.addAppclient", app); }
public Object insert(String queryId, Object params) { printQueryId(queryId); return sqlSession.insert(queryId, params); }
/** * 插入操作 * * @param statement SQL语句的Id号(命名空间+name) */ public int insert(String statement) { return sqlSession.insert(statement); }
/* (non-Javadoc) * @see com.delmar.core.dao.SqlSessionForLog#insert(java.lang.String, java.lang.Object) */ public int insert(String statement, CoreModel model) { int returnvalue = sqlSessionTemplate.insert(statement, model); this.writeLog(model, SessionContent.OPERATE_INSERT); return returnvalue; }
public void insert(Children children) { sqlSession.insert("children.insert"); }
public boolean addImage(Image image) { return sqlSessionTemplate.insert("addImage", image) > 0; }