zoukankan      html  css  js  c++  java
  • jt-day01

    1.pom

    <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/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>cn.gjack</groupId>
      <artifactId>gjack.cn</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>war</packaging>
      <dependencies>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-webmvc</artifactId>
      		<version>3.2.8.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-jdbc</artifactId>
      		<version>3.2.8.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>junit</groupId>
      		<artifactId>junit</artifactId>
      		<version>4.12</version>
      	</dependency>
      	<dependency>
      		<groupId>org.mybatis</groupId>
      		<artifactId>mybatis</artifactId>
      		<version>3.2.5</version>
      	</dependency>
      	<dependency>
      		<groupId>org.mybatis</groupId>
      		<artifactId>mybatis-spring</artifactId>
      		<version>1.3.1</version>
      	</dependency>
    
      	<dependency>
      		<groupId>commons-dbcp</groupId>
      		<artifactId>commons-dbcp</artifactId>
      		<version>1.4</version>
      	</dependency>
      	<dependency>
      		<groupId>com.fasterxml.jackson.core</groupId>
      		<artifactId>jackson-core</artifactId>
      		<version>2.8.3</version>
      		
      	</dependency>
      	<dependency>
      		<groupId>com.fasterxml.jackson.core</groupId>
      		<artifactId>jackson-databind</artifactId>
      		<version>2.8.3</version>
      		
      	</dependency>
      	<dependency>
      		<groupId>com.fasterxml.jackson.core</groupId>
      		<artifactId>jackson-annotations</artifactId>
      		<version>2.8.3</version>
      		
      	</dependency>
      	
      	<dependency>
    	  <groupId>Jstl</groupId>
    	  <artifactId>Jstl</artifactId>
    	  <version>1.2</version>
    	</dependency>
      	<dependency>
      		<groupId>mysql</groupId>
      		<artifactId>mysql-connector-java</artifactId>
      		<version>5.1.37</version>
      	</dependency>
      	<dependency>
      		<groupId>org.slf4j</groupId>
      		<artifactId>slf4j-api</artifactId>
      		<version>1.7.7</version>
      	</dependency>
      </dependencies>
    </project>
    

    2.db.properties

    url=jdbc:mysql://101.132.149.236:3306/wx?useUnicode=true&characterEncoding=utf8
    driver=com.mysql.jdbc.Driver
    user=root
    password=ABCabc123!
    initSize=2
    maxActive=10
    

     3.spring-mvc

    <?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:context="http://www.springframework.org/schema/context" 
    	xmlns:jdbc="http://www.springframework.org/schema/jdbc"  
    	xmlns:jee="http://www.springframework.org/schema/jee" 
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:aop="http://www.springframework.org/schema/aop" 
    	xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
    		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
    		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
    		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
    		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
     
       <!-- Spring MVC -->
       
    		<!-- 配置组件扫描 -->
    		<context:component-scan 
    			base-package="gjack.cn.Controller" />
    			
    		<!-- 配置ViewResolver -->
    		<bean 
    			class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    			<property name="prefix" 
    				value="/web/" />
    			<property name="suffix" 
    				value=".jsp" />
    		</bean>
    		
    		<!-- 注解驱动 -->
    		<mvc:annotation-driven />
    
    </beans>
    

      3.Mybatis配置

    <?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="gjack.cn.Mapper.UserMapper">
    	<insert id="insertAll" parameterType="gjack.cn.bean.User">
    		insert into 
    		zjtie_user(
    		username,password,nickname,
    		avt_img,phone,email,status,
    		rank,gender,openid)values(
    		#{username},#{password},#{nickname},
    		#{avt_img},#{phone},#{email},#{status},
    		#{rank},#{gender},#{openid}
    		);
    	</insert>
    	
    	<insert id="insertContent" parameterType="gjack.cn.bean.Content">
    		insert into 
    		zjtie_content(
    		username,nickname,
    		avt_img,rank,openid,content)values(
    		#{username},#{nickname},
    		#{avt_img},#{rank},#{openid},#{content}
    		);
    	</insert>
    	
    	<select id="selectUserInfo" resultType="gjack.cn.bean.ResponseResult">
    		select * from zjtie_user where openid=#{openid}
    	</select>
    	
    	<resultMap id="departMent" type="gjack.cn.bean.Content">
            <id column="id" property="id" />
            <result column="username" property="username" />
            <result column="nickname" property="nickname" />
            <result column="avt_img" property="avt_img" />
            <result column="rank" property="rank" />
            <result column="content" property="content" />
            <result column="openid" property="openid" />
        </resultMap>
    	
    	<select id="selectContent" resultMap="departMent">
    		select * from zjtie_content
    	</select>
    	
    </mapper>
    

      

     

  • 相关阅读:
    cocos2d-x于android在call to OpenGL ES API with no current context
    C# 6.0 (C# vNext) 的新功能:Exception-Handling Improvements
    既然知识都会遗忘,我们为什么要学习?
    进程(线程)间通信与网络通信的联系与比较
    网络通信要素与总结
    android和IOS长连接区别
    TCP socket如何判断连接断开
    application/json 四种常见的 POST 提交数据方式
    TCP和流
    比勤奋更重要的,是深度思考的能力
  • 原文地址:https://www.cnblogs.com/gjack/p/8970533.html
Copyright © 2011-2022 走看看