Skip to content

Commit afb6bfe

Browse files
committed
feat: 添加 MAPPING 静态字段,用于 mybatis plus typeHandler
mybatis update set 方法 typeHandler 可以由 mapping 参数指定
1 parent ab409bd commit afb6bfe

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

common/src/main/java/top/cadecode/uniboot/common/mybatis/handler/BoolToIntTypeHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
@MappedJdbcTypes({JdbcType.INTEGER})
2121
public class BoolToIntTypeHandler extends BaseTypeHandler<Boolean> {
2222

23+
/**
24+
* 用于 mybatis plus update set mapping 参数指定 typeHandler 为 BoolToIntTypeHandler
25+
*/
26+
public static final String MAPPING = "typeHandler=BoolToIntTypeHandler";
27+
2328
@Override
2429
public void setNonNullParameter(PreparedStatement ps, int i, Boolean parameter, JdbcType jdbcType) throws SQLException {
2530
if (parameter) {

common/src/main/java/top/cadecode/uniboot/common/mybatis/handler/ObjToStrTypeHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
@MappedJdbcTypes(JdbcType.VARCHAR)
2323
public class ObjToStrTypeHandler extends BaseTypeHandler<Object> {
2424

25+
/**
26+
* 用于 mybatis plus update set mapping 参数指定 typeHandler 为 ObjToStrTypeHandler
27+
*/
28+
public static final String MAPPING = "typeHandler=ObjToStrTypeHandler";
29+
2530
private final Class<?> type;
2631

2732
public ObjToStrTypeHandler(Class<?> type) {

0 commit comments

Comments
 (0)