// 根据ownerId(place_id, statment_id)获取项目报告文件列表 List pics = projectreportFileMapper.listByOwnerId(place_id, statment_id); List items = new ArrayList<>(); // 创建PicItem列表 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 创建日期格式化对象

// 遍历项目报告文件列表 for (TProjectreportFile pic : pics) { PicItem it = new PicItem(); // 创建PicItem对象 it.setId(pic.getId()); // 设置PicItem的ID属性 it.setTime(pic.getCreateat() != null ? format.format(pic.getCreateat()) : ""); // 设置PicItem的时间属性(格式化日期) it.setRemark(pic.getRemark()); // 设置PicItem的备注属性

try {
    it.setPath(pic.getPath() != null ? FilePathUtil.getQYPath(pic.getPath()) : ""); // 设置PicItem的路径属性(获取文件路径)
} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

items.add(it); // 将PicItem对象添加到列表中

}

return items; // 返回PicItem列表

Java 代码示例:根据ownerId获取项目报告文件列表并转换为PicItem对象

原文地址: https://www.cveoy.top/t/topic/p2qG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录