企业权限管理(十)-用户详情

用户详情

UserController

findById方法

 

@Controller
@RequestMapping("/user")
public class UserController {@Autowiredprivate IUserService userService;//查询指定id的用户@RequestMapping("/findById.do")public ModelAndView findById(String id) throws Exception{ModelAndView mv = new ModelAndView();UserInfo userInfo = userService.findById(id);mv.addObject("user",userInfo);mv.setViewName("user-show1");System.out.println(userInfo.getUsername());return mv;}@RequestMapping("/findAll.do")public ModelAndView findAll()throws Exception{ModelAndView mv = new ModelAndView();List<UserInfo> userList=userService.findAll();mv.addObject("userList",userList);mv.setViewName("user-list");return mv;}@RequestMapping("/save.do")@PreAuthorize("authentication.principal.username == 'tom'")public String save(UserInfo userInfo) throws Exception{userService.save(userInfo);return "redirect:findAll.do";}}

UserServiceImpl

@Overridepublic UserInfo findById(String id) throws Exception {return userDao.findById(id);}

IUserDao

   @Select("select * from users where id=#{id}")@Results({@Result(id = true, property = "id", column = "id"),@Result(property = "username", column = "username"),@Result(property = "email", column = "email"),@Result(property = "password", column = "password"),@Result(property = "phoneNum", column = "phoneNum"),@Result(property = "status", column = "status"),@Result(property = "roles",column = "id",javaType = java.util.List.class,many = @Many(select = "com.itheima.ssm.dao.IRoleDao.findRoleByUserId"))})UserInfo findById(String id) throws Exception;

IRoleDao

    //根据用户id查询出所有对应的角色@Select("select * from role where id in (select roleId from users_role where userId=#{userId})")@Results({@Result(id = true, property = "id", column = "id"),@Result(property = "roleName", column = "roleName"),@Result(property = "roleDesc", column = "roleDesc"),@Result(property = "permissions",column = "id",javaType = java.util.List.class,many = @Many(select = "com.itheima.ssm.dao.IPermissionDao.findPermissionByRoleId"))})public List<Role> findRoleByUserId(String userId) throws Exception;

IPermissionDao

