parent
8d72075194
commit
c0310fe4da
@ -1,17 +1,37 @@
|
|||||||
Page({
|
Page({
|
||||||
shujichzhao: function (e) {
|
shujichzhao: function (e) {
|
||||||
|
var that = this
|
||||||
wx.request({
|
wx.request({
|
||||||
url: 'http://localhost:9527/zxbook/find1',
|
url: 'http://localhost:9527/zxbook/find1',
|
||||||
data: {
|
data: {
|
||||||
'search': e.detail.value.search,
|
'search': e.detail.value.search,
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "pplication/json"
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
if(res.data=='zhaobudao'){
|
||||||
|
wx.showModal({
|
||||||
|
title: '书籍查询',
|
||||||
|
content: '未找到该书籍',
|
||||||
|
confirmColor: "rgba(253, 153, 65, 1)"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
|
var book=res.data
|
||||||
|
let bookstr = JSON.stringify(book);
|
||||||
|
console.log(book);
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../shuji/shuji?bookstr=' + bookstr,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
@ -1,37 +1,21 @@
|
|||||||
/*onLoad: function () {
|
Page({
|
||||||
wx.request({
|
onLoad:function(options){
|
||||||
url: 'https://zhenxiang.xuanjis.com', //服务器地址
|
console.log(options);
|
||||||
data: {
|
let book = JSON.parse(options.bookstr);
|
||||||
name: 'book_id'//请求参数
|
console.log(book);
|
||||||
},
|
var that=this
|
||||||
header: {
|
that.setData({
|
||||||
'content-type': 'application/json'
|
bookid:book.bookid,
|
||||||
},
|
bookname:book.bookname,
|
||||||
success: function (res) {
|
bookauthor: book.bookauthor,
|
||||||
console.log(res.data)
|
booksort: book.booksort,
|
||||||
}
|
booknum: book.booknum
|
||||||
})
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Component({
|
|
||||||
/**
|
|
||||||
* 组件的属性列表
|
|
||||||
*/
|
|
||||||
properties: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件的初始数据
|
|
||||||
*/
|
|
||||||
data: {
|
|
||||||
|
|
||||||
},
|
})
|
||||||
|
console.log(this.data.bookid)
|
||||||
/**
|
|
||||||
* 组件的方法列表
|
|
||||||
*/
|
}
|
||||||
methods: {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
@ -1,4 +1,7 @@
|
|||||||
<view class="c-minheight wx-view_3ZhLNq" />
|
<view class="c-minheight wx-view_3ZhLNq" />
|
||||||
<text class="c-block wx-text_efNLZY" >书名:</text>
|
<text class="c-block wx-text_efNLZY" >书名:</text>
|
||||||
|
<text class="c-block wx-text_efNLZY" >{{bookname}}</text>
|
||||||
<text class="c-block wx-text_07leZC" >书号:</text>
|
<text class="c-block wx-text_07leZC" >书号:</text>
|
||||||
<text class="c-block wx-text_MWTyqb" >作者:</text>
|
<text class="c-block wx-text_07leZC" >{{bookid}}</text>
|
||||||
|
<text class="c-block wx-text_MWTyqb" >作者:</text>
|
||||||
|
<text class="c-block wx-text_MWTyqb" >{{bookauthor}}</text>
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>zxbook</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src/main/webapp"/>
|
||||||
|
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="hide" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
@ -0,0 +1,4 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
@ -0,0 +1,8 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,4 @@
|
|||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="zxbook">
|
||||||
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<property name="context-root" value="zxbook"/>
|
||||||
|
<property name="java-output-path" value="/zxbook/target/classes"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="jst.web" version="2.3"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
<installed facet="java" version="1.8"/>
|
||||||
|
</faceted-project>
|
@ -0,0 +1 @@
|
|||||||
|
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
@ -0,0 +1 @@
|
|||||||
|
Window
|
@ -0,0 +1,2 @@
|
|||||||
|
disabled=06target
|
||||||
|
eclipse.preferences.version=1
|
@ -0,0 +1,52 @@
|
|||||||
|
package controller;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import domain.BookPO;
|
||||||
|
import service.BookService;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class BookController {
|
||||||
|
@Autowired@Qualifier("BookServiceImpl")
|
||||||
|
private BookService bookService;
|
||||||
|
@RequestMapping("find1")
|
||||||
|
public void find1(String search,HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
response.setContentType("text/html;charset=utf-8");
|
||||||
|
/* 设置响应头允许ajax跨域访问 */
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
/* 星号表示所有的异域请求都可以接受, */
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
|
||||||
|
BookPO bookPO=this.bookService.FindByBookidOrname(search);
|
||||||
|
if(bookPO!=null) {
|
||||||
|
String ss = new Gson().toJson(bookPO);
|
||||||
|
System.out.println(ss);
|
||||||
|
response.setContentType("text/html;charset=UTF-8");
|
||||||
|
PrintWriter out = response.getWriter();
|
||||||
|
out.print(ss);
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("书籍不存在");
|
||||||
|
Writer out = response.getWriter();
|
||||||
|
out.write("zhaobudao");
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class BookPO implements Serializable{
|
||||||
|
private long bookid;
|
||||||
|
private String bookname;
|
||||||
|
private String bookauthor;
|
||||||
|
private String booksort;
|
||||||
|
private int booknum;
|
||||||
|
public long getBookid() {
|
||||||
|
return bookid;
|
||||||
|
}
|
||||||
|
public void setBookid(long bookid) {
|
||||||
|
this.bookid = bookid;
|
||||||
|
}
|
||||||
|
public String getBookname() {
|
||||||
|
return bookname;
|
||||||
|
}
|
||||||
|
public void setBookname(String bookname) {
|
||||||
|
this.bookname = bookname;
|
||||||
|
}
|
||||||
|
public String getBookauthor() {
|
||||||
|
return bookauthor;
|
||||||
|
}
|
||||||
|
public void setBookauthor(String bookauthor) {
|
||||||
|
this.bookauthor = bookauthor;
|
||||||
|
}
|
||||||
|
public String getBooksort() {
|
||||||
|
return booksort;
|
||||||
|
}
|
||||||
|
public void setBooksort(String booksort) {
|
||||||
|
this.booksort = booksort;
|
||||||
|
}
|
||||||
|
public int getBooknum() {
|
||||||
|
return booknum;
|
||||||
|
}
|
||||||
|
public void setBooknum(int booknum) {
|
||||||
|
this.booknum = booknum;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package mapperDAO;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import domain.BookPO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Repository("BookDAO")
|
||||||
|
public interface BookDAO {
|
||||||
|
public BookPO FindByBookidOrname(String search );
|
||||||
|
public BookPO FindByBooksort(String search);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package service;
|
||||||
|
|
||||||
|
import domain.BookPO;
|
||||||
|
|
||||||
|
public interface BookService {
|
||||||
|
public BookPO FindByBookidOrname(String search );
|
||||||
|
public BookPO FindByBooksort(String search);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package serviceimpl;
|
||||||
|
|
||||||
|
import mapperDAO.BookDAO;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import domain.BookPO;
|
||||||
|
import service.BookService;
|
||||||
|
|
||||||
|
@Component("BookServiceImpl")
|
||||||
|
public class BookServiceImpl implements BookService{
|
||||||
|
@Autowired@Qualifier("BookDAO")
|
||||||
|
|
||||||
|
private BookDAO bookDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BookPO FindByBookidOrname(String search) {
|
||||||
|
return this.bookDAO.FindByBookidOrname(search);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BookPO FindByBooksort(String search) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return this.bookDAO.FindByBookidOrname(search);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
<?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="mapperDAO.BookDAO">
|
||||||
|
<resultMap id="BookMap" type="domain.BookPO">
|
||||||
|
<id column="book_id" jdbcType="VARCHAR" property="bookid" />
|
||||||
|
<result column="book_name" jdbcType="VARCHAR" property="bookname" />
|
||||||
|
<result column="book_author" jdbcType="VARCHAR" property="bookauthor" />
|
||||||
|
<result column="book_sort" jdbcType="VARCHAR" property="booksort" />
|
||||||
|
<result column="book_num" jdbcType="INTEGER" property="booknum" />
|
||||||
|
</resultMap>
|
||||||
|
<select id="FindByBookidOrname" resultMap="BookMap" parameterType="String">
|
||||||
|
SELECT
|
||||||
|
book.book_id,
|
||||||
|
book.book_name,
|
||||||
|
book.book_author,
|
||||||
|
book.book_num,
|
||||||
|
book.book_sort
|
||||||
|
FROM
|
||||||
|
book
|
||||||
|
WHERE
|
||||||
|
book.book_id=#{search}OR
|
||||||
|
book.book_name=#{search}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="FindByBooksort" resultMap="BookMap" parameterType="String">
|
||||||
|
SELECT
|
||||||
|
book.book_id,
|
||||||
|
book.book_name,
|
||||||
|
book.book_author,
|
||||||
|
book.book_num,
|
||||||
|
book.book_sort
|
||||||
|
FROM
|
||||||
|
book
|
||||||
|
WHERE
|
||||||
|
book.book_sort=#{search}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?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"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
||||||
|
<!-- 打开Spring的注解 -->
|
||||||
|
<context:annotation-config />
|
||||||
|
|
||||||
|
<context:component-scan base-package="mapperDAO,controller,serviceimpl"/>
|
||||||
|
</beans>
|
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||||
|
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
|
http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
<!-- 打开SpringMVC的注解 -->
|
||||||
|
<annotation-driven />
|
||||||
|
<!-- 配置静态资源的目录 -->
|
||||||
|
<resources mapping="/resources/**" location="/resources/" />
|
||||||
|
<!-- 配置视图处理器 -->
|
||||||
|
<beans:bean
|
||||||
|
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||||
|
<!-- 视图前缀 -->
|
||||||
|
<beans:property name="prefix" value="/WEB-INF/view/" />
|
||||||
|
<!-- 视图后缀 -->
|
||||||
|
<beans:property name="suffix" value=".jsp" />
|
||||||
|
</beans:bean>
|
||||||
|
|
||||||
|
</beans:beans>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE web-app PUBLIC
|
||||||
|
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||||
|
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||||
|
<web-app>
|
||||||
|
<display-name>Archetype Created Web Application</display-name>
|
||||||
|
<!-- Processes application requests -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>appServlet</servlet-name>
|
||||||
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath:spring-*.xml</param-value>
|
||||||
|
</init-param>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>appServlet</servlet-name>
|
||||||
|
<url-pattern>/</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
</web-app>
|
@ -0,0 +1 @@
|
|||||||
|
/controller/
|
Binary file not shown.
@ -0,0 +1,38 @@
|
|||||||
|
<?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="mapperDAO.BookDAO">
|
||||||
|
<resultMap id="BookMap" type="domain.BookPO">
|
||||||
|
<id column="book_id" jdbcType="VARCHAR" property="bookid" />
|
||||||
|
<result column="book_name" jdbcType="VARCHAR" property="bookname" />
|
||||||
|
<result column="book_author" jdbcType="VARCHAR" property="bookauthor" />
|
||||||
|
<result column="book_sort" jdbcType="VARCHAR" property="booksort" />
|
||||||
|
<result column="book_num" jdbcType="INTEGER" property="booknum" />
|
||||||
|
</resultMap>
|
||||||
|
<select id="FindByBookidOrname" resultMap="BookMap" parameterType="String">
|
||||||
|
SELECT
|
||||||
|
book.book_id,
|
||||||
|
book.book_name,
|
||||||
|
book.book_author,
|
||||||
|
book.book_num,
|
||||||
|
book.book_sort
|
||||||
|
FROM
|
||||||
|
book
|
||||||
|
WHERE
|
||||||
|
book.book_id=#{search}OR
|
||||||
|
book.book_name=#{search}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="FindByBooksort" resultMap="BookMap" parameterType="String">
|
||||||
|
SELECT
|
||||||
|
book.book_id,
|
||||||
|
book.book_name,
|
||||||
|
book.book_author,
|
||||||
|
book.book_num,
|
||||||
|
book.book_sort
|
||||||
|
FROM
|
||||||
|
book
|
||||||
|
WHERE
|
||||||
|
book.book_sort=#{search}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Binary file not shown.
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,11 @@
|
|||||||
|
<?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"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
||||||
|
<!-- 打开Spring的注解 -->
|
||||||
|
<context:annotation-config />
|
||||||
|
|
||||||
|
<context:component-scan base-package="mapperDAO,controller,serviceimpl"/>
|
||||||
|
</beans>
|
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||||
|
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
|
http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
<!-- 打开SpringMVC的注解 -->
|
||||||
|
<annotation-driven />
|
||||||
|
<!-- 配置静态资源的目录 -->
|
||||||
|
<resources mapping="/resources/**" location="/resources/" />
|
||||||
|
<!-- 配置视图处理器 -->
|
||||||
|
<beans:bean
|
||||||
|
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||||
|
<!-- 视图前缀 -->
|
||||||
|
<beans:property name="prefix" value="/WEB-INF/view/" />
|
||||||
|
<!-- 视图后缀 -->
|
||||||
|
<beans:property name="suffix" value=".jsp" />
|
||||||
|
</beans:bean>
|
||||||
|
|
||||||
|
</beans:beans>
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
/META-INF/
|
Loading…
Reference in new issue