| | |
| | | import java.sql.SQLException; |
| | | |
| | | import com.moral.common.json.BooleanValueFilter; |
| | | import com.moral.entity.alarm.AlarmConfig; |
| | | import com.moral.entity.alarm.AlarmConfigValue; |
| | | import org.apache.ibatis.type.BaseTypeHandler; |
| | | import org.apache.ibatis.type.JdbcType; |
| | |
| | | import org.apache.ibatis.type.MappedTypes; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author fengxiang |
| | |
| | | @MappedJdbcTypes({JdbcType.OTHER}) |
| | | @MappedTypes({AlarmConfigValue.class}) |
| | | public class AlarmConfigValueHandle extends BaseTypeHandler<AlarmConfigValue> { |
| | | @Resource |
| | | private BooleanValueFilter booleanValueFilter; |
| | | @Override |
| | | public AlarmConfigValue getNullableResult(ResultSet resultSet, String s) throws SQLException { |
| | | return JSON.parseObject(resultSet.getString(s),AlarmConfigValue.class); |
| | |
| | | @Override |
| | | public void setNonNullParameter(PreparedStatement preparedStatement, int i, AlarmConfigValue alarmConfigValue, JdbcType jdbcType) |
| | | throws SQLException { |
| | | preparedStatement.setString(i,JSON.toJSONString(alarmConfigValue,booleanValueFilter)); |
| | | preparedStatement.setString(i,JSON.toJSONString(alarmConfigValue,new BooleanValueFilter())); |
| | | } |
| | | |
| | | } |