|
|
@ -230,12 +230,19 @@ public class ArchivesServiceImpl implements ArchivesService { |
|
|
|
return "成功更新"+result+"条数据。"; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object editFile(ArchivesDTO dto) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Object delete(ArchivesDTO dto) { |
|
|
|
ArchivesType archivesType = archivesTypeRepository.findById(dto.getCategoryId()).get(); |
|
|
|
List<String> ids = dto.getIds(); |
|
|
|
String queryTable = archivesType.getEnName(); |
|
|
|
String sql = "update " + queryTable + " set is_delete_time = '" +sdf.format(new Date())+"',is_delete_man='"+dto.getDelMan()+"' where id in ("+dto.getIds()+")"; |
|
|
|
String sql = "update " + queryTable + " set is_delete_time = '" +sdf.format(new Date())+"',is_delete_man='"+dto.getDelMan() |
|
|
|
+"' where id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')"; |
|
|
|
int result = entityManager.createNativeQuery(sql).executeUpdate(); |
|
|
|
return result; |
|
|
|
} |
|
|
@ -245,11 +252,12 @@ public class ArchivesServiceImpl implements ArchivesService { |
|
|
|
public Object completelyDelete(ArchivesDTO dto) { |
|
|
|
ArchivesType archivesType = archivesTypeRepository.findById(dto.getCategoryId()).get(); |
|
|
|
String queryTable = archivesType.getEnName(); |
|
|
|
String sql = "delete from " +queryTable+" where id in ("+dto.getIds()+")"; |
|
|
|
List<String> ids = dto.getIds(); |
|
|
|
String sql = "delete from " +queryTable+" where id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')"; |
|
|
|
int result = entityManager.createNativeQuery(sql).executeUpdate(); |
|
|
|
int result1 = 0; |
|
|
|
if(ArchivesTypeEnum.inChive.getCode() == archivesType.getIsType() || ArchivesTypeEnum.files.getCode() == archivesType.getIsType()){ |
|
|
|
String sql1 = "delete from file_" +queryTable+" where parents_id in ("+dto.getIds()+")"; |
|
|
|
String sql1 = "delete from file_" +queryTable+" where parents_id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')"; |
|
|
|
result1 = entityManager.createNativeQuery(sql1).executeUpdate(); |
|
|
|
} |
|
|
|
return result+","+result1; |
|
|
|