Skip to content

Commit

Permalink
1.6.35
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed Mar 29, 2022
1 parent 47d9ff8 commit 3b5f27d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,34 @@ public class ProtostuffUtil {

//序列化对象
public static <T> byte[] serialize(T obj) {
LinkedBuffer buffer = LinkedBuffer.allocate();
LinkedBuffer buffer = null;

try {
buffer = LinkedBuffer.allocate();

Object serializerObj = DataWrapper.builder(obj);
Schema schema = WRAPPER_SCHEMA;

return ProtostuffIOUtil.toByteArray(serializerObj, schema, buffer);
} catch (Exception e) {
} catch (RuntimeException e) {
throw e;
} catch (Throwable e) {
throw new IllegalStateException(e.getMessage());
} finally {
buffer.clear();
if (buffer != null) {
buffer.clear();
}
}
}


public static <T> T deserialize(byte[] data) {
try {
DataWrapper<T> wrapper = new DataWrapper<>();
ProtostuffIOUtil.mergeFrom(data, wrapper, WRAPPER_SCHEMA);
return wrapper.getData();
} catch (Exception e) {
} catch (RuntimeException e) {
throw e;
} catch (Throwable e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baomidou.mybatisplus.solon.service.impl;
package com.baomidou.mybatisplus.solon.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
Expand All @@ -7,7 +7,6 @@
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.baomidou.mybatisplus.solon.service.IService;
import org.apache.ibatis.binding.MapperMethod;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,25 @@ private void create0(Class<?> clz, BeanWrap dsBw) {
private void inject0(VarHolder varH, BeanWrap dsBw) {
MybatisAdapter adapter = MybatisAdapterManager.get(dsBw);

//@Db("db1") SqlSessionFactory factory;
if (SqlSessionFactory.class.isAssignableFrom(varH.getType())) {
varH.setValue(adapter.getFactory());
return;
}

//@Db("db1") MybatisAdapter adapter;
if (MybatisAdapter.class.isAssignableFrom(varH.getType())) {
varH.setValue(adapter);
return;
}

//新增,@Db("db1") Configuration;
//@Db("db1") Configuration cfg;
if (Configuration.class.isAssignableFrom(varH.getType())) {
varH.setValue(adapter.getConfiguration());
return;
}

//@Db("db1") UserMapper userMapper;
if (varH.getType().isInterface()) {
Object mapper = adapter.getMapperProxy(varH.getType());

Expand Down

0 comments on commit 3b5f27d

Please sign in to comment.