|
|
|
@ -18,7 +18,7 @@ import java.util.Map; |
|
|
|
|
/** |
|
|
|
|
* 管理后台 父类 |
|
|
|
|
*/ |
|
|
|
|
public abstract class AdminBaseController<T> { |
|
|
|
|
public abstract class AdminBaseController<T,V extends AdminBaseVo> { |
|
|
|
|
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(AdminBaseController.class); |
|
|
|
|
|
|
|
|
@ -26,7 +26,7 @@ public abstract class AdminBaseController<T> { |
|
|
|
|
* 获取service |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public abstract AdminBaseService<T> getBaseService(); |
|
|
|
|
public abstract AdminBaseService<T,V> getBaseService(); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 管理后台url(用于权限控制) |
|
|
|
@ -34,16 +34,16 @@ public abstract class AdminBaseController<T> { |
|
|
|
|
*/ |
|
|
|
|
public abstract String getIndexUrl(); |
|
|
|
|
|
|
|
|
|
public Map<String,Object> setPageDate(AdminBaseVo vo){ |
|
|
|
|
public Map<String,Object> setPageDate(V vo){ |
|
|
|
|
Map<String,Object> map=new HashMap(); |
|
|
|
|
map.put(DatagridParamEnum.TOTAL.getValue(),getBaseService().findListPage(vo)); |
|
|
|
|
map.put(DatagridParamEnum.ROWS.getValue(),getBaseService().count(vo)); |
|
|
|
|
map.put(DatagridParamEnum.ROWS.getValue(),getBaseService().findListPage(vo)); |
|
|
|
|
map.put(DatagridParamEnum.TOTAL.getValue(),getBaseService().count(vo)); |
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@RequestMapping("/list") |
|
|
|
|
@ResponseBody |
|
|
|
|
public Map<String,Object> list(AdminBaseVo vo){ |
|
|
|
|
public Map<String,Object> list(V vo){ |
|
|
|
|
Subject subject = SecurityUtils.getSubject(); |
|
|
|
|
subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.SELECT.getConstant()); |
|
|
|
|
Map<String,Object> resultMap = setPageDate(vo); |
|
|
|
@ -52,7 +52,7 @@ public abstract class AdminBaseController<T> { |
|
|
|
|
|
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ResponseBody |
|
|
|
|
public AjaxResult save(AdminBaseVo vo) throws InstantiationException, IllegalAccessException { |
|
|
|
|
public AjaxResult save(V vo) throws InstantiationException, IllegalAccessException { |
|
|
|
|
Subject subject = SecurityUtils.getSubject(); |
|
|
|
|
subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.INSERT.getConstant()); |
|
|
|
|
AjaxResult ajaxResult = new AjaxResult(); |
|
|
|
@ -63,7 +63,7 @@ public abstract class AdminBaseController<T> { |
|
|
|
|
|
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ResponseBody |
|
|
|
|
public AjaxResult update(AdminBaseVo vo){ |
|
|
|
|
public AjaxResult update(V vo){ |
|
|
|
|
Subject subject = SecurityUtils.getSubject(); |
|
|
|
|
subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.UPDATE.getConstant()); |
|
|
|
|
AjaxResult ajaxResult= new AjaxResult(); |
|
|
|
@ -76,7 +76,6 @@ public abstract class AdminBaseController<T> { |
|
|
|
|
public AjaxResult delete(@PathVariable("id")Long id){ |
|
|
|
|
Subject subject = SecurityUtils.getSubject(); |
|
|
|
|
subject.checkPermission(getIndexUrl()+":"+ PermissionTyepEnum.DELETE.getConstant()); |
|
|
|
|
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult(); |
|
|
|
|
getBaseService().delete(id); |
|
|
|
|
return ajaxResult; |
|
|
|
|