暂时取消压缩功能
This commit is contained in:
parent
5f6368d1b5
commit
8239567c9e
|
@ -15,14 +15,9 @@ public class CompressUtils {
|
|||
* @return
|
||||
*/
|
||||
public static Object zip(Object data) {
|
||||
if (!(data instanceof byte[]) && !(data instanceof String)) {
|
||||
if (!(data instanceof byte[])) {
|
||||
return data;
|
||||
}
|
||||
boolean isString = false;
|
||||
if (data instanceof String) {
|
||||
isString = true;
|
||||
data = ((String) data).getBytes();
|
||||
}
|
||||
|
||||
byte[] temp = (byte[]) data;
|
||||
byte[] b = (byte[]) data;
|
||||
|
@ -41,9 +36,6 @@ public class CompressUtils {
|
|||
LogUtil.error(ex);
|
||||
}
|
||||
|
||||
if (isString) {
|
||||
return new String(b);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,14 +3,16 @@ package io.metersphere.commons.utils;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class DBCompressConfig implements MybatisInterceptorConfigHolder {
|
||||
@Override
|
||||
public List<MybatisInterceptorConfig> interceptorConfig() {
|
||||
return Arrays.asList(
|
||||
new MybatisInterceptorConfig("io.metersphere.base.domain.FileContent", "file", "io.metersphere.commons.utils.CompressUtils", "zip", "unzip")
|
||||
);
|
||||
// return Arrays.asList(
|
||||
// new MybatisInterceptorConfig("io.metersphere.base.domain.FileContent", "file", "io.metersphere.commons.utils.CompressUtils", "zip", "unzip")
|
||||
// );
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package io.metersphere;
|
|||
|
||||
import io.metersphere.base.domain.User;
|
||||
import io.metersphere.base.mapper.UserMapper;
|
||||
import io.metersphere.commons.utils.CompressUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -11,15 +12,16 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
//@RunWith(SpringRunner.class)
|
||||
//@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class ApplicationTests {
|
||||
@Resource
|
||||
UserMapper userMapper;
|
||||
// @Resource
|
||||
// UserMapper userMapper;
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
List<User> users = userMapper.selectByExample(null);
|
||||
System.out.println(users);
|
||||
final Object test = CompressUtils.zip("test".getBytes());
|
||||
final Object unzip = CompressUtils.unzip(test);
|
||||
System.out.println(new String((byte[]) unzip));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue