ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

ssm插件配置(idea)

2019-07-01 08:47:54  阅读:179  来源: 互联网

标签:插件 http idea springframework ssm www org deptno schema


1.ssm框架springmvc-servlet配置
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
">
<!--全局扫描-->
<context:component-scan base-package="cn.kgc"/>
<!--mapper扫描配置-->
<bean id="configurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="cn.kgc.mapper"/>
</bean>
<!--mvc注解驱动-->
<mvc:annotation-driven/>
<!--事务注解驱动-->
<tx:annotation-driven/>
<!--驱动管理数据源-->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/kgc"/>
<property name="username" value="root"/>
<property name="password" value="151506"/>
</bean>
<!--sqlSessionFactoryBean-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliases" value="cn.kgc.util.PageUtil"/>
<property name="typeAliasesPackage" value="cn.kgc.pojo"/>
<property name="mapperLocations" value="classpath:mapper/*.xml"/>

<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageHelper">
<property name="properties">
<value>
dialect=hsqldb
reasonable=true
</value>
</property>
</bean>
</array>
</property>

</bean>
<!--数据源事务管理-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>

</bean>


</beans>

2.mapper配置动态SQL语句:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.kgc.mapper.EmpMapper">
<select id="selectPage" parameterType="PageUtil" resultType="map">
SELECT d.dname,d.loc,e.* from emp e,dept d where e.deptno=d.deptno
<if test="emp!=null and emp.deptno!=null and emp.deptno!=-1">
and e.deptno=#{emp.deptno}
</if>
<if test="startrow!=null and pagesize!=null">
limit #{startrow},#{pagesize}
</if>
</select>
<select id="totalcount" parameterType="Emp" resultType="Integer">
SELECT count(*) from emp
<where>
<if test="deptno!=null and deptno!=-1">
AND deptno=#{deptno}
</if>
</where>
</select>
</mapper>

标签:插件,http,idea,springframework,ssm,www,org,deptno,schema
来源: https://www.cnblogs.com/hong999/p/11112119.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有