use of com.bc.pmpheep.back.vo.TextbookLogVO in project pmph by BCSquad.
the class TextbookLogServiceImpl method listTextbookLogByTextBookId.
@Override
public PageResult<TextbookLogVO> listTextbookLogByTextBookId(Long textbookId, Integer pageSize, Integer pageNumber, String updaterName) throws CheckedServiceException {
if (null == textbookId) {
throw new CheckedServiceException(CheckedExceptionBusiness.TEXTBOOK_LOG, CheckedExceptionResult.NULL_PARAM, "书籍为空!");
}
Map<String, Object> map = new HashMap<String, Object>(2);
map.put("textbookId", textbookId);
updaterName = StringUtil.toAllCheck(updaterName);
if (null != updaterName) {
map.put("updaterName", updaterName);
}
// 包装参数实体
PageParameter<Map<String, Object>> pageParameter = new PageParameter<Map<String, Object>>(pageNumber, pageSize, map);
// 返回实体
PageResult<TextbookLogVO> pageResult = new PageResult<TextbookLogVO>();
// 参数拷贝
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
// 获取总数
Integer total = textbookLogDao.listTotalTextbookLogByTextBookId(pageParameter);
if (null != total && total > 0) {
List<TextbookLog> rows = textbookLogDao.listTextbookLogByTextBookId(pageParameter);
List<TextbookLogVO> newRows = new ArrayList<TextbookLogVO>(rows.size());
for (TextbookLog textbookLog : rows) {
Long id = textbookLog.getId();
String detail = textbookLog.getDetail();
Timestamp gmtCreate = textbookLog.getGmtCreate();
detail = detail.replace("{gmt_create}", DateUtil.format(gmtCreate));
newRows.add(new TextbookLogVO(id, detail));
}
pageResult.setRows(newRows);
}
pageResult.setTotal(total);
return pageResult;
}
Aggregations