| | |
| | | scale varchar(50), |
| | | resolution varchar(50), |
| | | gather timestamp(6) without time zone, |
| | | batch varchar(10), |
| | | batch varchar(50), |
| | | descr varchar(256), |
| | | create_user integer default 1, |
| | | create_time timestamp(6) without time zone default now(), |
| | |
| | | public MetaFileEntity selectById(int id); |
| | | |
| | | /** |
| | | * 根据GUID查询 |
| | | * |
| | | * @param guid |
| | | * @return |
| | | */ |
| | | public MetaFileEntity selectByGuid(String guid); |
| | | |
| | | /** |
| | | * 插入一条 |
| | | * |
| | | * @param entity |
| | |
| | | for (MetaFileEntity mf : list) { |
| | | // 移动文件 |
| | | File file = new File(temp + File.separator + mf.getPath()); |
| | | File newFile = new File(root + File.separator + mf.getName()); |
| | | file.renameTo(newFile); |
| | | File newFile = new File(root + File.separator + mf.getGuid()); |
| | | |
| | | MetaFileEntity old = metaFileService.selectByGuid(mf.getGuid()); |
| | | String filePath = null; |
| | | if (null == old) { |
| | | filePath = newFile.getPath(); |
| | | file.renameTo(newFile); |
| | | } else { |
| | | filePath = old.getPath(); |
| | | file.delete(); |
| | | } |
| | | |
| | | // 元数据 |
| | | MetaEntity me = createMetaEntity(entity); |
| | |
| | | |
| | | // 元数据文件 |
| | | MetaFileEntity mef = createMetaFileEntity(mf, entity); |
| | | mef.setPath(FileHelper.getRelativePath(newFile.getPath())); |
| | | mef.setPath(FileHelper.getRelativePath(filePath)); |
| | | |
| | | rows = metaFileService.insert(mef); |
| | | if (rows > 0) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public MetaFileEntity selectByGuid(String guid) { |
| | | return metaFileMapper.selectByGuid(guid); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insert(MetaFileEntity entity) { |
| | | return metaFileMapper.insert(entity); |
| | | } |
| | |
| | | select * from lf.sys_meta_file where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectByGuid" resultType="com.lf.server.entity.data.MetaFileEntity"> |
| | | select * from lf.sys_meta_file where guid = #{guid} limit 1 |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.lf.server.entity.data.MetaFileEntity"> |
| | | insert into lf.sys_meta_file |
| | | (name,metaid,fileid,guid,path,sizes,create_user,create_time) |