forked from wahello/xproject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
473 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
...min/src/main/java/com/certusnet/xproject/admin/web/controller/AdminRoleMgtController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package com.certusnet.xproject.admin.web.controller; | ||
|
||
import static org.springframework.web.bind.annotation.RequestMethod.POST; | ||
|
||
import java.util.List; | ||
|
||
import javax.annotation.Resource; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.certusnet.xproject.admin.consts.em.AdminRoleTypeEnum; | ||
import com.certusnet.xproject.admin.model.AdminRole; | ||
import com.certusnet.xproject.admin.model.AdminUser; | ||
import com.certusnet.xproject.admin.service.AdminResourceService; | ||
import com.certusnet.xproject.admin.service.AdminRoleService; | ||
import com.certusnet.xproject.admin.web.LoginToken; | ||
import com.certusnet.xproject.common.support.OrderBy; | ||
import com.certusnet.xproject.common.support.Pager; | ||
import com.certusnet.xproject.common.util.DateTimeUtils; | ||
import com.certusnet.xproject.common.web.BaseController; | ||
import com.certusnet.xproject.common.web.shiro.ShiroUtils; | ||
|
||
/** | ||
* 管理后台-角色管理Controller | ||
* | ||
* @author pengpeng | ||
* @date 2017年4月11日 下午3:35:34 | ||
* @version 1.0 | ||
*/ | ||
@RestController | ||
public class AdminRoleMgtController extends BaseController { | ||
|
||
@Resource(name="adminResourceFacadeService") | ||
private AdminResourceService adminResourceService; | ||
|
||
@Resource(name="adminRoleFacadeService") | ||
private AdminRoleService adminRoleService; | ||
|
||
/** | ||
* 查询角色列表 | ||
* @param request | ||
* @param response | ||
* @param roleQueryForm | ||
* @param orderBy | ||
* @param pager | ||
* @return | ||
*/ | ||
@RequestMapping(value="/admin/role/list") | ||
public Object listRole(HttpServletRequest request, HttpServletResponse response, AdminRole roleQueryForm, OrderBy orderBy, Pager pager) { | ||
List<AdminRole> roleList = adminRoleService.getRoleList(roleQueryForm, pager, orderBy); | ||
return genSuccessResult(roleList); | ||
} | ||
|
||
/** | ||
* 新增角色 | ||
* @param request | ||
* @param response | ||
* @param roleAddForm | ||
* @return | ||
*/ | ||
@RequestMapping(value="/admin/role/add/submit", method=POST) | ||
public Object addRole(HttpServletRequest request, HttpServletResponse response, @RequestBody AdminRole roleAddForm) { | ||
LoginToken<AdminUser> loginToken = ShiroUtils.getSessionAttribute(LoginToken.LOGIN_TOKEN_SESSION_KEY); | ||
roleAddForm.setCreateTime(DateTimeUtils.formatNow()); | ||
roleAddForm.setCreateBy(loginToken.getLoginId()); | ||
roleAddForm.setRoleType(AdminRoleTypeEnum.ADMIN_ROLE_TYPE_NORMAL.getTypeCode()); | ||
adminRoleService.createRole(roleAddForm); | ||
return genSuccessResult("保存成功!", null); | ||
} | ||
|
||
/** | ||
* 修改角色 | ||
* @param request | ||
* @param response | ||
* @param roleEditForm | ||
* @return | ||
*/ | ||
@RequestMapping(value="/admin/role/edit/submit", method=POST) | ||
public Object editRole(HttpServletRequest request, HttpServletResponse response, @RequestBody AdminRole roleEditForm) { | ||
LoginToken<AdminUser> loginToken = ShiroUtils.getSessionAttribute(LoginToken.LOGIN_TOKEN_SESSION_KEY); | ||
roleEditForm.setUpdateTime(DateTimeUtils.formatNow()); | ||
roleEditForm.setUpdateBy(loginToken.getLoginId()); | ||
adminRoleService.updateRole(roleEditForm); | ||
return genSuccessResult("保存成功!", null); | ||
} | ||
|
||
/** | ||
* 删除角色 | ||
* @param request | ||
* @param response | ||
* @param id | ||
* @return | ||
*/ | ||
@RequestMapping(value="/admin/role/del") | ||
public Object delRole(HttpServletRequest request, HttpServletResponse response, Long id) { | ||
adminRoleService.deleteRoleById(id); | ||
return genSuccessResult("删除成功!", null); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="description" content=""> | ||
<meta name="keywords" content=""> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>角色管理</title> | ||
<meta name="renderer" content="webkit"> | ||
<meta http-equiv="Cache-Control" content="no-cache"> | ||
<meta http-equiv="Pragma" content="no-cache"> | ||
<link rel="shortcut icon" href="../../resources/images/favicon.ico"> | ||
<link rel="stylesheet" type="text/css" href="../../resources/components/element-ui/theme-default/element.min.css"> | ||
<link rel="stylesheet" type="text/css" href="../../resources/components/element-ui/theme-default/element.custom.css"> | ||
<link rel="stylesheet" type="text/css" href="../../resources/components/element-ui/theme-default/font-awesome.min.css"> | ||
<style type="text/css"> | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app" class="el-container el-hidden"> | ||
<div class="el-container-inner"> | ||
<el-breadcrumb class="el-breadcrumb-admin" separator="/"> | ||
<i class="el-icon-fa-home"></i> | ||
<el-breadcrumb-item>系统管理</el-breadcrumb-item> | ||
<el-breadcrumb-item>角色管理</el-breadcrumb-item> | ||
</el-breadcrumb> | ||
<div class="el-container-content"> | ||
<h3 class="el-title"> | ||
<label>角色查询</label> | ||
</h3> | ||
<div class="el-search-form"> | ||
<el-form ref="roleQueryForm" :model="roleQueryForm"> | ||
<el-row> | ||
<el-col :span="8"> | ||
<el-form-item label="角色名称" label-width="140px" prop="roleName"> | ||
<el-input v-model="roleQueryForm.roleName" :maxlength="20"></el-input> | ||
</el-form-item> | ||
</el-col> | ||
<el-col :span="8"> | ||
<el-form-item label="角色代码" label-width="140px" prop="roleCode"> | ||
<el-input v-model="roleQueryForm.roleCode" :maxlength="50"></el-input> | ||
</el-form-item> | ||
</el-col> | ||
<el-col :span="8"> | ||
<el-form-item class="el-align-center"> | ||
<el-button @click="resetQueryForm" icon="fa-undo">重 置</el-button> | ||
<el-button type="primary" @click="queryRoleList(1000)" icon="fa-search">查 询</el-button> | ||
</el-form-item> | ||
</el-col> | ||
</el-row> | ||
</el-form> | ||
</div> | ||
<div class="el-search-list"> | ||
<el-table v-loading="loadingRoleList" element-loading-text="拼命加载中..." element-loading-class="el-loading-mask-opacity" :class="{loading: loadingRoleList}" :data="roleList" :default-sort="roleQuerySort" @sort-change="onRoleQuerySortChange" style="width:100%;" class="el-table-primary el-table-sortable" empty-text="暂无数据"> | ||
<el-table-column label="#" type="index" width="40"></el-table-column> | ||
<el-table-column label="角色名称" prop="roleName" width="160" sortable="custom"></el-table-column> | ||
<el-table-column label="角色代码" prop="roleCode" width="150" sortable="custom"></el-table-column> | ||
<el-table-column label="角色类型" prop="roleType" width="120" align="center" :formatter="formatRoleType" sortable="custom"></el-table-column> | ||
<el-table-column label="角色描述" prop="description"></el-table-column> | ||
<el-table-column label="创建时间" prop="createTime" width="100" align="center" sortable="custom"></el-table-column> | ||
<el-table-column label="操作" width="120" align="center"> | ||
<template scope="scope"> | ||
<el-button class="el-padding-no" type="text" size="small">查看</el-button> | ||
<el-button class="el-padding-no" type="text" size="small">编辑</el-button> | ||
</template> | ||
</el-table-column> | ||
</el-table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<script type="text/javascript" src="../../resources/js/polyfill.min.js"></script> | ||
<script type="text/javascript" src="../../resources/js/vue.min.js"></script> | ||
<script type="text/javascript" src="../../resources/js/vue.pageloading.js"></script> | ||
<script type="text/javascript" src="../../resources/js/vue-router.min.js"></script> | ||
<script type="text/javascript" src="../../resources/js/axios.min.js"></script> | ||
<script type="text/javascript" src="../../resources/components/element-ui/element.min.js"></script> | ||
<script type="text/javascript" src="../../resources/components/element-ui/element.extensional.js"></script> | ||
<script type="text/javascript" src="../../resources/scripts/common.js"></script> | ||
<script type="text/javascript" src="../../resources/scripts/admin/role/list.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.