From 1192471cf1701e532ceb32dc103f1c8e0fb818ba Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期六, 26 六月 2021 09:36:06 +0800
Subject: [PATCH] sap请求日志 1.列表显示优化 2.增加Sap请求日志模糊搜索功能

---
 src/main/webapp/jsFiles/sapRequestLog.js                          |   23 ++++++++---
 src/main/java/com/slcf/controller/SapRequestLogController.java    |    4 +-
 src/main/java/com/slcf/service/impl/SapRequestLogServiceImpl.java |    4 +-
 src/main/webapp/WEB-INF/pages/sapRequestLog.jsp                   |   42 ++++++++++++++------
 src/main/java/com/slcf/dao/SapRequestLogDao.java                  |    2 
 src/main/java/com/slcf/service/SapRequestLogService.java          |    2 
 src/main/resources/mapper/SapRequestLogMapper.xml                 |   13 ++++++
 7 files changed, 63 insertions(+), 27 deletions(-)

diff --git a/src/main/java/com/slcf/controller/SapRequestLogController.java b/src/main/java/com/slcf/controller/SapRequestLogController.java
index a926fc8..25d51c1 100644
--- a/src/main/java/com/slcf/controller/SapRequestLogController.java
+++ b/src/main/java/com/slcf/controller/SapRequestLogController.java
@@ -39,8 +39,8 @@
 	/* 鏌ヨsap璇锋眰鏃ュ織 */
 	@ResponseBody
 	@RequestMapping("/querySapLog.action")
-	public List<SapRequestLogBean> querySapLog(){
-		List<SapRequestLogBean> list = sapRequestLogService.querySapLog();
+	public List<SapRequestLogBean> querySapLog(String condition){
+		List<SapRequestLogBean> list = sapRequestLogService.querySapLog(condition);
 		return list;
 	}
 }
