/** * 添加或修改数据 * * @param entity * @param request * @return * @throws Exception */ @RequestMapping(value = "/save", method = RequestMethod.POST) @ResponseBody public Object save(@RequestBody RefundLogEntity entity, HttpServletRequest request) throws Exception { Date date = new Date(); if (entity.getId() == null || StringUtils.isBlank(entity.getId().toString())) { entity.setCreateDate(date); entity.setModifyDate(date); refundLogService.add(entity); } else { entity.setModifyDate(date); refundLogService.update(entity); } return sendSuccessMessage(); }
/** * 获取数据 * * @param id * @param request * @return * @throws Exception */ @RequestMapping("/getId") @ResponseBody public Object getId(String id, HttpServletRequest request) throws Exception { RefundLogEntity entity = refundLogService.findById(id); if (entity == null) { return sendFailureMessage("没有找到对应的记录!"); } return entity; }
/** * 列表数据 * * @param entity * @param request * @return * @throws Exception */ @RequestMapping("/dataList") @ResponseBody public Object datalist(RefundLogEntity entity, HttpServletRequest request) throws Exception { List<RefundLogEntity> dataList = refundLogService.queryByList(entity); return returnDataGrid(entity.getPager().getRowCount(), dataList); }
/** * 删除数据 * * @param id * @param request * @return * @throws Exception */ @RequestMapping("/delete") @ResponseBody public Object delete(String[] id, HttpServletRequest request) throws Exception { refundLogService.delete(id); return sendSuccessMessage(); }