增加操作日志功能

This commit is contained in:
liwen
2020-12-04 10:47:50 +08:00
parent 88ae95e1ab
commit c454ce1d27
27 changed files with 1407 additions and 114 deletions

View File

@@ -5,6 +5,7 @@ import com.epri.fx.client.model.GroupDataModel;
import com.epri.fx.client.request.Request;
import com.epri.fx.client.request.feign.admin.GroupTypeFeign;
import com.epri.fx.server.vo.GroupTypeVO;
import com.jfoenix.controls.JFXSpinner;
import com.jfoenix.controls.JFXTabPane;
import io.datafx.controller.ViewController;
import io.datafx.controller.flow.Flow;
@@ -40,13 +41,15 @@ public class GroupManagementController {
private StackPane rootPane;
@Inject
private GroupDataModel groupDataModel;
@FXML
private JFXSpinner viewSpinner;
@PostConstruct
private void init() {
TextField textField = new TextField();
textField.setStyle("");
viewSpinner.visibleProperty().bind(tabPane.disableProperty());
tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
@Override
public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
@@ -60,6 +63,7 @@ public class GroupManagementController {
private void initData() {
ProcessChain.create().addRunnableInPlatformThread(() -> {
tabPane.getTabs().clear();
tabPane.setDisable(true);
})
.addSupplierInExecutor(() -> Request.connector(GroupTypeFeign.class).getAllGroupTypes())
.addConsumerInPlatformThread(rel -> {
@@ -76,7 +80,9 @@ public class GroupManagementController {
}
tabPane.getTabs().add(tab);
}
}).onException(e -> e.printStackTrace())
}).onException(e -> e.printStackTrace()).withFinal(() -> {
tabPane.setDisable(false);
})
.run();
}

View File

