JavaWeb之ssm框架整合,用户角色权限管理
SSM框架整合
Spring
SpringMVC
MyBatis
导包:
1, spring
2, MyBatis
3, mybatis-spring
4, fastjson
5, aspectweaver----AspectJ框架
6, log4j-----打印日志信息
7, ojdbc6.jar
8, jstl.jar, standard.jar----标准标签库
9, commons-logging-1.2.jar
src下建立包结构
配置web.xml,spring-mvc.xml,spring-all.xml
建立表结构,使用PowerDesigner
前台页面,后台方法等。
项目结构:
代码(引用,未完全实现):
配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0"> <!-- 告诉web容器log4j的属性文件所在位置 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:conf/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener> <!-- spring框架提供的字符编码过滤器 -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- 加载Spring的配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:conf/spring-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <!-- 加载SpringMVC的配置文件 -->
<servlet>
<servlet-name>springDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:conf/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springDispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0"> <!-- 告诉web容器log4j的属性文件所在位置 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:conf/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener> <!-- spring框架提供的字符编码过滤器 -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- 加载Spring的配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:conf/spring-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <!-- 加载SpringMVC的配置文件 -->
<servlet>
<servlet-name>springDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:conf/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springDispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> <!-- 配置扫描器 -->
<context:component-scan base-package="com.hanqi.controller" /> <!-- 配置视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- <property name="prefix" value="/WEB-INF/"></property> -->
<property name="prefix" value="/"></property>
<property name="suffix" value=".jsp"></property>
</bean> <!-- 上传文件的解析器 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 上传文件的总大小, 单位是b -->
<property name="maxUploadSize" value="10240000"></property>
<!-- 单个文件的上传大小限制, 单位是b -->
<property name="maxUploadSizePerFile" value="1000000"></property>
<!-- 默认字符集 -->
<property name="defaultEncoding" value="utf-8"></property>
</bean> <!-- 开启SpringMVC注解驱动 -->
<mvc:annotation-driven>
<!-- 改成false, 原因是在spring中默认使用的json格式的转换器是Jackson.jar中的转换器, 但实际开发中更受欢迎的是fastjson.jar -->
<mvc:message-converters register-defaults="false">
<bean class="org.springframework.http.converter.StringHttpMessageConverter" />
<bean class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter" />
<bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter" />
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
<bean id="fastJsonHttpMessagerConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<!-- 设置支持的媒体类型 -->
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=utf-8</value>
<value>application/json; charset=utf-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
</beans>
src下:
model层实体类:
package com.hanqi.model; public class SrUserRole {
private Integer id;
private Integer userid;
private Integer roleid; public SrUserRole() {
super();
} public SrUserRole(Integer id, Integer userid, Integer roleid) {
super();
this.id = id;
this.userid = userid;
this.roleid = roleid;
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public Integer getUserid() {
return userid;
} public void setUserid(Integer userid) {
this.userid = userid;
} public Integer getRoleid() {
return roleid;
} public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
}
package com.hanqi.model; public class SrRoleMenu {
private Integer id;
private Integer roleid;
private Integer menuid; public SrRoleMenu(Integer id, Integer roleid, Integer menuid) {
super();
this.id = id;
this.roleid = roleid;
this.menuid = menuid;
} public SrRoleMenu() {
super();
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public Integer getRoleid() {
return roleid;
} public void setRoleid(Integer roleid) {
this.roleid = roleid;
} public Integer getMenuid() {
return menuid;
} public void setMenuid(Integer menuid) {
this.menuid = menuid;
}
}
package com.hanqi.model; public class SrRole {
private Integer id;
private String rolename;
private String status;
private boolean checked; public SrRole() {
super();
} public SrRole(Integer id, String rolename, String status) {
super();
this.id = id;
this.rolename = rolename;
this.status = status;
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getRolename() {
return rolename;
} public void setRolename(String rolename) {
this.rolename = rolename;
} public String getStatus() {
return status;
} public void setStatus(String status) {
this.status = status;
} public boolean getChecked() {
return checked;
} public void setChecked(boolean checked) {
this.checked = checked;
}
}
package com.hanqi.model; public class SrMenu {
private Integer id;
private String menuname;
private String url;
private String icon;
private String status;
private Integer parentid; public SrMenu() {
super();
} public SrMenu(Integer id, String menuname, String url, String icon, String status) {
super();
this.id = id;
this.menuname = menuname;
this.url = url;
this.icon = icon;
this.status = status;
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getMenuname() {
return menuname;
} public void setMenuname(String menuname) {
this.menuname = menuname;
} public String getUrl() {
return url;
} public void setUrl(String url) {
this.url = url;
} public String getIcon() {
return icon;
} public void setIcon(String icon) {
this.icon = icon;
} public String getStatus() {
return status;
} public void setStatus(String status) {
this.status = status;
} public Integer getParentid() {
return parentid;
} public void setParentid(Integer parentid) {
this.parentid = parentid;
}
}
dao层接口:
package com.hanqi.dao; import java.util.List; import com.hanqi.model.SrUser; public interface SrUserDao { SrUser login(SrUser srUser); int insertSrUser(SrUser srUser); List<SrUser> selectAll(); }
package com.hanqi.dao; import java.util.List; import com.hanqi.model.SrRole; public interface SrRoleDao { List<SrRole> selectAllRoles(String userid); List<SrRole> selectAll(); }
package com.hanqi.dao; import java.util.List; import com.hanqi.model.SrMenu;
import com.hanqi.model.SrUser; public interface SrMenuDao { List<SrMenu> selectMenus(SrUser currentUser); }
dao层实现方法:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hanqi.dao.SrUserDao"> <select id="login" parameterType="SrUser" resultType="SrUser">
select * from Sr_User s
<where>
s.username=#{username} and s.password=#{password}
</where>
</select> <select id="selectAll" resultType="SrUser">
select * from sr_user
</select> <insert id="insertSrUser" parameterType="SrUser">
insert into sr_user values
(testsq.nextval, #{username}, #{password}, #{realname}, #{status}, null)
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hanqi.dao.SrRoleDao"> <select id="selectAllRoles" resultType="SrRole">
SELECT * FROM sr_role sr WHERE sr.id IN
(SELECT sur.roleid FROM sr_user_role sur WHERE sur.userid=#{userid})
</select> <select id="selectAll" resultType="SrRole">
select * from sr_role
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hanqi.dao.SrMenuDao"> <select id="selectMenus" parameterType="SrUser" resultType="SrMenu">
SELECT * FROM SR_MENU SM
WHERE SM.ID IN (SELECT SRM.MENUID
FROM SR_ROLE_MENU SRM
WHERE SRM.ROLEID = (SELECT SUR.ROLEID
FROM SR_USER_ROLE SUR
WHERE SUR.USERID = #{id}))
</select> </mapper>
controller层控制器:
package com.hanqi.controller; import java.util.ArrayList;
import java.util.List; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes; import com.alibaba.fastjson.JSONObject;
import com.hanqi.dao.SrUserDao;
import com.hanqi.model.SrUser; @Controller
@SessionAttributes("currentUser")
@RequestMapping("sruser")
public class SrUserController { @Autowired
private SrUserDao srUserDao; @RequestMapping("/login")
public String login(SrUser srUser, Model model) {
String vname = "login";
model.addAttribute("user", srUser);
SrUser su = srUserDao.login(srUser); if(su!=null) {
vname = "index";
model.addAttribute("currentUser", su);
} return vname;
} @RequestMapping("/register")
public String register(SrUser srUser) {
srUser.setStatus("1");
int a = srUserDao.insertSrUser(srUser); return "regsuccess";
} @ResponseBody
@RequestMapping("selectAll")
public JSONObject selectAll() {
JSONObject jo = new JSONObject();
List<SrUser> list = srUserDao.selectAll();
jo.put("total", list.size());
jo.put("rows", list); return jo;
} }
package com.hanqi.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import com.hanqi.dao.SrRoleDao;
import com.hanqi.model.SrRole; @Controller
@RequestMapping("/role")
public class SrRoleController { @Autowired
private SrRoleDao srRoleDao; @ResponseBody
@RequestMapping("/selectAllRoles")
public List<SrRole> selectAllRoles(String userid) { // 查询当前用户拥有的角色
List<SrRole> list = srRoleDao.selectAllRoles(userid);
// 查询所有的角色
List<SrRole> listAll = srRoleDao.selectAll(); for (int i = 0; i < list.size(); i++) {
for (int j = 0; j < listAll.size(); j++) {
if (listAll.get(j).getId() == list.get(i).getId()) {
listAll.get(j).setChecked(true);
}
}
}
return listAll;
}
}
package com.hanqi.controller; import java.util.ArrayList;
import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import com.hanqi.dao.SrMenuDao;
import com.hanqi.model.SrMenu;
import com.hanqi.model.SrUser; @Controller
@RequestMapping("/menu")
public class SrMenuController { @Autowired
private SrMenuDao srMenuDao; @ResponseBody
@RequestMapping("/selectMenus")
public List<SrMenu> selectMenus(HttpServletRequest request) { SrUser currentUser = (SrUser)request.getSession().getAttribute("currentUser"); List<SrMenu> list = new ArrayList<SrMenu>();
if(currentUser!=null) {
list = srMenuDao.selectMenus(currentUser);
} return list;
} }
前台jsp页面:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
String basePath = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath %>/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="<%=basePath %>/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
<link type="text/css" rel="stylesheet" href="<%=basePath %>/jquery-easyui-1.5.1/themes/icon.css"></link>
<link type="text/css" rel="stylesheet" href="<%=basePath %>/jquery-easyui-1.5.1/themes/default/easyui.css"></link>
<script type="text/javascript" src="<%=basePath %>/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=basePath %>/js/index.js"></script>
<script type="text/javascript">
var __ctx = "<%=basePath %>";
</script>
<title>Insert title here</title>
</head>
<body class="easyui-layout">
<div data-options="region:'north',title:'North Title',split:true,height:100">
<h1>${currentUser.realname }</h1>
</div>
<div data-options="region:'west',title:'West',split:true,width:150">
<ul id="treemenu" class="easyui-tree"
data-options="url:'<%=basePath %>/menu/selectMenus.do',idField:'id',
parentField:'parentid',textField:'menuname'"></ul>
</div>
<div data-options="region:'center'">
<div id="tabs_userrole" class="easyui-tabs" data-options="fit:true">
</div>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
String basePath = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript"
src="<%=basePath%>/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript"
src="<%=basePath%>/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
<link type="text/css" rel="stylesheet"
href="<%=basePath%>/jquery-easyui-1.5.1/themes/icon.css"></link>
<link type="text/css" rel="stylesheet"
href="<%=basePath%>/jquery-easyui-1.5.1/themes/default/easyui.css"></link>
<script type="text/javascript"
src="<%=basePath%>/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
</head>
<body>
<table id="userinfo" class="easyui-datagrid"
data-options="toolbar:'#tools',url:'<%=basePath%>/sruser/selectAll.do',fit:true,fitColumns:true,singleSelect:true">
<thead>
<tr>
<th data-options="field:'',width:100,checkbox:true"></th>
<th data-options="field:'id',width:100">id</th>
<th data-options="field:'username',width:100">用户名</th>
<th data-options="field:'realname',width:100">姓名</th>
<th data-options="field:'status',width:100">状态</th>
<th data-options="field:'mark',width:100">备注</th>
</tr>
</thead>
</table>
<div id="tools">
<a class="easyui-linkbutton" iconCls="icon-add"
onclick="showRoleInfos()">修改角色</a>
</div> <div id="dialog_roles" class="easyui-dialog"
data-options="closed:true,width:200,height:300,title:'更改角色',modal:true">
<ul id="role_tree"></ul>
</div> <script type="text/javascript">
function showRoleInfos() {
var data = $("#userinfo").datagrid("getSelected");
$("#role_tree").tree({
url:"role/selectAllRoles.do",
checkbox:true,
idField:"id",
parentField:"id",
textField:"rolename",
queryParams:{
userid:data.id
},
onCheck:function(node, checked) {
console.log(node);
console.log(checked);
}
});
$("#dialog_roles").dialog("open");
} //easyui实现自定义simpleData加载
$.fn.tree.defaults.loadFilter = function (data) {
var opt = $(this).data().tree.options;//整个tree的dom对象
var idField, textField, parentField;
if (opt.parentField) {
idField = opt.idField || 'id';
textField = opt.textField || 'text';
parentField = opt.parentField;
var i,l,
treeData = [],
tmpMap = [];
for (i = 0, l = data.length; i < l; i++) {
tmpMap[data[i][idField]] = data[i];
}
for (i = 0, l = data.length; i < l; i++) {
if (tmpMap[data[i][parentField]] && data[i][idField] != data[i][parentField]) {
if (!tmpMap[data[i][parentField]]['children'])
tmpMap[data[i][parentField]]['children'] = [];
data[i]['text'] = data[i][textField];
tmpMap[data[i][parentField]]['children'].push(data[i]);
} else {
data[i]['text'] = data[i][textField];
treeData.push(data[i]);
}
}
return treeData;
}
return data;
};
</script> </body>
</html>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="sruser/login.do" method="post">
<table>
<tr>
<td>用户名: </td>
<td><input name="username" value="${user.username }" /></td>
</tr>
<tr>
<td>密码: </td>
<td><input name="password" value="${user.password }" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="登录" /></td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form action="sruser/register.do" method="post">
<table>
<tr>
<td>用户名: </td>
<td><input name="username" /></td>
</tr>
<tr>
<td>密码: </td>
<td><input name="password" /></td>
</tr>
<tr>
<td>确认密码: </td>
<td><input name="password1" /></td>
</tr>
<tr>
<td>姓名: </td>
<td><input name="realname" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="注册" /></td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
String basePath = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
注册成功 !
<a href="<%=basePath %>/login.jsp">返回登录</a>
</body>
</html>
我写的不完全版……补全之后再贴上来
JavaWeb之ssm框架整合,用户角色权限管理的更多相关文章
- ssm demo,用户角色权限管理
SSM框架整合 Spring SpringMVC MyBatis 导包: 1, spring 2, MyBatis 3, mybatis-spring 4, fastjson 5, aspectwea ...
- Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理
这是本人第一次写,写的不好的地方还忘包含.写这个的主要原因是想通过这个来学习下EF的CodeFirst模式,本来也想用AngularJs来玩玩的,但是自己只会普通的绑定,对指令这些不是很熟悉,所以就基 ...
- Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理10
今天把用户的菜单显示和页面的按钮显示都做好了,下面先来个效果图 接下来说下我实现的方法: 首先我在每个方法前面都加了这个属性, /// <summary> /// 表示当前Action请求 ...
- [.Net MVC] 用户角色权限管理_使用CLK.AspNet.Identity
项目:后台管理平台 意义:一个完整的管理平台需要提供用户注册.登录等功能,以及认证和授权功能. 一.为何使用CLK.AspNet.Identity 首先简要说明所采取的权限控制方式.这里采用了基于角色 ...
- DRF框架之 用户角色权限与访问频率的权限设置
1. 简单演示,创建一个models的数据库表 class User(models.Model): name=models.CharField(max_length=32) pwd=models.Ch ...
- Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理4
首先先加个区域,名为Admin using System.Web.Mvc; namespace AuthorDesign.Web.Areas.Admin { public class AdminAre ...
- Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理9
前两天因有事就没来得及写.今天刚刚好空了.这次写的是对角色和管理员对页面按钮之间的控制.先看页面效果 说明:先根据角色设置好角色的权限,然后管理员在对应的角色下的权限去设置其权限. 在设置角色权限的时 ...
- shiro系列三、ssm框架整合shiro实现权限控制
shiro权限框架是一个非常优秀的框架,前面的几篇文章对shiro进行了非常详细的介绍和原理分析,那么接下来让我们开始在web项目中使用它(javase也能用shiro): 一.数据库表结构设计 二. ...
- Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理1
首先给上项目的整体框架图:,这里我没有使用BLL,因为感觉太烦了就没有去使用. 那么接下来我们首先先去Model层中添加Model. 管理员类: using System; using System. ...
随机推荐
- bzoj1015星球大战
1015: [JSOI2008]星球大战starwar Description 很久以前,在一个遥远的星系,一个黑暗的帝国靠着它的超级武器统治者整个星系.某一天,凭着一个偶然的机遇,一支反抗军摧毁了帝 ...
- 去除url后缀(.html,.jsp等)的有效方法
有时候,我们想要隐藏真正的路径,或者觉着很酷,举一个知乎网的例子,如https://www.zhihu.com/question/39547745 那么?如何做到呢,其实,可以有一个非常简单而有效的解 ...
- Grafana+Prometheus系统监控之webhook
概述 Webhook是一个API概念,并且变得越来越流行.我们能用事件描述的事物越多,webhook的作用范围也就越大.Webhook作为一个轻量的事件处理应用,正变得越来越有用. 准确的说webho ...
- Python爬虫知识点四--scrapy框架
一.scrapy结构数据 解释: 1.名词解析: o 引擎(Scrapy Engine)o 调度器(Scheduler)o 下载器(Downloader)o 蜘蛛(Spiders)o 项目管 ...
- socket的简单例子
最近刚刚开始学了socket的模块,就写了一个服务器与客户端交互的程序 有两种模式: 1.就是先电脑自动回复 2.就是人工服务 接下来就是代码了 服务器端的代码: #Author:陈浩彬 import ...
- 我的第一个python web开发框架(17)——产品管理
这是后台管理系统最后一个功能,产品管理,它的接口与页面功能与上一章差不多. 获取产品列表接口 @get('/api/product/') def callback(): ""&qu ...
- 一个简单的迷你jQuery实现
//仅提供与学习使用(function () { var _$ = window.$; var _jQuery = window.jQuery; //暴露外部使用的一个接口 var jQuery = ...
- 大数据基础篇(一):联机分析处理(OLAP) 与 联机事务处理(OLTP)
联机事务处理(OLTP) OLTP也称实时系统(Real Time System),支持事务快速响应和大并发,这类系统典型的有ATM机(Automated Teller Machine)系统.自动售票 ...
- 【转】如何使用Git上传本地项目到github?(mac版)
原文链接:http://www.cnblogs.com/lijiayi/p/pushtogithub.html 在此假设你已经在 github 上创建好了一个项目,像这样: 并且你已经完成了自己的项目 ...
- pdo 封装增删改查类
<?php/** * Class model * @package Core\lib */class model{ protected $pdo = null; // 连接数据库 ...