1.類
public class PollingDataDTO { private Integer pointId; private byte[] image; public Integer getPointId() { return pointId; } public void setPointId(Integer pointId) { this.pointId = pointId; } public byte[] getImage() { return image; } public void setImage(byte[] image) { this.image = image; } }
2.保存本地圖片
// 執行代碼 public voidgetImage(Integer pointId) throws Exception { File file = new File("C:\\Users\\Administrator\\Desktop\\002.png"); //本地圖片 byte[] b= FileCopyUtils.copyToByteArray(file); PollingDataDTO dto = pollingDataMapper.getByPointId(pointId); dto.setImage(b); pollingDataMapper.updateByPrimaryKey(dto); }