maven+nexus+spring+springmvc+mybatis+generator+mysql搭建框架

1 pom.xml 里边有详尽的注释
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<!--项目或者组织的唯一标志,并且配置时生成路径也是由此生成,如com.test生成的相对路径为:/com/test -->
	<groupId>com.test</groupId>
	<!-- 项目的通用名称 -->
	<artifactId>TEST</artifactId>
	<!-- 打包机制,如pom,jar,maven-plugin,ejb,war,ear,rar,par -->
	<packaging>war</packaging>
	<!-- 项目的版本 -->
	<version>0.0.1-SNAPSHOT</version>
	<!-- 用户描述项目的名称,无关紧要的东西,可选 -->
	<name>李禚制作</name>
	<!-- 应该是只是写明开发团队的网站,无关紧要,可选 -->
	<url>http://maven.apache.org</url>

	<properties>
		<!-- spring版本号 -->
		<spring.version>4.0.2.RELEASE</spring.version>
		<!-- mybatis版本号 -->
		<mybatis.version>3.2.6</mybatis.version>
		<!-- log4j日志文件管理包版本 -->
		<slf4j.version>1.7.7</slf4j.version>
		<log4j.version>1.2.17</log4j.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<!-- 表示开发的时候引入,发布的时候不会加载此包 -->
			<scope>test</scope>
		</dependency>
		<!-- spring核心包 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-oxm</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- mybatis核心包 -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>${mybatis.version}</version>
		</dependency>
		<!-- mybatis/spring包 -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.2.2</version>
		</dependency>
		<!-- 导入java ee jar 包 -->
		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-api</artifactId>
			<version>7.0</version>
		</dependency>
		<!-- 导入Mysql数据库链接jar包 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.30</version>
		</dependency>
		<!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 -->
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.2.2</version>
		</dependency>
		<!-- JSTL标签类 -->
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		
		<!-- 映入JSON -->
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-asl</artifactId>
			<version>1.9.13</version>
		</dependency>
		<!-- 上传组件包 -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3.1</version>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.4</version>
		</dependency>
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.9</version>
		</dependency>

		<!-- 日志文件管理包 -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
		</dependency>


		<!-- 格式化对象,方便输出日志 -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>fastjson</artifactId>
			<version>1.1.41</version>
		</dependency>


		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
	</dependencies>



	<build>
		<!-- 指定去掉后缀的工程名字 -->
		<finalName>test</finalName>

		<plugins>
			<!-- 配置jdk版本 如果不配置build的时候jdk会变成1.5 不知道为什么 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<!-- 配置mybatis的generator用来实现数据库生成实体类dao层和mapper -->
			<plugin>
				<groupId>org.mybatis.generator</groupId>
				<artifactId>mybatis-generator-maven-plugin</artifactId>
				<version>1.3.2</version>
				<configuration>
					<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
					<verbose>true</verbose>
					<overwrite>true</overwrite>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<distributionManagement>
		<!-- 用于连接nexus私服  -->
		<!-- 两个ID必须与 setting.xml中的<server><id>nexus-releases</id></server>保持一致 -->
		<repository>
			<id>nexus-releases</id>
			<name>Nexus Release Repository</name>
			<url>http://192.168.2.22:8081/nexus/content/repositories/releases</url>
		</repository>
		<snapshotRepository>
			<id>nexus-snapshots</id>
			<name>Nexus Snapshot Repository</name>
			<url>http://192.168.2.22:8081/nexus/content/repositories/snapshots</url>
		</snapshotRepository>
	</distributionManagement>


</project>

2 springmvc.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd  
                        http://www.springframework.org/schema/context  
                        http://www.springframework.org/schema/context/spring-context-3.1.xsd  
                        http://www.springframework.org/schema/mvc  
                        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
    <!-- 自动扫描该包,使SpringMVC认为包下用了@controller注解的类是控制器 -->
    <context:component-scan base-package="com" />
    <!--避免IE执行AJAX时,返回JSON出现下载文件 -->
    <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
        <property name="supportedMediaTypes">
            <list>
                <value>text/html;charset=UTF-8</value>
            </list>
        </property>
    </bean>
    <!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <property name="messageConverters">
            <list>
                <ref bean="mappingJacksonHttpMessageConverter" />    <!-- JSON转换器 -->
            </list>
        </property>
    </bean>
    <!-- 定义跳转的文件的前后缀 ,视图模式配置-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!-- 这里的配置我的理解是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 -->
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
    
    <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 -->
    <bean id="multipartResolver"  
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">  
        <!-- 默认编码 -->
        <property name="defaultEncoding" value="utf-8" />  
        <!-- 文件大小最大值 -->
        <property name="maxUploadSize" value="10485760000" />  
        <!-- 内存中的最大值 -->
        <property name="maxInMemorySize" value="40960" />  
    </bean> 