diff --git a/src/main/java/com/slcf/dao/SapRequestLogDao.java b/src/main/java/com/slcf/dao/SapRequestLogDao.java
index 691cd72..caa7521 100644
--- a/src/main/java/com/slcf/dao/SapRequestLogDao.java
+++ b/src/main/java/com/slcf/dao/SapRequestLogDao.java
@@ -12,7 +12,7 @@
 public interface SapRequestLogDao {
 
     // 鏌ヨsap璇锋眰鏃ュ織
-    public List<SapRequestLogBean> querySapLog();
+    public List<SapRequestLogBean> querySapLog(@Param("condition") String condition);
 
     // 鏂板sap璇锋眰鏃ュ織
     public Integer addSapLog(@Param("matnr") String matnr, @Param("request") String request, @Param("response") String response, @Param("create_time") Date create_time, @Param("type") Integer type, @Param("remark") String remark);
diff --git a/src/main/java/com/slcf/service/SapRequestLogService.java b/src/main/java/com/slcf/service/SapRequestLogService.java
index bc2b4c5..a43a20e 100644
--- a/src/main/java/com/slcf/service/SapRequestLogService.java
+++ b/src/main/java/com/slcf/service/SapRequestLogService.java
@@ -10,7 +10,7 @@
 
 /* 鏌ヨsap璇锋眰鏃ュ織 */
 public interface SapRequestLogService {
-	public List<SapRequestLogBean> querySapLog();
+	public List<SapRequestLogBean> querySapLog(String condition);
 
 	public Integer addSapLog(SapRequestLogBean param);
 }
diff --git a/src/main/java/com/slcf/service/impl/SapRequestLogServiceImpl.java b/src/main/java/com/slcf/service/impl/SapRequestLogServiceImpl.java
index 4228b76..9197bc8 100644
--- a/src/main/java/com/slcf/service/impl/SapRequestLogServiceImpl.java
+++ b/src/main/java/com/slcf/service/impl/SapRequestLogServiceImpl.java
@@ -24,8 +24,8 @@
 	/**
 	 * 鏌ヨsap璇锋眰鏃ュ織
 	 */
-	public List<SapRequestLogBean> querySapLog() {
-		List<SapRequestLogBean> list = sapRequestLogDao.querySapLog();
+	public List<SapRequestLogBean> querySapLog(String condition) {
+		List<SapRequestLogBean> list = sapRequestLogDao.querySapLog(condition);
 		return list;
 	}
 
diff --git a/src/main/resources/mapper/SapRequestLogMapper.xml b/src/main/resources/mapper/SapRequestLogMapper.xml
index 9a8b492..f0669c0 100644
--- a/src/main/resources/mapper/SapRequestLogMapper.xml
+++ b/src/main/resources/mapper/SapRequestLogMapper.xml
@@ -15,7 +15,18 @@
 </resultMap>
 
 <select id="querySapLog" resultMap="BaseResult">
-	SELECT * FROM sap_request_log ORDER BY create_time desc;
+	SELECT * FROM sap_request_log
+	where 1 = 1
+	<if test="condition != null and condition != ''">
+		and (
+		matnr like '%' + #{condition} + '%'
+		or request like '%' + #{condition} + '%'
+		or response like '%' + #{condition} + '%'
+		or remark like '%' + #{condition} + '%'
+		or type like '%' + #{condition} + '%'
+		)
+	</if>
+	ORDER BY create_time desc
 </select>
 
 <insert id="addSapLog">
diff --git a/src/main/webapp/WEB-INF/pages/sapRequestLog.jsp b/src/main/webapp/WEB-INF/pages/sapRequestLog.jsp
index c5c4434..1329f01 100644
--- a/src/main/webapp/WEB-INF/pages/sapRequestLog.jsp
+++ b/src/main/webapp/WEB-INF/pages/sapRequestLog.jsp
@@ -1,39 +1,55 @@
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
-    <%@ include file="../../include/core.jsp" %>
+         pageEncoding="UTF-8" %>
+<%@ include file="../../include/core.jsp" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title></title>
 
-<script type="text/javascript" src="${path }/jsFiles/sapRequestLog.js"></script>
-<style type="text/css">
 
-</style>
+    <style type="text/css">
+
+    </style>
 </head>
 <body>
+
+<%--<div class="panel panel-default">--%>
+<%--<div class="panel-body">--%>
+<%--<form id="conForm" class="form-inline">--%>
+<%----%>
+<%--</form>--%>
+<%--</div>--%>
+<%--</div>--%>
+
+<div class="panel panel-default">
+    <div class="panel-body">
+        <input type="text" class="form-control" style="width:10%; display: inline-block" id="condition" name="condition"
+               placeholder="璇疯緭鍏�">
+        <button style="display: inline-block" type="button" onclick="onSearch()" class="btn btn-info">
+            <span class="glyphicon glyphicon-search" aria-hidden="true">  鎼滅储</span></button>
+    </div>
+</div>
+
 
 <div class="table-responsive">
     <table id="test-table" class="table table-hover table-striped table-condensed table-bordered"></table>
 </div>
 
 <div id="showDetail" class="modal fade" data-backdrop="static">
-    <div>
-
-    </div>
     <div class="modal-content">
         <div class="modal-header" id="headerName">
-           鏃ュ織鏄庣粏
+            鏃ュ織鏄庣粏
         </div>
         <div class="container" style="text-align: center; width: 600px">
-            <form class="form-horizontal" id="detailForm"  method="post">
-                <textarea  style="width: 95%; margin-top: 8px" rows="10" id="details" readonly></textarea>
+            <form class="form-horizontal" id="detailForm" method="post">
+                <textarea style="width: 95%; margin-top: 8px" rows="10" id="details" readonly></textarea>
             </form>
             <button type="button" class="btn btn-default" onclick="closeModal()" style="margin-bottom: 8px">鍏抽棴</button>
         </div>
     </div>
 </div>
 
+<script type="text/javascript" src="${path }/jsFiles/sapRequestLog.js"></script>
 </body>
 </html>
\ No newline at end of file
diff --git a/src/main/webapp/jsFiles/sapRequestLog.js b/src/main/webapp/jsFiles/sapRequestLog.js
index 656f31c..ffcd350 100644
--- a/src/main/webapp/jsFiles/sapRequestLog.js
+++ b/src/main/webapp/jsFiles/sapRequestLog.js
@@ -69,12 +69,11 @@
         ],
         queryParamsType: "undefined",
         queryParams: function queryParams(params) {   //璁剧疆鏌ヨ鍙傛暟
-            // var param = {
-            //     pageNumber: params.pageNumber,
-            //     pageSize: params.pageSize
-            //     // searchText: params.searchText
-            // };
-            // return param;
+            var condition = $("#condition").val();
+            var param = {
+                condition: condition
+            };
+            return param;
         },
         formatLoadingMessage: function () {
             return "璇风◢绛夛紝姝e湪鍔犺浇涓�...";
@@ -200,4 +199,14 @@
 function closeModal() {
     // 鏄剧ず妯℃�佹
     $("#showDetail").modal('hide');
-}
\ No newline at end of file
+}
+
+function onSearch() {
+    $("#test-table").bootstrapTable('refreshOptions',{pageNumber:1}); //鍒嗛〉鍚庨噸鏂版悳绱㈡椂锛屽垵濮嬪寲椤电爜涓�1
+}
+
+$('#content').keydown(function () {
+    if (event.keyCode === 13) {
+        onSearch();
+    }
+});
\ No newline at end of file

--
Gitblit v1.9.1