| | |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @Intercepts({@Signature(type = Executor.class, method = "update" , args = {MappedStatement.class, |
| | | @Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, |
| | | Object.class})}) |
| | | public class MybatisInterceptor implements Interceptor { |
| | | |
| | |
| | | field.setAccessible(false); |
| | | } |
| | | } |
| | | //注入创建时间 |
| | | // 注入创建时间 |
| | | if ("createTime".equals(field.getName())) { |
| | | field.setAccessible(true); |
| | | field.set(parameter, new Date()); |
| | | field.setAccessible(false); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("failed to insert data, exception = " , e); |
| | | log.error("failed to insert data, exception = ", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | field.setAccessible(false); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("failed to update data, exception = " , e); |
| | | log.error("failed to update data, exception = ", e); |
| | | } |
| | | } |
| | | } |