优化部分代码:list()的返回值由map改为AdminDateGrifPstsm

master
星期八 6 years ago
parent 9e65fbeb8f
commit 3af1fbc85d
  1. 37
      src/main/java/com/lq/cms/mode/AdminDataGridParam.java
  2. 17
      src/main/java/com/lq/cms/web/AdminBaseController.java
  3. 10
      src/main/java/com/lq/cms/web/sys/LogController.java
  4. 9
      src/main/java/com/lq/cms/web/sys/MenuController.java
  5. 9
      src/main/java/com/lq/cms/web/sys/RoleController.java
  6. 9
      src/main/java/com/lq/cms/web/sys/UserController.java
  7. 9
      src/main/java/com/lq/cms/web/wechat/WechatInfoController.java
  8. 1
      src/main/java/com/lq/cms/web/wechat/WechatMessageController.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<T> {
/**
* 数据总量
*/
private Integer total;
/**
* 数据行
*/
private List<T> rows;
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public List<T> getRows() {
return rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
}

@ -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<T,V extends AdminBaseVo> {
*/
public abstract String getIndexUrl();
public Map<String,Object> setPageDate(V vo){
Map<String,Object> map=new HashMap();
map.put(DatagridParamEnum.ROWS.getValue(),getBaseService().findListPage(vo));
map.put(DatagridParamEnum.TOTAL.getValue(),getBaseService().count(vo));
return map;
public AdminDataGridParam<V> setPageDate(V vo){
AdminDataGridParam<V> adminDataGridParam = new AdminDataGridParam<>();
adminDataGridParam.setRows(getBaseService().findListPage(vo));
adminDataGridParam.setTotal(getBaseService().count(vo));
return adminDataGridParam;
}
@RequestMapping("/list")
@ResponseBody
public Map<String,Object> list(V vo){
public AdminDataGridParam<V> list(V vo){
Subject subject = SecurityUtils.getSubject();
subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.SELECT.getConstant());
Map<String,Object> resultMap = setPageDate(vo);
return resultMap;
AdminDataGridParam<V> adminDataGridParam = setPageDate(vo);
return adminDataGridParam;
}
@PostMapping("/save")

@ -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<String,Object> map=new HashMap();
map.put("total",sysLogService.count(vo));
map.put("rows",sysLogService.findListPage(vo));
return map;
AdminDataGridParam<SysLogVo> adminDataGridParam = new AdminDataGridParam<>();
adminDataGridParam.setTotal(sysLogService.count(vo));
adminDataGridParam.setRows(sysLogService.findListPage(vo));
return adminDataGridParam;
}
}

@ -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<String,Object> map=new HashMap();
map.put("total",sysResourceService.count(vo));
map.put("rows",sysResourceService.findListpages(vo));
return map;
AdminDataGridParam<SysResourceVo> adminDataGridParam = new AdminDataGridParam<>();
adminDataGridParam.setRows(sysResourceService.findListpages(vo));
adminDataGridParam.setTotal(sysResourceService.count(vo));
return adminDataGridParam;
}
@RequestMapping("/edit")

@ -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<String,Object> map=new HashMap();
map.put("total",sysRoleService.count(vo));
map.put("rows",sysRoleService.findListPage(vo));
return map;
AdminDataGridParam<SysRoleVo> 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)

@ -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<String,Object> map=new HashMap();
map.put("total",sysUserService.count(vo));
map.put("rows",sysUserService.findListPage(vo));
return map;
AdminDataGridParam<SysUserVo> adminDataGridParam = new AdminDataGridParam<>();
adminDataGridParam.setTotal(sysUserService.count(vo));
adminDataGridParam.setRows(sysUserService.findListPage(vo));
return adminDataGridParam;
}
@RequestMapping("/edit")

@ -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<String,Object> map=new HashMap();
map.put("total",wechatInfoService.count(vo));
map.put("rows",wechatInfoService.findListPage(vo));
return map;
AdminDataGridParam<WechatInfoVo> adminDataGridParam = new AdminDataGridParam();
adminDataGridParam.setTotal(wechatInfoService.count(vo));
adminDataGridParam.setRows(wechatInfoService.findListPage(vo));
return adminDataGridParam;
}
@RequiresPermissions(INDEX_URL+Constant.PERSSION_MARK+Constant.PERMISSION_INSERT)

@ -44,6 +44,7 @@ public class WechatMessageController extends AdminBaseController<WechatMessage,W
}
@Override
public AdminBaseService getBaseService() {

Loading…
Cancel
Save