</beans>
3 web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>Archetype Created Web Application</display-name>
  <!-- 引入classpath:spring-mybatis.xml -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring-mybatis.xml</param-value>
  </context-param>
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <async-supported>true</async-supported>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
  </listener>
  <servlet>
    <servlet-name>SpringMVC</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:spring-mvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
  </servlet>
  <servlet-mapping>
    <servlet-name>SpringMVC</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>/index.jsp</welcome-file>
  </welcome-file-list>
  <session-config>
    <session-timeout>15</session-timeout>
  </session-config>
</web-app>
4spring-mybatis.xml 定义了多个数据源 用于动态切换
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd  
                        http://www.springframework.org/schema/context  
                        http://www.springframework.org/schema/context/spring-context-3.1.xsd  
                        http://www.springframework.org/schema/mvc  
                        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
	<!-- 引入配置文件 -->
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:jdbc.properties" />
	</bean>
	<!-- 引入多个数据源 -->
	<!-- 基本数据源 -->
	<bean id="base" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="${driver}"></property>
		<property name="url" value="${url}"></property>
		<property name="username" value="${username}"></property>
		<property name="password" value="${password}"></property>
	</bean>
	<!-- cms数据源 -->
	<bean id="cms" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="${driver_cms}"></property>
		<property name="url"
			value="${url_cms}"></property>
		<property name="username" value="${username_cms}"></property>
		<property name="password" value="${password_cms}"></property>
	</bean>
	<!-- 商城数据源 -->
	<bean id="mall" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="${driver}"></property>
		<property name="url" value="${url}"></property>
		<property name="username" value="${username}"></property>
		<property name="password" value="${password}"></property>
	</bean>
	<!-- 资源库数据源 -->
	<bean id="resource" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="${driver}"></property>
		<property name="url" value="${url}"></property>
		<property name="username" value="${username}"></property>
		<property name="password" value="${password}"></property>
	</bean>
	<!-- 在线教育数据源 -->
	<bean id="exam" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="${driver}"></property>
		<property name="url" value="${url}"></property>
		<property name="username" value="${username}"></property>
		<property name="password" value="${password}"></property>
	</bean>

	<bean id="dataSource" class="com.base.datasource.DynamicDataSource">
		<property name="targetDataSources">
			<map key-type="java.lang.String">
				<entry value-ref="base" key="base"></entry>
				<entry value-ref="cms" key="cms"></entry>
				<entry value-ref="mall" key="mall"></entry>
				<entry value-ref="resource" key="resource"></entry>
				<entry value-ref="exam" key="exam"></entry>
			</map>
		</property>
		<!-- 默认使用base的数据源 -->
		<property name="defaultTargetDataSource" ref="base"></property>      
	</bean>

<!-- 	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="${driver}" />
		<property name="url" value="${url}" />
		<property name="username" value="${username}" />
		<property name="password" value="${password}" />
		初始化连接大小
		<property name="initialSize" value="${initialSize}"></property>
		连接池最大数量
		<property name="maxActive" value="${maxActive}"></property>
		连接池最大空闲
		<property name="maxIdle" value="${maxIdle}"></property>
		连接池最小空闲
		<property name="minIdle" value="${minIdle}"></property>
		获取连接最大等待时间
		<property name="maxWait" value="${maxWait}"></property>
	</bean> -->

	<!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<!-- 自动扫描mapping.xml文件 -->
		<property name="mapperLocations" value="classpath:com/*/mapping/*.xml"></property>
	</bean>

	<!-- DAO接口所在包名,Spring会自动查找其下的类 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.base.dao,com.cms.dao,com.mall.dao,com.resource.dao,com.exma.dao" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
	</bean>

	<!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

