2、 前端:
4.0.0
frameTest
frameTest
war
0.0.1-SNAPSHOT
frameTest Maven Webapp
http://maven.apache.org
maven-compiler-plugin
2.3.2
1.7
UTF-8
${java.home}\lib\rt.jar
src/main/java
**/*.xml
src/main/resources
**/*.*
frameTest
4.0.3.RELEASE
org.springframework
spring-test
${spring-version}
org.springframework
spring-webmvc
${spring-version}
org.springframework
spring-core
${spring-version}
org.springframework
spring-context
${spring-version}
org.springframework
spring-context-support
${spring-version}
org.springframework
spring-beans
${spring-version}
org.springframework
spring-orm
${spring-version}
org.springframework.amqp
spring-amqp
1.2.0.RELEASE
org.aspectj
aspectjweaver
1.7.1
org.mybatis
mybatis
3.2.7
org.mybatis
mybatis-spring
1.2.2
com.alibaba
druid
1.0.2
mysql
mysql-connector-java
5.1.34
junit
junit
4.11
test
org.codehaus.jackson
jackson-mapper-asl
1.9.7
com.alibaba
fastjson
1.1.26
org.codehaus.jackson
jackson-core-asl
1.9.7
javax.servlet
servlet-api
3.0-alpha-1
provided
org.apache.geronimo.specs
geronimo-servlet_3.0_spec
1.0
test
cglib
cglib
2.2
ch.qos.logback
logback-classic
1.0.9
commons-io
commons-io
2.4
com.github.snakerflow
snaker-core
2.5.1
org.apache.commons
commons-lang3
3.3.1
appversion
contextConfigLocation
classpath:spring.xml
字符集过滤器
encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
字符集编码
encoding
UTF-8
encodingFilter
/*
spring监听器
org.springframework.web.context.ContextLoaderListener
org.springframework.web.util.IntrospectorCleanupListener
dispatcher
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring-mvc.xml
1
dispatcher
/
15
七、mybatis基础配置文件spring-MybatisConfig.xml:
text/html;charset=UTF-8
%d{yyyy-MM-dd HH:mm:ss:SSS}[%p]: %m%n
${LOG_HOME}//merchant.%d{yyyy-MM-dd}.log
30
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n
#mysql
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/merchant?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=123456
#c3p0
c3p0.minPoolSize=5
c3p0.initialPoolSize=10
c3p0.maxIdleTime=60
c3p0.acquireIncrement=5
c3p0.idleConnectionTestPeriod=60
c3p0.acquireRetryAttempts=30
c3p0.acquireRetryDelay=1000
c3p0.numHelperThreads=3
c3p0.breakAfterAcquireFailure=true
c3p0.testConnectionOnCheckout=false
c3p0.maxStatements=0
c3p0.maxStatementsPerConnection=0
#druid 阿里巴巴提供的JDBC连接池、监控组件
druid.minPoolSize=5
druid.maxPoolSize=30
druid.initialPoolSize=10
druid.maxIdleTime=60
druid.acquireIncrement=5
druid.idleConnectionTestPeriod=60
druid.acquireRetryAttempts=30
druid.acquireRetryDelay=1000
druid.numHelperThreads=3
druid.breakAfterAcquireFailure=true
druid.testConnectionOnCheckout=false
druid.maxStatements=0
druid.maxStatementsPerConnection=0
druid.maxWait=60000
druid.timeBetweenEvictionRunsMillis=3000
druid.minEvictableIdleTimeMillis=300000
druid.maxPoolPreparedStatementPerConnectionSize=20
druid.validationQuery=SELECT 'x'
druid.testWhileIdle=true
druid.testOnBorrow=false
druid.testOnReturn=false
druid.poolPreparedStatements=false
package merModel;
import java.io.Serializable;
public class UserModel implements Serializable {
private static final long serialVersionUID = -3291196087479862240L;
private int id;
/**
* 用户账号
*/
private String account;
/**
* 用户姓名
*/
private String userName;
/**
* 用户密码
*/
private String password;
/**
* 手机
*/
private String mobile;
/**
* 邮箱
*/
private String email;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public String toString() {
return "UserModel [id=" + id + ", account=" + account + ", userName="
+ userName + ", password=" + password + ", modile=" + mobile
+ ", email=" + email + "]";
}
}
package merCommand;
public class UserCommand {
private int id;
/**
* 用户账号
*/
private String account;
/**
* 用户姓名
*/
private String userName;
/**
* 用户密码
*/
private String password;
/**
* 手机
*/
private String mobile;
/**
* 邮箱
*/
private String email;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public String toString() {
return "UserCommand [id=" + id + ", account=" + account + ", userName="
+ userName + ", password=" + password + ", modile=" + mobile
+ ", email=" + email + "]";
}
}
package merDao;
import merModel.UserModel;
public interface UserDao {
public void save(UserModel usermodel);
}
id,account,userName,password,mobile,email
insert into user( )
values(#{id},#{account},#{userName},#{password},#{mobile},#{email})
查询用户-->
package merService;
import merModel.UserModel;
public interface UserService {
public void add(UserModel usermodel);
}
package merService.merServiceImp;
import javax.annotation.Resource;
import merDao.UserDao;
import merModel.UserModel;
import merService.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service("UserService")
public class UserServiceImp implements UserService {
privatefinal Logger logger = LoggerFactory.getLogger(UserServiceImp.class);
private UserDao userDao;
@Resource(name = "userDao")
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
@Override
public void add(UserModel usermodel) {
userDao.save(usermodel);
}
}
package merController;
import merCommand.UserCommand;
import merModel.UserModel;
import merService.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserService userService;
/**
* 新增用户
*
* @author:tuzongxun
* @Title: addUser
* @param @param userCommand
* @return void
* @date Apr 14, 2016 11:28:47 AM
* @throws
*/
@RequestMapping(value = "addUser", method = RequestMethod.POST)
public void addUser(@RequestBody UserCommand userCommand) {
UserModel userModel = new UserModel();
BeanUtils.copyProperties(userCommand, userModel);
userService.add(userModel);
}
}
交易业务商户服务平台
var app=angular.module('merchantApp',['ui.router']);
app.config(function($stateProvider,$urlRouterProvider){
$urlRouterProvider.otherwise('/addUser');
$stateProvider
.state('addUser', {
url: "/addUser",
views: {
'view': {
templateUrl: 'views/addUser.html',
controller: 'addUserCtr'
}
}
});
});
用户名:
姓 名:
密 码:
手 机:
邮 箱:
angular.module('merchantApp')
.controller('addUserCtr', ['$scope','$http', function($scope,$http){
$scope.addUser=function(user){
//向后台提交数据
$http.post("./addUser",user,{headers:'Content-Type:application/json'}).success(function(){
});
}
}])
body{
margin:0;
}
.button1{
font-size:28px;
}
#addUser input{
font-size:24px;
}
#addUser{
border:2px solid;
border-radius:0.5em;
width:35%;
height:330px;
float:left;
margin-left:400px;
margin-top:100px;
padding:30px;
background-image:url("../images/111.jpg");
background-size:cover;
font-size:26px;
}
#addUser img{
width:100%;
height:100%;
}
#headBack{
width:100%;
height:80px;
background-color:#E0EEF0;
position:relative;
}
#headDiv{
width:75%;
height:5px;
background:#CBE1E4;
float:right;
position:absolute;
right:0;
bottom:0;
}
#navUl{
/*position:relative;*/
position:absolute;
float:right;
top:0;
right:0;
margin:0;
box-sizing:border-box;
/*background-color:red;*/
width:75%;
height:75px;
}
#navUl li{
list-style-type: none;
/*position:absolute;*/
font-size:36px;
display: inline;
/**top:20;*/
margin-top:20px;
left:0;
height:auto;
text-color:#2F2E2E;
/*background-color:#EAE3EA;*/
text-align:center;
/**padding:5px;
margin-top:3px;*/
}
a:link{
text-decoration:none;
color:black;
}
a:visited{
color:blue;
}
a:hover{
color:red;
}
a:active{
color:orange;
}
点击注册以后,数据库信息如下: