diff --git a/src/main/java/com/lq/cms/mode/AdminDataGridParam.java b/src/main/java/com/lq/cms/mode/AdminDataGridParam.java new file mode 100644 index 0000000..098da17 --- /dev/null +++ b/src/main/java/com/lq/cms/mode/AdminDataGridParam.java @@ -0,0 +1,37 @@ +package com.lq.cms.mode; + +import java.util.List; + +/** + * @Author: qi + * @Description: + * @Date: Create in 4:00 PM 2019/2/2 + */ +public class AdminDataGridParam { + + /** + * 数据总量 + */ + private Integer total; + + /** + * 数据行 + */ + private List rows; + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } +} diff --git a/src/main/java/com/lq/cms/web/AdminBaseController.java b/src/main/java/com/lq/cms/web/AdminBaseController.java index cb50c13..1850f83 100755 --- a/src/main/java/com/lq/cms/web/AdminBaseController.java +++ b/src/main/java/com/lq/cms/web/AdminBaseController.java @@ -2,6 +2,7 @@ package com.lq.cms.web; import com.lq.cms.emun.DatagridParamEnum; import com.lq.cms.emun.PermissionTyepEnum; +import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.service.AdminBaseService; import com.lq.cms.vo.AdminBaseVo; import com.lq.code.entity.AjaxResult; @@ -36,20 +37,20 @@ public abstract class AdminBaseController { */ public abstract String getIndexUrl(); - public Map setPageDate(V vo){ - Map map=new HashMap(); - map.put(DatagridParamEnum.ROWS.getValue(),getBaseService().findListPage(vo)); - map.put(DatagridParamEnum.TOTAL.getValue(),getBaseService().count(vo)); - return map; + public AdminDataGridParam setPageDate(V vo){ + AdminDataGridParam adminDataGridParam = new AdminDataGridParam<>(); + adminDataGridParam.setRows(getBaseService().findListPage(vo)); + adminDataGridParam.setTotal(getBaseService().count(vo)); + return adminDataGridParam; } @RequestMapping("/list") @ResponseBody - public Map list(V vo){ + public AdminDataGridParam list(V vo){ Subject subject = SecurityUtils.getSubject(); subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.SELECT.getConstant()); - Map resultMap = setPageDate(vo); - return resultMap; + AdminDataGridParam adminDataGridParam = setPageDate(vo); + return adminDataGridParam; } @PostMapping("/save") diff --git a/src/main/java/com/lq/cms/web/sys/LogController.java b/src/main/java/com/lq/cms/web/sys/LogController.java index 4f9a79f..1a314eb 100755 --- a/src/main/java/com/lq/cms/web/sys/LogController.java +++ b/src/main/java/com/lq/cms/web/sys/LogController.java @@ -4,6 +4,7 @@ package com.lq.cms.web.sys; * Created by qi_liang on 2018/2/24. */ +import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.service.SysLogService; import com.lq.cms.vo.SysLogVo; import com.lq.code.util.Constant; @@ -42,10 +43,9 @@ public class LogController { @RequestMapping("/list") @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) public Object list(SysLogVo vo){ - - Map map=new HashMap(); - map.put("total",sysLogService.count(vo)); - map.put("rows",sysLogService.findListPage(vo)); - return map; + AdminDataGridParam adminDataGridParam = new AdminDataGridParam<>(); + adminDataGridParam.setTotal(sysLogService.count(vo)); + adminDataGridParam.setRows(sysLogService.findListPage(vo)); + return adminDataGridParam; } } diff --git a/src/main/java/com/lq/cms/web/sys/MenuController.java b/src/main/java/com/lq/cms/web/sys/MenuController.java index 14d5695..ac00069 100755 --- a/src/main/java/com/lq/cms/web/sys/MenuController.java +++ b/src/main/java/com/lq/cms/web/sys/MenuController.java @@ -1,6 +1,7 @@ package com.lq.cms.web.sys; import com.lq.cms.emun.StatusTypeEnum; +import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.service.SysResourceService; import com.lq.cms.vo.SysResourceVo; import com.lq.code.entity.AjaxResult; @@ -53,10 +54,10 @@ public class MenuController { @ResponseBody @RequiresPermissions(INDEX_URL+ Constant.PERSSION_MARK+Constant.PERMISSION_SELECT) public Object list(SysResourceVo vo){ - Map map=new HashMap(); - map.put("total",sysResourceService.count(vo)); - map.put("rows",sysResourceService.findListpages(vo)); - return map; + AdminDataGridParam adminDataGridParam = new AdminDataGridParam<>(); + adminDataGridParam.setRows(sysResourceService.findListpages(vo)); + adminDataGridParam.setTotal(sysResourceService.count(vo)); + return adminDataGridParam; } @RequestMapping("/edit") diff --git a/src/main/java/com/lq/cms/web/sys/RoleController.java b/src/main/java/com/lq/cms/web/sys/RoleController.java index 725edc4..450f0e8 100755 --- a/src/main/java/com/lq/cms/web/sys/RoleController.java +++ b/src/main/java/com/lq/cms/web/sys/RoleController.java @@ -2,6 +2,7 @@ package com.lq.cms.web.sys; import com.alibaba.fastjson.JSON; import com.lq.cms.emun.StatusTypeEnum; +import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.mode.ZtreeComposite; import com.lq.cms.service.SysRoleResourcePermissionService; import com.lq.cms.service.SysRoleService; @@ -55,10 +56,10 @@ public class RoleController { @RequestMapping("/list") @ResponseBody public Object list(SysRoleVo vo){ - Map map=new HashMap(); - map.put("total",sysRoleService.count(vo)); - map.put("rows",sysRoleService.findListPage(vo)); - return map; + AdminDataGridParam adminDataGridParam = new AdminDataGridParam<>(); + adminDataGridParam.setTotal(sysRoleService.count(vo)); + adminDataGridParam.setRows(sysRoleService.findListPage(vo)); + return adminDataGridParam; } // @RequiresPermissions(value={"/cms/role/index:INSERT","/cms/role/index:UPDATE"},logical = Logical.OR) diff --git a/src/main/java/com/lq/cms/web/sys/UserController.java b/src/main/java/com/lq/cms/web/sys/UserController.java index 25cca2a..0ada382 100755 --- a/src/main/java/com/lq/cms/web/sys/UserController.java +++ b/src/main/java/com/lq/cms/web/sys/UserController.java @@ -2,6 +2,7 @@ package com.lq.cms.web.sys; import com.lq.cms.emun.PermissionTyepEnum; import com.lq.cms.emun.StatusTypeEnum; +import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.service.SysRoleService; import com.lq.cms.service.SysUserRoleService; import com.lq.cms.service.SysUserService; @@ -71,10 +72,10 @@ public class UserController { @RequestMapping("/list") @ResponseBody public Object list(SysUserVo vo){ - Map map=new HashMap(); - map.put("total",sysUserService.count(vo)); - map.put("rows",sysUserService.findListPage(vo)); - return map; + AdminDataGridParam adminDataGridParam = new AdminDataGridParam<>(); + adminDataGridParam.setTotal(sysUserService.count(vo)); + adminDataGridParam.setRows(sysUserService.findListPage(vo)); + return adminDataGridParam; } @RequestMapping("/edit") diff --git a/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java b/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java index ad3e83d..1593a77 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatInfoController.java @@ -4,6 +4,7 @@ import com.lq.cms.emun.StatusTypeEnum; import com.lq.cms.emun.WechatInfoCertificationTypeEnum; import com.lq.cms.emun.WechatInfoEncodingTypeEnum; import com.lq.cms.emun.WechatInfoTypeEnum; +import com.lq.cms.mode.AdminDataGridParam; import com.lq.cms.service.WechatInfoService; import com.lq.cms.vo.WechatInfoVo; import com.lq.code.entity.AjaxResult; @@ -60,10 +61,10 @@ public class WechatInfoController { @ResponseBody @RequestMapping("/list") public Object list(WechatInfoVo vo){ - Map map=new HashMap(); - map.put("total",wechatInfoService.count(vo)); - map.put("rows",wechatInfoService.findListPage(vo)); - return map; + AdminDataGridParam adminDataGridParam = new AdminDataGridParam(); + adminDataGridParam.setTotal(wechatInfoService.count(vo)); + adminDataGridParam.setRows(wechatInfoService.findListPage(vo)); + return adminDataGridParam; } @RequiresPermissions(INDEX_URL+Constant.PERSSION_MARK+Constant.PERMISSION_INSERT) diff --git a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java index c1c7974..4a2c604 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java @@ -44,6 +44,7 @@ public class WechatMessageController extends AdminBaseController