1. 在mapper的resultMap中定义对应列
1 | <resultMap id="queryBlobCloum" type="PicVO(指向vo类)"> |
2. 定义接收blob的vo类
采用byte[]方式接收blob字段1
2
3
4
5
public class PicVO {
private String uuid;
private byte[] pic;
}
3. select调用resultmap
1 | <select id="readPic" resultMap="queryBlobCloum"> |
4. 用文件流保存对应的byte[]字段
1 | InputStream in = new ByteArrayInputStream(picture); |