@RemoteMethod public ListRange findAll( TemplateShareGroupDetailDto filter, SortField[] sortFields, int start, int limit) { ListRange lr = new ListRange(); String hql = "FROM TemplateShareGroupDetail WHERE templateShare.templateFile.id = ? AND " + BusinessConstant.FIND_NOT_INCLUDE_DELETE_HQL + " ORDER BY create_date DESC"; int count = 0; List<TemplateShareGroupDetail> list = templateShareGroupDetailDaoImpl.findAll(hql, start, limit, filter.getTemplateFileId()); List<TemplateShareGroupDetailDto> dtoList = new ArrayList<TemplateShareGroupDetailDto>(); for (TemplateShareGroupDetail templateShareGroupDetail : list) { TemplateShareGroupDetailDto templateShareGroupDetailDto = dozerAssembly.bean2Dto(templateShareGroupDetail, TemplateShareGroupDetailDto.class); templateShareGroupDetailDto.setCreate_date( DateUtils.DateToDateTimeString(templateShareGroupDetail.getCreate_date())); if (templateShareGroupDetail.getAccount() != null && templateShareGroupDetail.getAccount().getPerson() != null) templateShareGroupDetailDto.setPersonName( templateShareGroupDetail.getAccount().getPerson().getName()); dtoList.add(templateShareGroupDetailDto); } count = templateShareGroupDetailDaoImpl.getCount(hql, filter.getTemplateFileId()); lr.setData(dtoList); lr.setTotalSize(count); return lr; }
public void saveGroupDetail( String shareGroupDetailId, String filePath, User user, String fileName, TemplateShare templateShare) { TemplateShareGroupDetail templateShareGroupDetail = null; if (!StringUtils.isEmpty(shareGroupDetailId)) templateShareGroupDetail = templateShareGroupDetailDaoImpl.findById(shareGroupDetailId); else templateShareGroupDetail = new TemplateShareGroupDetail(); templateShareGroupDetail.setAccount(user); templateShareGroupDetail.setCreate_date(DateUtils.getCurrentDateTime()); templateShareGroupDetail.setFileName(fileName); templateShareGroupDetail.setFilePath(filePath); templateShareGroupDetail.setTemplateShare(templateShare); templateShareGroupDetailDaoImpl.saveOrUpdate(templateShareGroupDetail); if (StringUtils.isEmpty(shareGroupDetailId)) templateFileLogService.addOperationLog( templateShare.getTemplateFile(), BusinessConstant.OPERATION_SHARE_GROUP_DETAIL_ADD, null); else templateFileLogService.addOperationLog( templateShare.getTemplateFile(), BusinessConstant.OPERATION_SHARE_GROUP_DETAIL_EDIT, null); }