@@ -24,6 +24,7 @@ import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.util.Callback;
@@ -46,9 +47,13 @@ public class GroupTypeManagementController {
@FXMLViewFlowContext
private ViewFlowContext viewFlowContext;
@FXML
private VBox contentPane;
@FXML
private StackPane rootPane;
@FXML
private JFXSpinner viewSpinner;
@FXML
private JFXProgressBar progressBar;
@FXML
private JFXDialog dialog;
@@ -100,9 +105,13 @@ public class GroupTypeManagementController {
progressBar.visibleProperty().bind(dialog.disableProperty());
progressBar.managedProperty().bind(progressBar.visibleProperty());
updateButton.visibleProperty().bind(saveButton.visibleProperty().not());
updateButton.managedProperty().bind(updateButton.visibleProperty());
saveButton.managedProperty().bind(saveButton.visibleProperty());
cancelButton.disableProperty().bind(saveButton.disableProperty().or(updateButton.disableProperty()));
viewSpinner.visibleProperty().bind(contentPane.disableProperty());
serialNumberColumn.setCellFactory((col) -> {
TableCell<GroupTypeVO, String> cell = new TableCell<GroupTypeVO, String>() {
@@ -202,11 +211,16 @@ public class GroupTypeManagementController {
}
private void loadingTableData() {
ProcessChain.create()
ProcessChain.create().addRunnableInPlatformThread(() -> {
contentPane.setDisable(true);
})
.addSupplierInExecutor(() -> Request.connector(GroupTypeFeign.class).getAllGroupTypes())
.addConsumerInPlatformThread(rel -> {
groupTypeDataModel.getGroupTypes().clear();
groupTypeDataModel.getGroupTypes().addAll(rel);})
groupTypeDataModel.getGroupTypes().addAll(rel);
}).withFinal(() -> {
contentPane.setDisable(false);
})
.run();
}
@@ -236,7 +250,7 @@ public class GroupTypeManagementController {
ProcessChain.create().addRunnableInPlatformThread(() -> dialog.setDisable(true))
.addSupplierInExecutor(() -> Request.connector(GroupTypeFeign.class).addGroupType(groupTypeVO))
.addConsumerInPlatformThread(rel -> {
if (rel >=0) {
if (rel >= 0) {
loadingTableData();
}
}).withFinal(() -> {

View File

@@ -0,0 +1,269 @@
package com.epri.fx.client.gui.uicomponents.admin.log;
import com.epri.fx.client.gui.feature.FeatureResourceConsumer;
import com.epri.fx.client.gui.feature.HideByFeature;
import com.epri.fx.client.gui.uicomponents.admin.user.components.UserAddController;
import com.epri.fx.client.gui.uicomponents.admin.user.components.UserEditController;
import com.epri.fx.client.model.LogDataModel;
import com.epri.fx.client.model.UserDataModel;
import com.epri.fx.client.request.Request;
import com.epri.fx.client.request.feign.admin.LogFeign;
import com.epri.fx.client.request.feign.admin.UserFeign;
import com.epri.fx.client.request.feign.login.LoginFeign;
import com.epri.fx.client.store.ApplicatonStore;
import com.epri.fx.client.utils.Pinyin4jUtil;
import com.epri.fx.server.entity.User;
import com.epri.fx.server.entity.log.GateLog;
import com.epri.fx.server.entity.log.LogInfo;
import com.epri.fx.server.util.DateUtils;
import com.epri.fx.server.vo.UserVO;
import com.jfoenix.controls.JFXAlert;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialogLayout;
import com.jfoenix.svg.SVGGlyphLoader;
import io.datafx.controller.ViewController;
import io.datafx.controller.flow.FlowException;
import io.datafx.controller.flow.action.ActionMethod;
import io.datafx.controller.flow.action.ActionTrigger;
import io.datafx.controller.flow.context.ActionHandler;
import io.datafx.controller.flow.context.FlowActionHandler;
import io.datafx.controller.util.VetoException;
import io.datafx.core.concurrent.ProcessChain;
import io.datafx.eventsystem.Event;
import io.datafx.eventsystem.OnEvent;
import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.util.Callback;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description:
* @className: UserManagementController
* @author: liwen
* @date: 2020/3/4 21:05
*/
@ViewController(value = "/fxml/admin/log/log_management.fxml", title = "操作日志")
public class LogManagementController {
public static final String CONTENT_PANE = "ContentPane";
@FXML
private StackPane root;
@FXML
private VBox centPane;
@FXML
private StackPane spinnerPane;
@FXML
private TextField searchField;
@FXML
private TextField userNameTextField;
@FXML
private TextField accountTextField;
@FXML
private TextField pwdTextField;
@FXML
private TextArea descTextArea;
@FXML
private ComboBox genderCombobox;
@FXML
@ActionTrigger("search")
private Button searchBut;
@FXML
private Pagination pagination;
@FXML
private TableView<GateLog> tableView;
@FXML
private TableColumn<GateLog, String> serialNumberColumn;
@FXML
private TableColumn<GateLog, String> idColumn;
@FXML
private TableColumn<GateLog, String> menuColumn;
@FXML
private TableColumn<GateLog, String> optColumn;
@FXML
private TableColumn<GateLog, String> urlColumn;
@FXML
private TableColumn<GateLog, String> optTimeColumn;
@FXML
private TableColumn<GateLog, String> optUserIdColumn;
@FXML
private TableColumn<GateLog, String> optUserColumn;
@FXML
private TableColumn<GateLog, String> optIpColumn;
@FXML
private TableColumn<GateLog, String> requetDataColumn;
@ActionHandler
private FlowActionHandler actionHandler;
@Inject
private LogDataModel logDataModel;
@Inject
private FeatureResourceConsumer featureResourceConsumer;
@PostConstruct
public void init() {
featureResourceConsumer.consumeResource(this);
spinnerPane.setVisible(false);
serialNumberColumn.setCellFactory((col) -> {
TableCell<GateLog, String> cell = new TableCell<GateLog, String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
this.setText(null);
this.setGraphic(null);
if (!empty) {
int rowIndex = this.getIndex() + 1;
this.setText(String.valueOf(rowIndex));
}
}
};
return cell;
});
idColumn.setCellValueFactory(new PropertyValueFactory<>("id"));
menuColumn.setCellValueFactory(new PropertyValueFactory<>("menu"));
optColumn.setCellValueFactory(new PropertyValueFactory<>("opt"));
urlColumn.setCellValueFactory(new PropertyValueFactory<>("uri"));
optTimeColumn.setCellValueFactory(new PropertyValueFactory<>("crtTime"));
optUserIdColumn.setCellValueFactory(new PropertyValueFactory<>("crtUser"));
optUserColumn.setCellValueFactory(new PropertyValueFactory<>("crtName"));
optIpColumn.setCellValueFactory(new PropertyValueFactory<>("crtHost"));
requetDataColumn.setCellValueFactory(new PropertyValueFactory<>("body"));
FilteredList<GateLog> filteredData = new FilteredList<>(logDataModel.getGateLogs(), p -> true);
tableView.setItems(filteredData);
searchField.textProperty().addListener((o, oldVal, newVal) -> {
filteredData.setPredicate(elementProp -> {
if (newVal == null || newVal.isEmpty()) {
return true;
}
String val = Pinyin4jUtil.toPinYinLowercase(newVal);
return Pinyin4jUtil.toPinYinLowercase(elementProp.getMenu()).contains(val)
|| Pinyin4jUtil.toPinYinLowercase(elementProp.getCrtName()).contains(val)
|| elementProp.getCrtHost().toLowerCase().contains(val);
});
});
logDataModel.selectedPersonIndexProperty().bind(tableView.getSelectionModel().selectedIndexProperty());
pagination.pageCountProperty().bind(logDataModel.pageCountProperty());
pagination.setPageFactory(new Callback<Integer, Node>() {
@Override
public Node call(Integer param) {
showPage(param + 1);
return tableView;
}
});
}
private void delete() {
GateLog gateLog = logDataModel.getGateLogs().get(logDataModel.getSelectedPersonIndex());
JFXAlert alert = new JFXAlert((Stage) root.getScene().getWindow());
alert.initModality(Modality.APPLICATION_MODAL);
alert.setOverlayClose(false);
JFXDialogLayout layout = new JFXDialogLayout();
layout.setHeading(new Label("消息提示"));
layout.setBody(new Label("确实删除【" + gateLog.getId() + "】吗?"));
JFXButton closeButton = new JFXButton("取消");
closeButton.setOnAction(event -> alert.hideWithAnimation());
JFXButton determineButton = new JFXButton("确定");
determineButton.setOnAction(event -> {
alert.hideWithAnimation();
ProcessChain.create()
.addSupplierInExecutor(() -> Request.connector(UserFeign.class).delete(gateLog.getId()))
.addConsumerInPlatformThread(result -> {
if (result.isRel()) {
logDataModel.getGateLogs().remove(logDataModel.getSelectedPersonIndex());
}
}).onException(e -> e.printStackTrace()).run();
});
layout.setActions(closeButton, determineButton);
alert.setContent(layout);
alert.show();
}
private void showPage(Integer page) {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put("keyId", searchField.getText());
queryMap.put("page", page);
query(queryMap);
}
@ActionMethod("search")
private void search() {
Map<String, Object> queryMap = new HashMap<>();
queryMap.put("keyId", searchField.getText());
query(queryMap);
}
private void query(Map<String, Object> queryMap) {
ProcessChain.create()
.addRunnableInPlatformThread(() -> {
spinnerPane.setVisible(true);
centPane.setDisable(true);
})
.addSupplierInExecutor(() -> Request.connector(LogFeign.class).getPageList(queryMap)
)
.addConsumerInPlatformThread(result -> {
logDataModel.getGateLogs().clear();
List<GateLog> gateLogs = result.getDatas();
logDataModel.setPageCount((int) result.getTotal());
for (GateLog gateLog : gateLogs) {
logDataModel.getGateLogs().add(gateLog);
}
})
.withFinal(() -> {
spinnerPane.setVisible(false);
centPane.setDisable(false);
})
.onException(e -> e.printStackTrace())
.run();
}
@PreDestroy
private void destroy() {
System.err.println("destroy " + this);
}
@OnEvent("refresh")
private void onRefresh(Event<String> e) {
System.err.println(this.getClass() + "\t" + e.getContent());
search();
}
}

View File

@@ -48,6 +48,7 @@ import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import java.lang.reflect.InvocationTargetException;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
/**
@@ -120,6 +121,7 @@ public class MainController {
private JFXDrawer leftDrawer;
@FXML
@EventTrigger("refresh")
private JFXDatePicker datePicker;
@Inject
private FeatureResourceConsumer featureResourceConsumer;
@@ -144,6 +146,9 @@ public class MainController {
e.printStackTrace();
}
datePicker.setEditable(false);
datePicker.valueProperty().addListener((observable, oldValue, newValue) ->{
refreshButton.fire();
});
leftDrawer.setSidePane(navigationList);
leftDrawer.setOverLayVisible(false);
leftDrawer.setResizeContent(true);
@@ -226,7 +231,7 @@ public class MainController {
@EventProducer("refresh")
private String refresh() {
return "--------=================-----------";
return datePicker.getValue().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
}

View File

@@ -0,0 +1,58 @@
package com.epri.fx.client.model;
import com.epri.fx.server.entity.log.GateLog;
import io.datafx.controller.injection.scopes.FlowScoped;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@FlowScoped
public class LogDataModel {
private int counter = 0;
private ListProperty<GateLog> gateLogs;
private IntegerProperty pageCount;
private IntegerProperty selectedPersonIndex;
public ListProperty<GateLog> getGateLogs() {
if (gateLogs == null) {
ObservableList<GateLog> innerList = FXCollections.observableArrayList();
gateLogs = new SimpleListProperty<>(innerList);
}
return gateLogs;
}
public int getSelectedPersonIndex() {
return selectedPersonIndexProperty().get();
}
public void setSelectedPersonIndex(int selectedPersonIndex) {
this.selectedPersonIndex.set(selectedPersonIndex);
}
public IntegerProperty selectedPersonIndexProperty() {
if (selectedPersonIndex == null) {
selectedPersonIndex = new SimpleIntegerProperty();
}
return selectedPersonIndex;
}
public int getPageCount() {
return pageCount.get();
}
public IntegerProperty pageCountProperty() {
if (pageCount == null) {
pageCount = new SimpleIntegerProperty();
}
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount.set(pageCount);
}
}

View File

@@ -0,0 +1,29 @@
package com.epri.fx.client.request.feign.admin;
import com.epri.fx.client.request.feign.FeignAPI;
import com.epri.fx.server.entity.User;
import com.epri.fx.server.entity.log.GateLog;
import com.epri.fx.server.entity.log.LogInfo;
import com.epri.fx.server.msg.ObjectRestResponse;
import com.epri.fx.server.msg.TableResultResponse;
import feign.Param;
import feign.QueryMap;
import feign.RequestLine;
import java.util.Map;
/**
* @description:
* @className: TestFeign
* @author: liwen
* @date: 2020/4/1 17:31
*/
public interface LogFeign extends FeignAPI {
@RequestLine("GET /log/page")
TableResultResponse<GateLog> getPageList(@QueryMap Map<String, Object> map);
@RequestLine("DELETE /log/{id}")
ObjectRestResponse<Integer> delete(@Param("id") Integer id);
}

View File

@@ -4,9 +4,11 @@
<?import javafx.scene.layout.StackPane?>
<?import com.jfoenix.controls.JFXSpinner?>
<StackPane fx:id="rootPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<JFXTabPane fx:id="tabPane"/>
<JFXSpinner fx:id="viewSpinner" radius="18" startingAngle="90" styleClass="blue-spinner" visible="false" />
</children>
</StackPane>

View File

@@ -11,9 +11,10 @@
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import com.jfoenix.controls.JFXSpinner?>
<StackPane fx:id="rootPane" prefHeight="384.0" prefWidth="585.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox spacing="7.0">
<VBox fx:id="contentPane" spacing="7.0">
<children>
<HBox alignment="CENTER_RIGHT" spacing="10.0" styleClass="card-pane">
<children>
@@ -38,6 +39,7 @@
</TableView>
</children>
</VBox>
<JFXSpinner fx:id="viewSpinner" radius="18" startingAngle="90" styleClass="blue-spinner" visible="false" />
<JFXDialog fx:id="dialog" transitionType="TOP">
<JFXDialogLayout>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXSpinner?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.Pagination?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<StackPane fx:id="root" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox fx:id="centPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="10.0">
<children>
<HBox alignment="CENTER_RIGHT" maxHeight="-Infinity" prefHeight="45.0" prefWidth="200.0" spacing="10.0" styleClass="card-pane">
<children>
<JFXTextField fx:id="searchField" promptText="菜单,操作人或操作主机" />
<JFXButton fx:id="searchBut" buttonType="RAISED" text="搜索" />
</children>
</HBox>
<AnchorPane VBox.vgrow="ALWAYS">
<children>
<Pagination fx:id="pagination" cache="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<TableView fx:id="tableView" editable="true" tableMenuButtonVisible="false" AnchorPane.bottomAnchor="60.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
<columns>
<TableColumn fx:id="serialNumberColumn" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" text="序号" />
<TableColumn fx:id="idColumn" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" text="id" />
<TableColumn fx:id="menuColumn" text="菜单" />
<TableColumn fx:id="optColumn" text="操作" />
<TableColumn fx:id="urlColumn" text="资源路径" />
<TableColumn fx:id="optTimeColumn" text="操作时间" />
<TableColumn fx:id="optUserIdColumn" text="操作人id" />
<TableColumn fx:id="optUserColumn" maxWidth="120.0" minWidth="120.0" prefWidth="120" text="操作人" />
<TableColumn fx:id="optIpColumn" maxWidth="120.0" minWidth="120.0" prefWidth="120" text="操作主机" />
<TableColumn fx:id="requetDataColumn" maxWidth="120.0" minWidth="120.0" prefWidth="120" text="请求数据" />
</columns>
</TableView>
</children>
</AnchorPane>
</children>
</VBox>
<StackPane fx:id="spinnerPane" visible="false">
<JFXSpinner startingAngle="-40" styleClass="materialDesign-purple, first-spinner" />
<JFXSpinner startingAngle="-90" styleClass="materialDesign-blue, second-spinner" />
<JFXSpinner startingAngle="-120" styleClass="materialDesign-cyan, third-spinner" />
<JFXSpinner startingAngle="-150" styleClass="materialDesign-green, fourth-spinner" />
<JFXSpinner startingAngle="-180" styleClass="materialDesign-yellow, fifth-spinner" />
<JFXSpinner startingAngle="-210" styleClass="materialDesign-orange, sixth-spinner" />
<JFXSpinner startingAngle="-240" styleClass="materialDesign-red, seventh-spinner" />
</StackPane>
</children>
</StackPane>

View File

@@ -46,7 +46,7 @@
<TreeView fx:id="treeView" VBox.vgrow="ALWAYS" />
</children>
</VBox>
<JFXSpinner fx:id="treeViewSpinner" radius="13" startingAngle="0" styleClass="blue-spinner" visible="false" />
<JFXSpinner fx:id="treeViewSpinner" radius="18.0" startingAngle="90.0" styleClass="blue-spinner" visible="false" />
</children>
</StackPane>
</children>

View File

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,6 @@
package com.epri.fx.server;
import com.epri.fx.server.util.DBLog;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -12,6 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
public class ServerApplication {
public static void main(String[] args) {
DBLog.getInstance().start();
SpringApplication.run(ServerApplication.class, args);
}

View File

@@ -0,0 +1,42 @@
package com.epri.fx.server.config;
import com.epri.fx.server.filter.ReplaceStreamFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.Filter;
/**
* @author 01
* @program wrapper-demo
* @description 过滤器配置类
* @create 2018-12-24 21:06
* @since 1.0
**/
@Configuration
public class FilterConfig {
/**
* 注册过滤器
*
* @return FilterRegistrationBean
*/
@Bean
public FilterRegistrationBean someFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(replaceStreamFilter());
registration.addUrlPatterns("/*");
registration.setName("streamFilter");
return registration;
}
/**
* 实例化StreamFilter
*
* @return Filter
*/
@Bean(name = "replaceStreamFilter")
public Filter replaceStreamFilter() {
return new ReplaceStreamFilter();
}
}

View File

@@ -2,6 +2,7 @@ package com.epri.fx.server.config;
import com.epri.fx.server.handler.GlobalExceptionHandler;
import com.epri.fx.server.interceptor.LogInterceptor;
import com.epri.fx.server.interceptor.UserAuthRestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -18,7 +19,7 @@ import java.util.Collections;
*/
@Configuration("admimWebConfig")
@Primary
public class WebConfiguration implements WebMvcConfigurer {
public class WebConfiguration implements WebMvcConfigurer {
@Bean
GlobalExceptionHandler getGlobalExceptionHandler() {
return new GlobalExceptionHandler();
@@ -27,6 +28,7 @@ public class WebConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(getUserAuthRestInterceptor()).addPathPatterns(getIncludePathPatterns());
registry.addInterceptor(getLogInterceptor()).addPathPatterns(getIncludePathPatterns());
}
@@ -34,6 +36,10 @@ public class WebConfiguration implements WebMvcConfigurer {
UserAuthRestInterceptor getUserAuthRestInterceptor() {
return new UserAuthRestInterceptor();
}
@Bean
LogInterceptor getLogInterceptor() {
return new LogInterceptor();
}
/**

View File

@@ -0,0 +1,32 @@
package com.epri.fx.server.entity.log;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* gate_log
* @author
*/
@Data
public class GateLog implements Serializable {
private Integer id;
private String menu;
private String opt;
private String uri;
private Date crtTime;
private String crtUser;
private String crtName;
private String crtHost;
private String body;
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,115 @@
package com.epri.fx.server.entity.log;
import java.io.Serializable;
import java.util.Date;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-07-01 11:18
*/
public class LogInfo implements Serializable{
private String id;
private String menu;
private String opt;
private String uri;
private Long crtTime;
private String crtUser;
private String crtName;
private String crtHost;
private String body;
public LogInfo(String menu, String option, String uri, Date crtTime, String crtUser, String crtName, String crtHost, String body) {
this.menu = menu;
this.opt = option;
this.uri = uri;
this.crtTime = crtTime.getTime();
this.crtUser = crtUser;
this.crtName = crtName;
this.crtHost = crtHost;
this.body = body;
}
public LogInfo() {
}
public String getMenu() {
return menu;
}
public void setMenu(String menu) {
this.menu = menu;
}
public String getOpt() {
return opt;
}
public void setOpt(String option) {
this.opt = option;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public Long getCrtTime() {
return crtTime;
}
public void setCrtTime(Date crtTime) {
this.crtTime = crtTime.getTime();
}
public String getCrtUser() {
return crtUser;
}
public void setCrtUser(String crtUser) {
this.crtUser = crtUser;
}
public String getCrtName() {
return crtName;
}
public void setCrtName(String crtName) {
this.crtName = crtName;
}
public String getCrtHost() {
return crtHost;
}
public void setCrtHost(String crtHost) {
this.crtHost = crtHost;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

View File

@@ -0,0 +1,33 @@
package com.epri.fx.server.filter;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* @author 01
* @program wrapper-demo
* @description 替换HttpServletRequest
* @create 2018-12-24 21:04
* @since 1.0
**/
@Slf4j
public class ReplaceStreamFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
log.info("StreamFilter初始化...");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
ServletRequest requestWrapper = new RequestWrapper((HttpServletRequest) request);
chain.doFilter(requestWrapper, response);
}
@Override
public void destroy() {
log.info("StreamFilter销毁...");
}
}

View File

@@ -0,0 +1,124 @@
package com.epri.fx.server.filter;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.*;
import java.nio.charset.Charset;
/**
* @author 01
* @program wrapper-demo
* @description 包装HttpServletRequest目的是让其输入流可重复读
* @create 2018-12-24 20:48
* @since 1.0
**/
@Slf4j
public class RequestWrapper extends HttpServletRequestWrapper {
/**
* 存储body数据的容器
*/
private final byte[] body;
public RequestWrapper(HttpServletRequest request) throws IOException {
super(request);
// 将body数据存储起来
String bodyStr = getBodyString(request);
body = bodyStr.getBytes(Charset.defaultCharset());
}
/**
* 获取请求Body
*
* @param request request
* @return String
*/
public String getBodyString(final ServletRequest request) {
try {
return inputStream2String(request.getInputStream());
} catch (IOException e) {
log.error("", e);
throw new RuntimeException(e);
}
}
/**
* 获取请求Body
*
* @return String
*/
public String getBodyString() {
final InputStream inputStream = new ByteArrayInputStream(body);
return inputStream2String(inputStream);
}
/**
* 将inputStream里的数据读取出来并转换成字符串
*
* @param inputStream inputStream
* @return String
*/
private String inputStream2String(InputStream inputStream) {
StringBuilder sb = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream, Charset.defaultCharset()));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
log.error("", e);
throw new RuntimeException(e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
log.error("", e);
}
}
}
return sb.toString();
}
@Override
public BufferedReader getReader() throws IOException {
return new BufferedReader(new InputStreamReader(getInputStream()));
}
@Override
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(body);
return new ServletInputStream() {
@Override
public int read() throws IOException {
return inputStream.read();
}
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {
}
};
}
}

View File

@@ -0,0 +1,149 @@
package com.epri.fx.server.interceptor;
import com.epri.fx.server.config.UserConfiguration;
import com.epri.fx.server.context.BaseContextHandler;
import com.epri.fx.server.entity.log.LogInfo;
import com.epri.fx.server.filter.RequestWrapper;
import com.epri.fx.server.jwt.IJWTInfo;
import com.epri.fx.server.service.PermissionService;
import com.epri.fx.server.service.log.GateLogService;
import com.epri.fx.server.util.DBLog;
import com.epri.fx.server.util.user.JwtTokenUtil;
import com.epri.fx.server.vo.PermissionInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Created by ace on 2017/9/10.
*/
public class LogInterceptor extends HandlerInterceptorAdapter {
private Logger logger = LoggerFactory.getLogger(LogInterceptor.class);
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Autowired
private UserConfiguration userConfiguration;
@Autowired
private GateLogService gateLogService;
@Autowired
private PermissionService permissionService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HandlerMethod handlerMethod = (HandlerMethod) handler;
String token = request.getHeader(userConfiguration.getUserTokenHeader());
IJWTInfo infoFromToken = jwtTokenUtil.getInfoFromToken(token);
HttpServletRequest requestWrapper = null;
//遇到post方法才对request进行包装
String methodType = request.getMethod();
List<PermissionInfo> permissionIfs = permissionService.getAllPermission();
// 判断资源是否启用权限约束
Stream<PermissionInfo> stream = getPermissionIfs(request.getRequestURI(), request.getMethod().toString(), permissionIfs);
List<PermissionInfo> result = stream.collect(Collectors.toList());
PermissionInfo[] permissions = result.toArray(new PermissionInfo[]{});
if (permissions.length > 0) {
checkUserPermission(permissions, request, infoFromToken);
}
return super.preHandle(request, response, handler);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
BaseContextHandler.remove();
super.afterCompletion(request, response, handler, ex);
}
private boolean checkUserPermission(PermissionInfo[] permissions, HttpServletRequest ctx, IJWTInfo user) {
List<PermissionInfo> permissionInfos = permissionService.getPermissionByUsername(user.getUniqueName());
PermissionInfo current = null;
for (PermissionInfo info : permissions) {
boolean anyMatch = permissionInfos.parallelStream().anyMatch(permissionInfo -> permissionInfo.getCode().equals(info.getCode()));
if (anyMatch) {
current = info;
break;
}
}
if (current == null) {
return true;
} else {
if (!RequestMethod.GET.toString().equals(current.getMethod())) {
setCurrentUserInfoAndLog(ctx, user, current);
}
return false;
}
}
private void setCurrentUserInfoAndLog(HttpServletRequest request, IJWTInfo user, PermissionInfo pm) {
String host = request.getRemoteHost();
if (isJson(request)) {
// 获取json字符串
String jsonParam = null;
try {
jsonParam = new RequestWrapper(request).getBodyString();
LogInfo logInfo = new LogInfo(pm.getMenu(), pm.getName(), pm.getUri(), new Date(), user.getId(), user.getName(), host, jsonParam);
DBLog.getInstance().setLogService(gateLogService).offerQueue(logInfo);
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 获取目标权限资源
*
* @param requestUri
* @param method
* @param serviceInfo
* @return
*/
private Stream<PermissionInfo> getPermissionIfs(final String requestUri, final String method, List<PermissionInfo> serviceInfo) {
return serviceInfo.parallelStream().filter(permissionInfo -> {
String uri = permissionInfo.getUri();
if (uri.indexOf("{") > 0) {
uri = uri.replaceAll("\\{\\*\\}", "[a-zA-Z\\\\d]+");
}
String regEx = "^" + uri + "$";
return (Pattern.compile(regEx).matcher(requestUri).find())
&& method.equals(permissionInfo.getMethod());
});
}
/**
* 判断本次请求的数据类型是否为json
*
* @param request request
* @return boolean
*/
private boolean isJson(HttpServletRequest request) {
if (request.getContentType() != null) {
return request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE) ||
request.getContentType().equals(MediaType.APPLICATION_JSON_UTF8_VALUE);
}
return false;
}
}

View File

@@ -4,6 +4,8 @@ package com.epri.fx.server.interceptor;
import com.epri.fx.server.config.UserConfiguration;
import com.epri.fx.server.context.BaseContextHandler;
import com.epri.fx.server.jwt.IJWTInfo;
import com.epri.fx.server.service.PermissionService;
import com.epri.fx.server.service.log.GateLogService;
import com.epri.fx.server.util.user.JwtTokenUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,6 +25,10 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
private JwtTokenUtil jwtTokenUtil;
@Autowired
private UserConfiguration userConfiguration;
@Autowired
private GateLogService gateLogService;
@Autowired
private PermissionService permissionService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
@@ -32,6 +38,7 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
BaseContextHandler.setUsername(infoFromToken.getUniqueName());
BaseContextHandler.setName(infoFromToken.getName());
BaseContextHandler.setUserID(infoFromToken.getId());
return super.preHandle(request, response, handler);
}
@@ -40,4 +47,5 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
BaseContextHandler.remove();
super.afterCompletion(request, response, handler, ex);
}
}

View File

@@ -0,0 +1,23 @@
package com.epri.fx.server.mapper;
import com.epri.fx.server.entity.User;
import com.epri.fx.server.entity.log.GateLog;
import java.util.List;
public interface GateLogMapper {
int deleteByPrimaryKey(Integer id);
int insert(GateLog record);
int insertSelective(GateLog record);
GateLog selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(GateLog record);
int updateByPrimaryKey(GateLog record);
List<GateLog> selectPage(String keyId);
}

View File

@@ -0,0 +1,53 @@
package com.epri.fx.server.rest;
import com.epri.fx.server.entity.User;
import com.epri.fx.server.entity.UserInfo;
import com.epri.fx.server.entity.log.GateLog;
import com.epri.fx.server.entity.log.LogInfo;
import com.epri.fx.server.msg.ObjectRestResponse;
import com.epri.fx.server.msg.TableResultResponse;
import com.epri.fx.server.service.PermissionService;
import com.epri.fx.server.service.UserService;
import com.epri.fx.server.service.log.GateLogService;
import com.epri.fx.server.vo.FrontUser;
import com.epri.fx.server.vo.MenuVO;
import com.epri.fx.server.vo.PermissionInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Description:
* @param:
* @return:
* @auther: liwen
* @date: 2020/9/11 9:28 上午
*/
@RestController
@RequestMapping("log")
public class LogController {
@Autowired
private GateLogService gateLogService;
@GetMapping(value = "/page")
@ResponseBody
public TableResultResponse<GateLog> getPageList(@RequestParam Map<String, Object> params) {
return gateLogService.getPageList(params);
}
@DeleteMapping("/{id}")
@ResponseBody
public ObjectRestResponse<Integer> add(@PathVariable Integer id) {
return gateLogService.remove(id);
}
}

View File

@@ -37,7 +37,7 @@ public class GroupTypeService {
public Integer addGroupType(GroupTypeVO groupTypeVO) {
GroupType groupType = new GroupType();
BeanUtils.copyProperties(groupTypeVO, groupType);
EntityUtils.setCreateInfo(groupType);
EntityUtils.setCreatAndUpdatInfo(groupType);
groupType.setId(null);
return groupTypeMapper.insertSelective(groupType);
}

View File

@@ -0,0 +1,55 @@
package com.epri.fx.server.service.log;
import com.alibaba.druid.util.StringUtils;
import com.epri.fx.server.entity.log.GateLog;
import com.epri.fx.server.entity.log.LogInfo;
import com.epri.fx.server.mapper.GateLogMapper;
import com.epri.fx.server.msg.ObjectRestResponse;
import com.epri.fx.server.msg.TableResultResponse;
import com.epri.fx.server.util.Query;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @description:
* @className: GateLogService
* @author: liwen
* @date: 2020/12/3 10:33
*/
@Service
public class GateLogService {
@Autowired
private GateLogMapper gateLogMapper;
public void saveLog(LogInfo info){
GateLog log = new GateLog();
BeanUtils.copyProperties(info,log);
log.setCrtTime(new Date(info.getCrtTime()));
gateLogMapper.insertSelective(log);
}
public TableResultResponse<GateLog> getPageList(Map<String, Object> params) {
Query query = new Query(params);
Page<Object> page = PageHelper.startPage(query.getPage(), query.getLimit());
String keyId = (String) params.get("keyId");
List<GateLog> list = gateLogMapper.selectPage(StringUtils.isEmpty(keyId) ? null : keyId);
int total = (int) Math.ceil(page.getTotal() / (float) query.getLimit());
return new TableResultResponse<GateLog>(total == 0 ? 1 : total, list);
}
public ObjectRestResponse<Integer> remove(Integer id) {
gateLogMapper.deleteByPrimaryKey(id);
return new ObjectRestResponse<Integer>().rel(true);
}
}

View File

@@ -0,0 +1,86 @@
package com.epri.fx.server.util;
import com.epri.fx.server.entity.log.LogInfo;
import com.epri.fx.server.service.log.GateLogService;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-07-01 15:28
*/
@Slf4j
public class DBLog extends Thread {
private static DBLog dblog = null;
private static BlockingQueue<LogInfo> logInfoQueue = new LinkedBlockingQueue<LogInfo>(1024);
public GateLogService get() {
return logService;
}
public DBLog setLogService(GateLogService logService) {
if (this.logService == null) {
this.logService = logService;
}
return this;
}
private GateLogService logService;
public static synchronized DBLog getInstance() {
if (dblog == null) {
dblog = new DBLog();
}
return dblog;
}
private DBLog() {
super("CLogOracleWriterThread");
}
public void offerQueue(LogInfo logInfo) {
try {
logInfoQueue.offer(logInfo);
} catch (Exception e) {
log.error("日志写入失败", e);
}
}
@Override
public void run() {
List<LogInfo> bufferedLogList = new ArrayList<LogInfo>(); // 缓冲队列
while (true) {
try {
bufferedLogList.add(logInfoQueue.take());
logInfoQueue.drainTo(bufferedLogList);
if (bufferedLogList != null && bufferedLogList.size() > 0) {
// 写入日志
for (LogInfo log : bufferedLogList) {
logService.saveLog(log);
}
}
} catch (Exception e) {
e.printStackTrace();
// 防止缓冲队列填充数据出现异常时不断刷屏
try {
Thread.sleep(1000);
} catch (Exception eee) {
}
} finally {
if (bufferedLogList != null && bufferedLogList.size() > 0) {
try {
bufferedLogList.clear();
} catch (Exception e) {
}
}
}
}
}
}

View File

@@ -5,8 +5,6 @@ spring:
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
druid:
#url: jdbc:dm://10.105.73.121:12345/EMSHIS
# url: jdbc:dm://192.168.1.210:12345/EMSHIS
url: jdbc:mysql://${MYSQL_HOST:10.211.55.3}:${MYSQL_PORT:3306}/ipsm_dba?serverTimezone=Asia/Shanghai
username: root
password: Root@12345
@@ -35,8 +33,8 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
mybatis:
basepackage: com.wlkj.ipsm.realtime.mapper
xmlLocation: classpath:mapper/**/*.xml
basepackage: com.epri.fx.server.mapper
xmlLocation: classpath:mapper/*.xml
mapper-locations: "classpath*:mapper/*.xml"
#分页控件配置

View File

@@ -0,0 +1,147 @@
<?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="com.epri.fx.server.mapper.GateLogMapper">
<resultMap id="BaseResultMap" type="com.epri.fx.server.entity.log.GateLog">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="menu" jdbcType="VARCHAR" property="menu"/>
<result column="opt" jdbcType="VARCHAR" property="opt"/>
<result column="uri" jdbcType="VARCHAR" property="uri"/>
<result column="crt_time" jdbcType="TIMESTAMP" property="crtTime"/>
<result column="crt_user" jdbcType="VARCHAR" property="crtUser"/>
<result column="crt_name" jdbcType="VARCHAR" property="crtName"/>
<result column="crt_host" jdbcType="VARCHAR" property="crtHost"/>
<result column="body" jdbcType="VARCHAR" property="body"/>
</resultMap>
<sql id="Base_Column_List">
id, menu, opt, uri, crt_time, crt_user, crt_name, crt_host, body
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from gate_log
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from gate_log
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.epri.fx.server.entity.log.GateLog"
useGeneratedKeys="true">
insert into gate_log (menu, opt, uri,
crt_time, crt_user, crt_name,
crt_host, body)
values (#{menu,jdbcType=VARCHAR}, #{opt,jdbcType=VARCHAR}, #{uri,jdbcType=VARCHAR},
#{crtTime,jdbcType=TIMESTAMP}, #{crtUser,jdbcType=VARCHAR}, #{crtName,jdbcType=VARCHAR},
#{crtHost,jdbcType=VARCHAR}, #{body,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.epri.fx.server.entity.log.GateLog"
useGeneratedKeys="true">
insert into gate_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="menu != null">
menu,
</if>
<if test="opt != null">
opt,
</if>
<if test="uri != null">
uri,
</if>
<if test="crtTime != null">
crt_time,
</if>
<if test="crtUser != null">
crt_user,
</if>
<if test="crtName != null">
crt_name,
</if>
<if test="crtHost != null">
crt_host,
</if>
<if test="body != null">
body,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="menu != null">
#{menu,jdbcType=VARCHAR},
</if>
<if test="opt != null">
#{opt,jdbcType=VARCHAR},
</if>
<if test="uri != null">
#{uri,jdbcType=VARCHAR},
</if>
<if test="crtTime != null">
#{crtTime,jdbcType=TIMESTAMP},
</if>
<if test="crtUser != null">
#{crtUser,jdbcType=VARCHAR},
</if>
<if test="crtName != null">
#{crtName,jdbcType=VARCHAR},
</if>
<if test="crtHost != null">
#{crtHost,jdbcType=VARCHAR},
</if>
<if test="body != null">
#{body,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.epri.fx.server.entity.log.GateLog">
update gate_log
<set>
<if test="menu != null">
menu = #{menu,jdbcType=VARCHAR},
</if>
<if test="opt != null">
opt = #{opt,jdbcType=VARCHAR},
</if>
<if test="uri != null">
uri = #{uri,jdbcType=VARCHAR},
</if>
<if test="crtTime != null">
crt_time = #{crtTime,jdbcType=TIMESTAMP},
</if>
<if test="crtUser != null">
crt_user = #{crtUser,jdbcType=VARCHAR},
</if>
<if test="crtName != null">
crt_name = #{crtName,jdbcType=VARCHAR},
</if>
<if test="crtHost != null">
crt_host = #{crtHost,jdbcType=VARCHAR},
</if>
<if test="body != null">
body = #{body,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.epri.fx.server.entity.log.GateLog">
update gate_log
set menu = #{menu,jdbcType=VARCHAR},
opt = #{opt,jdbcType=VARCHAR},
uri = #{uri,jdbcType=VARCHAR},
crt_time = #{crtTime,jdbcType=TIMESTAMP},
crt_user = #{crtUser,jdbcType=VARCHAR},
crt_name = #{crtName,jdbcType=VARCHAR},
crt_host = #{crtHost,jdbcType=VARCHAR},
body = #{body,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectPage" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from gate_log
<where>
<if test="keyId != null">
and crt_name like #{keyId,jdbcType=VARCHAR} or crt_host like #{keyId,jdbcType=VARCHAR}
</if>
</where>
</select>
</mapper>