</beans>
4 jdbc.properties 定义数据库连接的一些基本信息
#基础连接数据库
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/base
username=root
password=root
#cms连接数据库
driver_cms=com.mysql.jdbc.Driver
url_cms=jdbc:mysql://localhost:3306/cms
username_cms=root
password_cms=root
#商城连接数据库
driver_mall=com.mysql.jdbc.Driver
url_mall=jdbc:mysql://localhost:3306/mall
username_mall=root
password_mall=root
#资源库连接数据库
driver_resource=com.mysql.jdbc.Driver
url_resource=jdbc:mysql://localhost:3306/resource
username_resource=root
password_resource=root
#在线教育连接数据库
driver_exam=com.mysql.jdbc.Driver
url_exam=jdbc:mysql://localhost:3306/exam
username_exam=root
password_exam=root
#定义初始连接数
initialSize=0
#定义最大连接数
maxActive=20
#定义最大空闲
maxIdle=20
#定义最小空闲
minIdle=1
#定义最长等待时间
maxWait=60000

5log4j.properties

#定义LOG输出级别
log4j.rootLogger=INFO,Console,File
#定义日志输出目的地为控制台
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.Target=System.out
#可以灵活地指定日志输出格式,下面一行是指定具体的格式
log4j.appender.Console.layout = org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%c] - %m%n

#文件大小到达指定尺寸的时候产生一个新的文件
log4j.appender.File = org.apache.log4j.RollingFileAppender
#指定输出目录
log4j.appender.File.File = logs/ssm.log
#定义文件最大大小
log4j.appender.File.MaxFileSize = 10MB
# 输出所以日志,如果换成DEBUG表示输出DEBUG以上级别日志
log4j.appender.File.Threshold = ALL
log4j.appender.File.layout = org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern =[%p] [%d{yyyy-MM-dd HH\:mm\:ss}][%c]%m%n

