增加启用停用的按钮
if (row.status == Global.STATUS_NORMAL){ actions.push('<a href="${ctx}/xxx/xxx/disable?id='+row.id+'" class="btnList" title="${text("停用")}" data-confirm="${text("确认要停用吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a> '); } if (row.status == Global.STATUS_DISABLE){ actions.push('<a href="${ctx}/xxx/xxx/enable?id='+row.id+'" class="btnList" title="${text("启用")}" data-confirm="${text("确认要启用吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a> '); }
启用停用的接口
@RequestMapping(value = "enable") @ResponseBody public String enable(Xxx xxx) { xxx.setStatus(Office.STATUS_NORMAL); xxxService.updateStatus(xxx); return renderResult(Global.TRUE, text("启用供应商''{0}''成功", xxx.getXxxName())); } @RequestMapping(value = "disable") @ResponseBody public String disable(Xxx xxx) { xxx.setStatus(Office.STATUS_DISABLE); xxxService.updateStatus(xxx); return renderResult(Global.TRUE, text("停用''{0}''成功", xxx.getXxxName())); }
查询列表时,需要将停用的数据也查询出来
@RequestMapping(value = "listData") @ResponseBody public Page<Xxx> listData(Xxx xxx, HttpServletRequest request, HttpServletResponse response) { xxx.setPage(new Page<>(request, response)); xxx.setStatus(""); xxx.getSqlMap().getWhere().disableAutoAddStatusWhere(); Page<Xxx> page = xxxService.findPage(xxx); return page; }