-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from iamazy/master
解决生产消费详情broker页面显示问题
- Loading branch information
Showing
37 changed files
with
620 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...ository-mybatis/src/main/java/org/joyqueue/repository/mybatis/handler/MapTypeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.joyqueue.repository.mybatis.handler; | ||
|
||
|
||
import com.alibaba.fastjson.JSON; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.ibatis.type.BaseTypeHandler; | ||
import org.apache.ibatis.type.JdbcType; | ||
|
||
import java.sql.CallableStatement; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author jiangnan53 | ||
* @date 2020/6/22 | ||
**/ | ||
public class MapTypeHandler extends BaseTypeHandler<Map<String, String>> { | ||
|
||
private Class<Map<String, String>> clazz; | ||
|
||
public MapTypeHandler(Class<Map<String, String>> clazz) { | ||
this.clazz = clazz; | ||
} | ||
|
||
public MapTypeHandler() {} | ||
|
||
@Override | ||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, Map o, JdbcType jdbcType) throws SQLException { | ||
if (o != null) { | ||
preparedStatement.setString(i, JSON.toJSONString(o)); | ||
} else { | ||
preparedStatement.setString(i, null); | ||
} | ||
} | ||
|
||
@Override | ||
public Map<String, String> getNullableResult(ResultSet resultSet, String s) throws SQLException { | ||
if (StringUtils.isNotBlank(s)) { | ||
return JSON.parseObject(resultSet.getString(s), clazz); | ||
} | ||
return Collections.emptyMap(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getNullableResult(ResultSet resultSet, int i) throws SQLException { | ||
String result = resultSet.getString(i); | ||
if (StringUtils.isNotBlank(result)) { | ||
return JSON.parseObject(result, clazz); | ||
} | ||
return Collections.emptyMap(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getNullableResult(CallableStatement callableStatement, int i) throws SQLException { | ||
String result = callableStatement.getString(i); | ||
if (StringUtils.isNotBlank(result)) { | ||
return JSON.parseObject(result, clazz); | ||
} | ||
return Collections.emptyMap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.