spring+mybatis 简单实例图书管理系统

mybatis 简单实例图书管理系统
多多提提意见,大家一起分享!!!!!!共同进步
package com.dou.book.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.dou.book.data.services.IBookServices;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings({ "unchecked", "serial" })
public class GoAction extends ActionSupport {
	@Autowired
	IBookServices booksServices;
	private List booksTypeList;
	public List getBooksTypeList() {
		return booksTypeList;
	}
	public void setBooksTypeList(List booksTypeList) {
		this.booksTypeList = booksTypeList;
	}
	public String execute() throws Exception {
		ActionContext act=ActionContext.getContext();
		act.getSession().put("ALL_BOOK_TYPE", booksServices.getAllBookType());	
		return SUCCESS;
	}
	


}

研究MYBATIS 整合问题

 

sql

CREATE TABLE `tb_book` (
  `BOOK_ID` INTEGER(11) NOT NULL AUTO_INCREMENT,
  `TYPE_ID` INTEGER(11) NOT NULL,
  `BOOK_TITLE` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
  `BOOK_AUTHOR` VARCHAR(20) COLLATE utf8_general_ci DEFAULT NULL,
  `BOOK_TOTAL` INTEGER(11) DEFAULT NULL,
  `BOOK_PRICE` FLOAT DEFAULT NULL,
  `BOOK_ISBN` VARCHAR(20) COLLATE utf8_general_ci DEFAULT NULL,
  `BOOK_PUBLISHER` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
  PRIMARY KEY (`BOOK_ID`)
)ENGINE=InnoDB
AUTO_INCREMENT=25 CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
COMMENT='InnoDB free: 11264 kB; InnoDB free: 11264 kB';

CREATE TABLE `tb_book_type` (
  `TYPE_ID` INTEGER(11) NOT NULL AUTO_INCREMENT,
  `TYPE_NAME` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
  `TYPE_DESC` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
  `CREATE_DATE` DATE DEFAULT NULL,
  `CREATE_BY` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
  PRIMARY KEY (`TYPE_ID`)
)ENGINE=InnoDB
AUTO_INCREMENT=25 CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
COMMENT='InnoDB free: 11264 kB; InnoDB free: 11264 kB';

 

你可能感兴趣的:(mybatis)