/**
* To remove a AssayReturntypes
*
* @param request HttpServletRequest
* @param response HttpServletResponse
*/
@RequestMapping
public void removeStudys(HttpServletRequest request, HttpServletResponse response) {
WebContext webContext = new HttpServletRequestWebContext(request);
WorksheetState state = new SessionWorksheetState("studysTable", webContext);
Worksheet worksheet = state.retrieveWorksheet();
Collection<WorksheetRow> rows = worksheet.getRows();
List<Study> studys = new ArrayList<Study>();
StringBuffer buffer = new StringBuffer();
for (WorksheetRow row : rows) {
String idStr = row.getUniqueProperty().getValue();
Study study = new Study();
if(!StringUtils.isEmpty(idStr) && StringUtils.isNumeric(idStr)) {
study.setId(Integer.parseInt(idStr));
studys.add(study);
}
buffer.append(idStr);
}
if (!studyService.removeStudy(studys)) {
MessageUtils.outputJSONResult(buffer.toString(), response);
}
}
其中WorksheetState state = new SessionWorksheetState("studysTable", webContext);的studysTable为jmesa的id。
本文介绍了一种通过HTTP请求从数据库中批量删除研究案例的方法。使用了jmesa组件进行表格状态管理,并通过WorksheetState获取待删除记录。针对每条记录,通过其唯一标识解析并构造对应的实体对象,最后调用服务层接口完成删除操作。

被折叠的 条评论
为什么被折叠?



