修复
This commit is contained in:
parent
9dab03231f
commit
02e8edbce7
@ -1,6 +1,7 @@
|
||||
package com.example.demo.common.config.orm.listener;
|
||||
|
||||
import com.mybatisflex.annotation.InsertListener;
|
||||
import com.mybatisflex.annotation.SetListener;
|
||||
import com.mybatisflex.annotation.UpdateListener;
|
||||
import com.example.demo.common.domain.BaseEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -15,7 +16,7 @@ import java.util.Date;
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
public class FlexListener implements InsertListener, UpdateListener {
|
||||
public class FlexListener implements InsertListener, UpdateListener, SetListener {
|
||||
|
||||
/**
|
||||
* 插入前监听
|
||||
@ -53,4 +54,9 @@ public class FlexListener implements InsertListener, UpdateListener {
|
||||
baseEntity.setUpdatedTime(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object onSet(Object entity, String property, Object value) {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package com.example.demo.common.domain;
|
||||
|
||||
import com.example.demo.common.config.orm.handler.SqliteDateTypeHandler;
|
||||
import com.example.demo.common.config.orm.listener.FlexListener;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
@ -33,7 +32,13 @@ import java.util.Date;
|
||||
@Accessors(chain=true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(value = "demo", onInsert = FlexListener.class, onUpdate = FlexListener.class)
|
||||
@Table(
|
||||
value = "",
|
||||
comment = "基本类没有对应的表!",
|
||||
onInsert = FlexListener.class,
|
||||
onUpdate = FlexListener.class,
|
||||
onSet = FlexListener.class
|
||||
)
|
||||
public class BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
@ -81,10 +86,6 @@ public class BaseEntity implements Serializable {
|
||||
* Column(onInsertValue = "datetime('now', 'localtime')")
|
||||
*/
|
||||
// @Column(onInsertValue = "datetime('now', 'localtime')")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@com.mybatisflex.annotation.Column(typeHandler = SqliteDateTypeHandler.class)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Schema(description = "创建时间")
|
||||
@ -105,10 +106,6 @@ public class BaseEntity implements Serializable {
|
||||
* Column(onUpdateValue = "datetime('now', 'localtime')", onInsertValue = "datetime('now', 'localtime')")
|
||||
*/
|
||||
// @Column(onUpdateValue = "datetime('now', 'localtime')", onInsertValue = "datetime('now', 'localtime')")
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@com.mybatisflex.annotation.Column(typeHandler = SqliteDateTypeHandler.class)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Schema(description = "更新时间")
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.example.demo.common.domain;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import cn.zhxu.bs.bean.DbIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@ -39,13 +39,15 @@ public class BaseVO implements Serializable {
|
||||
/**
|
||||
* 键
|
||||
*/
|
||||
@Schema(description = "key")
|
||||
@DbIgnore
|
||||
@Schema(description = "键")
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "name")
|
||||
@DbIgnore
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
@ -58,6 +60,7 @@ public class BaseVO implements Serializable {
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@DbIgnore
|
||||
@Schema(description = "创建人ID")
|
||||
private String createdId;
|
||||
|
||||
@ -71,6 +74,7 @@ public class BaseVO implements Serializable {
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
@DbIgnore
|
||||
@Schema(description = "更新人ID")
|
||||
private String updatedId;
|
||||
|
||||
|
@ -26,7 +26,11 @@ import java.util.Date;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(value = "file_record", onInsert = FlexListener.class, onUpdate = FlexListener.class)
|
||||
@Table(value = "file_record",
|
||||
onInsert = FlexListener.class,
|
||||
onUpdate = FlexListener.class,
|
||||
onSet = FlexListener.class
|
||||
)
|
||||
public class FileRecordEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
|
@ -25,7 +25,11 @@ import java.io.Serial;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(value = "mapper_rule", onInsert = FlexListener.class, onUpdate = FlexListener.class)
|
||||
@Table(value = "mapper_rule",
|
||||
onInsert = FlexListener.class,
|
||||
onUpdate = FlexListener.class,
|
||||
onSet = FlexListener.class
|
||||
)
|
||||
public class MapperRuleEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
|
@ -25,7 +25,11 @@ import java.io.Serial;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(value = "parse_rule", onInsert = FlexListener.class, onUpdate = FlexListener.class)
|
||||
@Table(value = "parse_rule",
|
||||
onInsert = FlexListener.class,
|
||||
onUpdate = FlexListener.class,
|
||||
onSet = FlexListener.class
|
||||
)
|
||||
public class ParseRuleEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
|
@ -27,7 +27,7 @@ import java.io.Serializable;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SearchBean(
|
||||
tables = "parse_rule",
|
||||
tables = "parse_rule a",
|
||||
autoMapTo = "a"
|
||||
)
|
||||
public class ParseRuleVO extends BaseVO implements TransPojo, Serializable {
|
||||
|
@ -0,0 +1,3 @@
|
||||
bean-searcher:
|
||||
sql:
|
||||
dialect: mysql
|
@ -1,14 +1,22 @@
|
||||
# Bean-Searcher 配置
|
||||
bean-searcher:
|
||||
sql:
|
||||
# dialect: mysql
|
||||
default-mapping:
|
||||
#表名和字段名是否驼峰转小写下划线(since v3.7.0)
|
||||
underline-case: true
|
||||
#表名和字段名是否大写
|
||||
upper-case: true
|
||||
upper-case: false
|
||||
redundant-suffixes:
|
||||
- VO
|
||||
- DTO
|
||||
params:
|
||||
pagination:
|
||||
type: page
|
||||
# 起始页码 或 起始偏移量
|
||||
start: 0
|
||||
# 每页最大查询条数(分页保护)
|
||||
max-allowed-size: 500
|
||||
|
||||
# MyBatisFlex公共配置
|
||||
# https://mybatis-flex.com/zh/base/configuration.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user