aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsWorkCalendar.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
aps-modules/aps-core/src/main/java/com/aps/core/typeHandler/JsonTypeHandler.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsWorkCalendar.java
@@ -41,7 +41,7 @@ /** 鏃ュ巻鍐呭 */ @Excel(name = "鏃ュ巻鍐呭") private String content; private Object content; /** 閫傜敤宸ュ巶 */ @Excel(name = "閫傜敤宸ュ巶") @@ -105,12 +105,12 @@ return expiringDate; } public void setContent(String content) public void setContent(Object content) { this.content = content; } public String getContent() public Object getContent() { return content; } aps-modules/aps-core/src/main/java/com/aps/core/typeHandler/JsonTypeHandler.java
对比新文件 @@ -0,0 +1,42 @@ package com.aps.core.typeHandler; import com.alibaba.fastjson2.JSON; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedTypes; import org.postgresql.util.PGobject; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @MappedTypes({Object.class}) public class JsonTypeHandler extends BaseTypeHandler<Object> { private static final PGobject jsonObject = new PGobject(); @Override public void setNonNullParameter(PreparedStatement preparedStatement, int i, Object o, JdbcType jdbcType) throws SQLException { jsonObject.setType("jsonb"); jsonObject.setValue(JSON.toJSONString(o)); preparedStatement.setObject(i, jsonObject); } @Override public Object getNullableResult(ResultSet resultSet, String s) throws SQLException { return resultSet.getString(s); } @Override public Object getNullableResult(ResultSet resultSet, int i) throws SQLException { return resultSet.getString(i); } @Override public Object getNullableResult(CallableStatement callableStatement, int i) throws SQLException { return callableStatement.getString(i); } } aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml
@@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.aps.core.mapper.ApsWorkCalendarMapper"> <resultMap type="ApsWorkCalendar" id="ApsWorkCalendarResult"> <result property="id" column="id" /> <result property="description" column="description" /> @@ -66,7 +66,7 @@ <if test="type != null">#{type},</if> <if test="effectiveDate != null">#{effectiveDate},</if> <if test="expiringDate != null">#{expiringDate},</if> <if test="content != null">#{content},</if> <if test="content != null">#{content, typeHandler=com.aps.core.typeHandler.JsonTypeHandler, jdbcType=OTHER},</if> <if test="applicableFactory != null">#{applicableFactory},</if> <if test="applicableWorkshop != null">#{applicableWorkshop},</if> <if test="applicableProcess != null">#{applicableProcess},</if>