    @Select("select * from permission where id in (select permissionId from role_permission where roleId=#{id} )")public List<Permission> findPermissionByRoleId(String id) throws Exception;

user-show.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html><head><!-- 页面meta --><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>数据 - AdminLTE2定制版</title><meta name="description" content="AdminLTE2定制版"><meta name="keywords" content="AdminLTE2定制版"><!-- Tell the browser to be responsive to screen width --><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport"><!-- Bootstrap 3.3.6 --><!-- Font Awesome --><!-- Ionicons --><!-- iCheck --><!-- Morris chart --><!-- jvectormap --><!-- Date Picker --><!-- Daterange picker --><!-- Bootstrap time Picker --><!--<link rel="stylesheet" href="${pageContext.request.contextPath}/${pageContext.request.contextPath}/${pageContext.request.contextPath}/plugins/timepicker/bootstrap-timepicker.min.css">--><!-- bootstrap wysihtml5 - text editor --><!--数据表格--><!-- 表格树 --><!-- select2 --><!-- Bootstrap Color Picker --><!-- bootstrap wysihtml5 - text editor --><!--bootstrap-markdown--><!-- Theme style --><!-- AdminLTE Skins. Choose a skin from the css/skinsfolder instead of downloading all of them to reduce the load. --><!-- Ion Slider --><!-- ion slider Nice --><!-- bootstrap slider --><!-- bootstrap-datetimepicker --><!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --><!-- WARNING: Respond.js doesn't work if you view the page via file:// --><!--[if lt IE 9]><script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script><script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]--><!-- jQuery 2.2.3 --><!-- jQuery UI 1.11.4 --><!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip --><!-- Bootstrap 3.3.6 --><!-- Morris.js charts --><!-- Sparkline --><!-- jvectormap --><!-- jQuery Knob Chart --><!-- daterangepicker --><!-- datepicker --><!-- Bootstrap WYSIHTML5 --><!-- Slimscroll --><!-- FastClick --><!-- iCheck --><!-- AdminLTE App --><!-- 表格树 --><!-- select2 --><!-- bootstrap color picker --><!-- bootstrap time picker --><!--<script src="${pageContext.request.contextPath}/${pageContext.request.contextPath}/${pageContext.request.contextPath}/plugins/timepicker/bootstrap-timepicker.min.js"></script>--><!-- Bootstrap WYSIHTML5 --><!--bootstrap-markdown--><!-- CK Editor --><!-- InputMask --><!-- DataTables --><!-- ChartJS 1.0.1 --><!-- FLOT CHARTS --><!-- FLOT RESIZE PLUGIN - allows the chart to redraw when the window is resized --><!-- FLOT PIE PLUGIN - also used to draw donut charts --><!-- FLOT CATEGORIES PLUGIN - Used to draw bar charts --><!-- jQuery Knob --><!-- Sparkline --><!-- Morris.js charts --><!-- Ion Slider --><!-- Bootstrap slider --><!-- bootstrap-datetimepicker --><!-- 页面meta /--><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/font-awesome/css/font-awesome.min.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ionicons/css/ionicons.min.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/iCheck/square/blue.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/morris/morris.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-1.2.2.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/datepicker/datepicker3.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.css"><link rel="stylesheet"href="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/datatables/dataTables.bootstrap.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.css"><link rel="stylesheet"href="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.theme.default.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/select2/select2.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/colorpicker/bootstrap-colorpicker.min.css"><link rel="stylesheet"href="${pageContext.request.contextPath}/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/adminLTE/css/AdminLTE.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/adminLTE/css/skins/_all-skins.min.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.skinNice.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap-slider/slider.css"><link rel="stylesheet"href="${pageContext.request.contextPath}/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">
</head><body class="hold-transition skin-purple sidebar-mini"><div class="wrapper"><!-- 页面头部 --><jsp:include page="header.jsp"></jsp:include><!-- 页面头部 /--><!-- 导航侧栏 --><jsp:include page="aside.jsp"></jsp:include><!-- 导航侧栏 /--><!-- 内容区域 --><!-- @@master = admin-layout.html--><!-- @@block = content --><div class="content-wrapper"><!-- 内容头部 --><section class="content-header"><h1>用户管理<small>用户详情</small></h1><ol class="breadcrumb"><li><a href="${pageContext.request.contextPath}/index.jsp"><i class="fa fa-dashboard"></i> 首页</a></li><li><a href="${pageContext.request.contextPath}/user/findAll.do">用户管理</a></li><li class="active">用户详情</li></ol></section><!-- 内容头部 /--><!-- 正文区域 --><section class="content"><div class="box-body"><!--树表格--><div class="tab-pane" id="tab-treetable"><table id="collapse-table" class="table table-bordered table-hover dataTable"><thead><tr><th>用户</th><th>描述</th></tr></thead><tr data-tt-id="0"><td colspan="2">${user.username}</td></tr><tbody><c:forEach items="${user.roles}" var="role" varStatus="vs"><tr data-tt-id="${vs.index+1}" data-tt-parent-id="0"><td>${role.roleName}</td><td>${role.roleDesc}</td></tr><c:forEach items="${role.permissions}" var="p"><tr data-tt-id="1-1" data-tt-parent-id="${vs.index+1}"><td>${p.permissionName}</td><td>${p.url}</td></tr></c:forEach></c:forEach></tbody></table></div><!--树表格/--></div></section><!-- 正文区域 /--></div><!-- @@close --><!-- 内容区域 /--><!-- 底部导航 --><footer class="main-footer"><div class="pull-right hidden-xs"><b>Version</b> 1.0.8</div><strong>Copyright &copy; 2014-2017 <a href="http://www.itcast.cn">研究院研发部</a>.</strong> All rights reserved.</footer><!-- 底部导航 /--></div><script src="${pageContext.request.contextPath}/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/jQueryUI/jquery-ui.min.js"></script>
<script>$.widget.bridge('uibutton', $.ui.button);
</script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/raphael/raphael-min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/morris/morris.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="${pageContext.request.contextPath}/plugins/knob/jquery.knob.js"></script>
<script src="${pageContext.request.contextPath}/plugins/daterangepicker/moment.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.js"></script>
<script src="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="${pageContext.request.contextPath}/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/fastclick/fastclick.js"></script>
<script src="${pageContext.request.contextPath}/plugins/iCheck/icheck.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/adminLTE/js/app.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.js"></script>
<script src="${pageContext.request.contextPath}/plugins/select2/select2.full.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/js/markdown.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-markdown/js/to-markdown.js"></script>
<script src="${pageContext.request.contextPath}/plugins/ckeditor/ckeditor.js"></script>
<script src="${pageContext.request.contextPath}/plugins/input-mask/jquery.inputmask.js"></script>
<script src="${pageContext.request.contextPath}/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="${pageContext.request.contextPath}/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<script src="${pageContext.request.contextPath}/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/chartjs/Chart.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.resize.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.pie.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/flot/jquery.flot.categories.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-slider/bootstrap-slider.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script>$(document).ready(function () {// 选择框$(".select2").select2();// WYSIHTML5编辑器$(".textarea").wysihtml5({locale: 'zh-CN'});});// 设置激活菜单function setSidebarActive(tagUri) {var liObj = $("#" + tagUri);if (liObj.length > 0) {liObj.parent().parent().addClass("active");liObj.addClass("active");}}$(document).ready(function () {// 颜色选取器$(".my-colorpicker1").colorpicker();$(".my-colorpicker2").colorpicker();});$(document).ready(function () {// 选择框$(".select2").select2();});$(document).ready(function () {//Date picker$('#datepicker').datepicker({autoclose: true,language: 'zh-CN'});// datetime picker$('#dateTimePicker').datetimepicker({format: "mm/dd/yyyy - hh:ii",autoclose: true,todayBtn: true,language: 'zh-CN'});//Date range picker$('#reservation').daterangepicker({locale: {applyLabel: '确认',cancelLabel: '取消',fromLabel: '起始时间',toLabel: '结束时间',customRangeLabel: '自定义',firstDay: 1},opens: 'left', // 日期选择框的弹出位置separator: ' 至 '//showWeekNumbers : true,     // 是否显示第几周});//Date range picker with time picker$('#reservationtime').daterangepicker({timePicker: true,timePickerIncrement: 30,format: 'MM/DD/YYYY h:mm A',locale: {applyLabel: '确认',cancelLabel: '取消',fromLabel: '起始时间',toLabel: '结束时间',customRangeLabel: '自定义',firstDay: 1},opens: 'right', // 日期选择框的弹出位置separator: ' 至 '});//Date range as a button$('#daterange-btn').daterangepicker({locale: {applyLabel: '确认',cancelLabel: '取消',fromLabel: '起始时间',toLabel: '结束时间',customRangeLabel: '自定义',firstDay: 1},opens: 'right', // 日期选择框的弹出位置separator: ' 至 ',ranges: {'今日': [moment(), moment()],'昨日': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],'最近7日': [moment().subtract(6, 'days'), moment()],'最近30日': [moment().subtract(29, 'days'), moment()],'本月': [moment().startOf('month'), moment().endOf('month')],'上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]},startDate: moment().subtract(29, 'days'),endDate: moment()},function (start, end) {$('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));});});$(document).ready(function () {/*table tree*/$("#collapse-table").treetable({expandable: true});});$(document).ready(function () {CKEDITOR.replace('editor1');// $(".textarea").wysihtml5({//     locale:'zh-CN'// });$("#markdown-textarea").markdown({language: 'zh',autofocus: false,savable: false});});$(document).ready(function () {// 激活导航位置setSidebarActive("admin-dataform");});
</script>
</body></html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/68743.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

中间件(二)dubbo负载均衡介绍

一、负载均衡概述 支持轮询、随机、一致性hash和最小活跃数等。 1、轮询 ① sequences&#xff1a;内部的序列计数器 ② 服务器接口方法权重一样&#xff1a;&#xff08;sequences1&#xff09;%服务器的数量&#xff08;决定调用&#xff09;哪个服务器的服务。 ③ 服务器…

如何使用AIGC人工智能辅助开发?

文章目录 引言AIGC辅助开发的应用场景代码生成图像识别与生成自然语言处理视频剪辑与生成 AIGC辅助开发的实现步骤数据准备模型选择模型训练结果评估与优化应用开发 AIGC辅助开发的优势与局限优势局限 未来展望总结 &#x1f389;欢迎来到AIGC人工智能专栏~如何使用AIGC人工智能…

路由器和交换机的区别

交换机和路由器的区别 交换机实现局域网内点对点通信&#xff0c;路由器实现收集发散&#xff0c;相当于一个猎头实现的中介的功能 路由器属于网络层&#xff0c;可以处理TCP/IP协议&#xff0c;通过IP地址寻址&#xff1b;交换机属于中继层&#xff0c;通过MAC地址寻址(列表)…

Android Framework 动态更新插拔设备节点执行权限

TF卡设备节点是插上之后动态添加&#xff0c;所以不能通过初始化设备节点权限来解决&#xff0c;需要监听TF插入事件&#xff0c;在init.rc 监听插入后动态更新设备节点执行权限 添加插拔TF卡监听 frameworks/base/services/core/java/com/android/server/StorageManagerServic…

怎么学习AJAX相关技术? - 易智编译EaseEditing

学习AJAX&#xff08;Asynchronous JavaScript and XML&#xff09;相关技术可以让你实现网页的异步数据交互&#xff0c;提升用户体验。以下是一些学习AJAX技术的步骤和资源&#xff1a; HTML、CSS和JavaScript基础&#xff1a; 首先&#xff0c;确保你已经掌握了基本的HTML…

怎么使用手机远程控制Win10电脑?

可以使用手机远程控制电脑吗&#xff1f; “近期&#xff0c;我将出差一段时间。问题是&#xff0c;我希望能够从很远的地方浏览家里电脑上的一些东西&#xff0c;但我不会一直随身携带笨重的笔记本电脑。我可以手机远程访问Windows电脑吗&#xff1f; ” 当然&am…

地址解析协议-ARP

ARP协议 无论网络层使用何种协议&#xff0c;在实际网络的链路上传输数据帧时&#xff0c;最终必须使用硬件地址 地址解析协议&#xff08;Address Resolution Protocol&#xff0c;ARP&#xff09;&#xff1a;完成IP地址到MAC地址的映射&#xff0c;每个主机都有一个ARP高速缓…

使用 BERT 进行文本分类 (02/3)

​ 一、说明 在使用BERT&#xff08;1&#xff09;进行文本分类中&#xff0c;我向您展示了一个BERT如何标记文本的示例。在下面的文章中&#xff0c;让我们更深入地研究是否可以使用 BERT 来预测文本是使用 PyTorch 传达积极还是消极的情绪。首先&#xff0c;我们需要准备数据…

JAVA集合-List

// 数组的缺点&#xff1a;每次使用都需要指定长度&#xff0c;掉率低&#xff0c;操作麻烦 // // 【java集合体系】&#xff1a;分类&#xff1a;6个接口&#xff0c;1个工具类 // 6个接口&#xff1a; 单列 :Collection,(父接口) // …

2023 年牛客多校第九场题解

B Semi-Puzzle: Brain Storm 题意&#xff1a;给定 a , m a,m a,m&#xff0c;构造一个非负整数 u u u&#xff0c;使得 a u ≡ u ( m o d m ) a^u \equiv u \pmod m au≡u(modm)。 1 ≤ a < m ≤ 1 0 9 1 \le a<m \le 10^9 1≤a<m≤109&#xff0c; 0 ≤ u ≤ 1 …

AI百度文心一言大语言模型接入使用(中国版ChatGPT)

百度文心一言接入使用&#xff08;中国版ChatGPT&#xff09; 一、百度文心一言API二、使用步骤1、接口2、请求参数3、请求参数示例4、接口 返回示例 三、 如何获取appKey和uid1、申请appKey:2、获取appKey和uid 四、重要说明 一、百度文心一言API 基于百度文心一言语言大模型…

8.15起 webserver笔记

XShell 远程连接 XFTP 文件传输 VSC远程连接虚拟机&#xff0c;vim编辑器用起来不方便&#xff1a; 查看虚拟机IP地址&#xff1a; MY&#xff1a; 192.168.42.138 VSC每次都要密码&#xff0c;配置免密登录&#xff1a; 在本机命令行生成用户私钥&#xff1a;