ibais-

app_context.xml

<context:property-placeholder location="classpath:spring-jdbc.properties" />

	<bean id="MySQLDataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url"
			value="jdbc:mysql://localhost:3306/web_based?useUnicode=true" />
		<property name="username" value="root" />
		<property name="password" value="root" />
	</bean>

	<bean id="OracleDataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
		<property name="url"
			value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.126.176)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME = nms)(SERVER=DEDICATED)))" />
		<property name="username" value="cnmp" />
		<property name="password" value="cnmp" />
	</bean>

	<bean id="MySQLTransactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="MySQLDataSource" />
	</bean>

	<bean id="OracleTransactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="OracleDataSource" />
	</bean>

	<bean id="MySQLSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="MySQLDataSource" />
		<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property>
		<property name="mapperLocations" value="classpath*:/META-INF/mybatis/mysql/**/*.xml" />
	</bean>

	<bean id="OracleSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="OracleDataSource" />
		<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property>
		<property name="mapperLocations" value="classpath*:/META-INF/mybatis/oracle/**/*.xml" />
	</bean>

	<bean id="MySQLMapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="sqlSessionFactory" ref="MySQLSqlSessionFactory" />
		<property name="annotationClass" value="org.springframework.stereotype.Repository" />
		<property name="basePackage" value="com.wsl" />
	</bean>

	<bean id="OracleMapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="sqlSessionFactory" ref="OracleSqlSessionFactory" />
		<property name="annotationClass" value="org.springframework.stereotype.Repository" />
		<property name="basePackage" value="com.wsl.next" />
	</bean>

	<!-- class="org.springframework.context.support.ResourceBundleMessageSource"> -->
	<bean id="messageSource"
		class="com.web.context.support.ResourceBundleMessageSource">
		<property name="basenames">
			<list>
				<value>ApplicationResources</value>
				<value>/META-INF/PluginResources-*</value>
			</list>
		</property>
		<property name="useCodeAsDefaultMessage" value="true" />
	</bean>

	<context:component-scan base-package="com.wsl.next.next" />

 mybatis-config.xml

 

<configuration>
	<settings>
		<setting name="lazyLoadingEnabled" value="true" />
		<setting name="cacheEnabled" value="true" />
	</settings>
</configuration>

 user.xml

 注意这里的$ 如果字符串直接拼接要用$,#默认会在字符串变量前面加引号的 

<mapper namespace="core.base.support.UserMapper">
<resultMap id="plugin-map" type="com.base.User">
    <result property="id" column="id" />
		<result property="name" column="name" />
		<result property="code" column="code" />
		<result property="url" column="url" />
</resultMap>
<insert id="create" parameterType="com.base.User"
		useGeneratedKeys="true" keyProperty="id">
		INSERT INTO mk_plugins(`name`,
		`code`, `url`, `description`, `status`, `need_add`, `sys_depend`,
		`last_modified`, `ctime`, `mtime`)
		VALUES(#{name}, #{code}, #{url},
		#{desc}, #{status}, #{needAdd}, #{sysDepend}, #{lastModified},
		#{creationTime}, #{modifiedTime})
	</insert>

</mapper>

 

 

@Repository
public interface PluginMapper {
    void create(Plugin plugin);

    void update(Plugin plugin);

long getCount(@Param("plugin") Plugin plugin);
    
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值