6generatorConfiger.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>
	<!-- 引入配置文件 -->
	<properties resource="generator.properties" />
	<!-- 指定数据连接驱动jar地址 -->
	<classPathEntry location="${classPath}" />
	<!-- 一个数据库一个context -->
	<context id="base" targetRuntime="MyBatis3">
		<commentGenerator>
			<property name="suppressDate" value="false" />
			<property name="suppressAllComments" value="true" />
		</commentGenerator>

		<jdbcConnection driverClass="${jdbc_driver}"
			connectionURL="${jdbc_url}" userId="${jdbc_user}" password="${jdbc_password}" />

		<javaModelGenerator targetPackage="${path}.entity"
			targetProject="${project}">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="${path}.mapping" targetProject="${project}">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator targetPackage="${path}.dao"
			targetProject="${project}" type="XMLMAPPER">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>

		<!--<table tableName="T_FEE_AGTBILL" domainObjectName="FeeAgentBill" enableCountByExample="false" 
			enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" 
			selectByExampleQueryId="false"/> -->

		<table tableName="student" domainObjectName="Student"
			enableCountByExample="false" enableUpdateByExample="false"
			enableDeleteByExample="false" enableSelectByExample="false"
			selectByExampleQueryId="false"></table>

	</context>
	
	<context id="cms" targetRuntime="MyBatis3">
		<commentGenerator>
			<property name="suppressDate" value="false" />
			<property name="suppressAllComments" value="true" />
		</commentGenerator>

		<jdbcConnection driverClass="${jdbc_driver_cms}"
			connectionURL="${jdbc_url_cms}" userId="${jdbc_user_cms}" password="${jdbc_password_cms}" />

		<javaModelGenerator targetPackage="${path_cms}.entity"
			targetProject="${project}">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="${path_cms}.mapping" targetProject="${project}">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator targetPackage="${path_cms}.dao"
			targetProject="${project}" type="XMLMAPPER">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>

		<!--<table tableName="T_FEE_AGTBILL" domainObjectName="FeeAgentBill" enableCountByExample="false" 
			enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" 
			selectByExampleQueryId="false"/> -->

		<table tableName="student" domainObjectName="Student"
			enableCountByExample="false" enableUpdateByExample="false"
			enableDeleteByExample="false" enableSelectByExample="false"
			selectByExampleQueryId="false"></table>

	</context>
	
	<context id="mall" targetRuntime="MyBatis3">
		<commentGenerator>
			<property name="suppressDate" value="false" />
			<property name="suppressAllComments" value="true" />
		</commentGenerator>

		<jdbcConnection driverClass="${jdbc_driver_mall}"
			connectionURL="${jdbc_url_mall}" userId="${jdbc_user_mall}" password="${jdbc_password_mall}" />

		<javaModelGenerator targetPackage="${path_mall}.entity"
			targetProject="${project}">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="${path_mall}.mapping" targetProject="${project}">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator targetPackage="${path_mall}.dao"
			targetProject="${project}" type="XMLMAPPER">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>

		<!--<table tableName="T_FEE_AGTBILL" domainObjectName="FeeAgentBill" enableCountByExample="false" 
			enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" 
			selectByExampleQueryId="false"/> -->

		<table tableName="student" domainObjectName="Student"
			enableCountByExample="false" enableUpdateByExample="false"
			enableDeleteByExample="false" enableSelectByExample="false"
			selectByExampleQueryId="false"></table>

	</context>
	
	<context id="resource" targetRuntime="MyBatis3">
		<commentGenerator>
			<property name="suppressDate" value="false" />
			<property name="suppressAllComments" value="true" />
		</commentGenerator>

		<jdbcConnection driverClass="${jdbc_driver_resource}"
			connectionURL="${jdbc_url_resource}" userId="${jdbc_user_resource}" password="${jdbc_password_resource}" />

		<javaModelGenerator targetPackage="${path_resource}.entity"
			targetProject="${project}">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="${path_resource}.mapping" targetProject="${project}">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator targetPackage="${path_resource}.dao"
			targetProject="${project}" type="XMLMAPPER">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>

		<!--<table tableName="T_FEE_AGTBILL" domainObjectName="FeeAgentBill" enableCountByExample="false" 
			enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" 
			selectByExampleQueryId="false"/> -->

		<table tableName="student" domainObjectName="Student"
			enableCountByExample="false" enableUpdateByExample="false"
			enableDeleteByExample="false" enableSelectByExample="false"
			selectByExampleQueryId="false"></table>

	</context>
	
	<context id="exam" targetRuntime="MyBatis3">
		<commentGenerator>
			<property name="suppressDate" value="false" />
			<property name="suppressAllComments" value="true" />
		</commentGenerator>

		<jdbcConnection driverClass="${jdbc_driver_exam}"
			connectionURL="${jdbc_url_exam}" userId="${jdbc_user_exam}" password="${jdbc_password_exam}" />

		<javaModelGenerator targetPackage="${path_exam}.entity"
			targetProject="${project}">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="${path_exam}.mapping" targetProject="${project}">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator targetPackage="${path_exam}.dao"
			targetProject="${project}" type="XMLMAPPER">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>

		<!--<table tableName="T_FEE_AGTBILL" domainObjectName="FeeAgentBill" enableCountByExample="false" 
			enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" 
			selectByExampleQueryId="false"/> -->

		<table tableName="student" domainObjectName="Student"
			enableCountByExample="false" enableUpdateByExample="false"
			enableDeleteByExample="false" enableSelectByExample="false"
			selectByExampleQueryId="false"></table>

	</context>
	
	
	
	
</generatorConfiguration>

7generator.properties

project=src/main/java/
classPath=D:/maven/mvnRespo/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar
#基础表
jdbc_driver=com.mysql.jdbc.Driver
jdbc_url=jdbc\:mysql\://localhost\:3306/base
jdbc_user=root
jdbc_password=root
path=com.base
#cms
jdbc_driver_cms=com.mysql.jdbc.Driver
jdbc_url_cms=jdbc\:mysql\://localhost\:3306/cms
jdbc_user_cms=root
jdbc_password_cms=root
path_cms=com.cms
#商城
jdbc_driver_mall=com.mysql.jdbc.Driver
jdbc_url_mall=jdbc\:mysql\://localhost\:3306/mall
jdbc_user_mall=root
jdbc_password_mall=root
path_mall=com.mall
#资源库
jdbc_driver_resource=com.mysql.jdbc.Driver
jdbc_url_resource=jdbc\:mysql\://localhost\:3306/resource
jdbc_user_resource=root
jdbc_password_resource=root
path_resource=com.resource
#考试
jdbc_driver_exam=com.mysql.jdbc.Driver
jdbc_url_exam=jdbc\:mysql\://localhost\:3306/exam
jdbc_user_exam=root
jdbc_password_exam=root
path_exam=com.exam

以上为全部的配置文件,项目结构如图

后续为大家上传项目

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值