Sfoglia il codice sorgente

后台图书管理员跟小塾管理员分开

shenhao 4 anni fa
parent
commit
ef411aefba

+ 59 - 2
src/main/java/com/ssj/sys/controller/SysLibController.java

@@ -143,7 +143,7 @@ public class SysLibController extends BaseController {
 		return "sys/lib/libJoinList";
 	}
 	/**
-	 * 图书馆管理员列表
+	 * 小塾管理员列表
 	 * @param model
 	 * @param pageSize
 	 * @param pageNo
@@ -155,7 +155,7 @@ public class SysLibController extends BaseController {
 			@RequestParam(required = false, defaultValue = "10") int pageSize,
 			@RequestParam(required = false, defaultValue = "1") int pageNo,String libId,String orgCode,
 			@RequestParam(required = false, defaultValue = "1") String libtype)
-					throws Exception {
+					 {
 		
 		Map<String, Object> params = new HashMap<String, Object>();
 		params.put("wx_name",request.getParameter("wx_name") == null ? "" : request.getParameter("wx_name"));
@@ -177,6 +177,37 @@ public class SysLibController extends BaseController {
 		return "sys/lib/libManagerList";
 	}
 	/**
+	 * 图书管理员列表
+	 * @param model
+	 * @param pageSize
+	 * @param pageNo
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/libReadManagerList")
+	public String libReadManagerList(Model model,
+			@RequestParam(required = false, defaultValue = "10") int pageSize,
+			@RequestParam(required = false, defaultValue = "1") int pageNo,String libId)
+					 {
+
+		Map<String, Object> params = new HashMap<String, Object>();
+		params.put("wx_name",request.getParameter("wx_name") == null ? "" : request.getParameter("wx_name"));
+		params.put("libId", libId);
+		SplitPage sp = new SplitPage();
+		sp.setAction(request.getRequestURI());
+		sp.setPageNo(pageNo);
+		sp.setPageSize(pageSize);
+		sp.setParams(params);
+		Page<Map<String, Object>> page = libJoinService.findReadForPage(params, initPage(pageNo, pageSize));
+		sp.setRowCnt((int) page.getTotalElements());
+		model.addAttribute("list", page.getContent());
+		model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
+		model.addAttribute("page", sp);
+		model.addAttribute("search", params);
+
+		return "sys/lib/libReadManagerList";
+	}
+	/**
 	 * 图书馆新增、修改
 	 * @param model
 	 * @param id
@@ -291,6 +322,32 @@ public class SysLibController extends BaseController {
 		 response.success();
 		 return response;
 	 }
+
+
+	@RequestMapping(value = "/libReadManagerDelete", method = RequestMethod.POST)
+	@ResponseBody
+	public Response libReadManagerDelete( String id){
+		Response response = new  Response();
+		TbLibReadManager manager= readManagerService.getById(id);
+		String userId = manager.getUserId();
+		int type = manager.getType();
+		if(type==1){
+			userId="JIEYUE"+userId;//图书借阅
+		}else if(type==2){
+			userId ="ZUOYB"+userId;//作业吧
+		}else if(type==3){
+			userId ="XUEBA"+userId; //学霸老师
+		}else{
+			userId ="CD"+userId; //学霸老师
+		}
+		tokenManager.createManageType(userId,"0");
+		tokenManager.delToken(manager.getUserId());
+
+		manager.setState(2);
+		readManagerService.save(manager);
+		response.success();
+		return response;
+	}
 	 
 	 
 	    @RequestMapping("/selectUserList")

+ 2 - 1
src/main/resources/templates/sys/lib/libJoinList.html

@@ -86,7 +86,8 @@
 					<td th:text="${#calendars.format(item.createTime,'yyyy-MM-dd')}" ></td>
 					<td>
 					  <div>
-						<a th:href="@{/sys/lib/libManagerList.html(libId=${item.id},orgCode=${item.orgCode},libtype=${item.libtype})}" class="tablelink" >图书馆管理员</a>
+						<a th:href="@{/sys/lib/libManagerList.html(libId=${item.id},orgCode=${item.orgCode},libtype=${item.libtype})}" class="tablelink" >小塾管理员</a>
+						<a th:href="@{/sys/lib/libReadManagerList.html(libId=${item.id},orgCode=${item.orgCode},libtype=${item.libtype})}" class="tablelink" >图书馆管理员</a>
 						<a th:href="@{/sys/lib/libJoinAdd.html(id=${item.id})}" th:if="${ #httpSession.getAttribute('admin') !=null   && (#httpSession.getAttribute('admin').loginName eq 'admin' || #httpSession.getAttribute('admin').loginName eq 'manting' || #httpSession.getAttribute('admin').loginName eq 'sishujia' )  } "  class="tablelink">修改</a>
 						<a href="javascript:;" th:onclick="'createQrById(\''+${item.id}+'\')'" class="tablelink"  th:if="${ #httpSession.getAttribute('admin') !=null  && #httpSession.getAttribute('admin').loginName eq 'admin'   } "  >生成二维码</a>
 						<a th:href="@{/sys/problem/checklist.html(libId=${item.id},type=1)}" th:if="${item.libtype eq 1}" class="tablelink">批量签到</a>

+ 0 - 30
src/main/resources/templates/sys/lib/libManagerList.html

@@ -42,42 +42,12 @@
 			<label>&nbsp;</label>
 			<input type="button" class="scbtn" value="查询" />
 		</li>
-		<li th:if="${search.get('libtype') eq '1'}">
-				<ul class="toolbar">
-					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',1)'" >
-					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增图书馆管理员</li></a>
-				</ul>
-		</li>
-		<li th:if="${search.get('libtype') ne '1'}">
-				<ul class="toolbar">
-					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',1)'" >
-					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增馆长助理</li></a>
-				</ul>
-		</li>
 		<li>
 				<ul class="toolbar">
 					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',2)'" >
 					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增学习导师</li></a>
 				</ul>
 		</li>
-		<li th:if="${search.get('libtype') eq '1'}">
-				<ul class="toolbar">
-					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',3)'" >
-					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增阅读顾问</li></a>
-				</ul>
-		</li>
-		<li>
-				<ul class="toolbar">
-					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',0)'" >
-					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增馆长</li></a>
-				</ul>
-		</li>
-		<li th:if="${search.get('libtype') ne '1'}">
-				<ul class="toolbar">
-					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',5)'" >
-					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增管理合伙人</li></a>
-				</ul>
-		</li>
 		<li >
 				<ul class="toolbar">
 					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',4)'" >

+ 159 - 0
src/main/resources/templates/sys/lib/libReadManagerList.html

@@ -0,0 +1,159 @@
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>私塾家</title>
+<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
+<script th:include="sys/common/metaJS" th:remove="tag"></script> 
+</head>
+<style>
+	.tablelink{margin-right:10px;}
+	.stylecss{
+	      color: red;
+	}
+	.stylecss2{
+		  color:blue;
+	}
+	.select_width{
+	     width: 80px;
+	}
+	.date_width{
+	     width: 100px;
+	}
+	.stylecss{
+	      color: red;
+	}
+</style>
+<body>
+<div class="place">
+	<span>位置:</span>
+	<ul class="placeul">
+		<li><a href="#">图书馆管理</a></li>
+		<li><a th:href="@{/sys/lib/libJoinList.html}">图书馆</a></li>
+	</ul>
+</div>
+<div class="rightinfo">
+	<form id="seachform" th:action="@{/sys/lib/libReadManagerList.html}" method="post">
+	<input type="hidden" name="libId" th:value="${search.get('libId')}">
+	<ul class="seachform">
+		<li>
+			<label>昵称</label>
+			<input name="wx_name" type="text" class="scinput" th:value="${search.get('wx_name')} == null  ? '': ${search.get('wx_name')}"/>
+		</li>
+		<li>
+			<label>&nbsp;</label>
+			<input type="button" class="scbtn" value="查询" />
+		</li>
+		<li>
+				<ul class="toolbar">
+					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',1)'" >
+					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增馆长助理</li></a>
+				</ul>
+		</li>
+		<li>
+				<ul class="toolbar">
+					<a href="javascript:;"  th:onclick="'addAdmin(\''+${search.get('libId')}+'\',0)'" >
+					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增馆长</li></a>
+				</ul>
+		</li>
+		<li>
+				<ul class="toolbar">
+					<a th:href="@{/sys/lib/libJoinList.html}"><li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/goto.png}" /></span>返回</li></a>
+				</ul>
+		</li>
+	</ul>
+	</form>
+	<table class="tablelist">
+		<thead>
+		    <tr>
+		        <th style="width: 50px;">序号</th>
+		        <th>昵称</th>
+		        <th>类型</th>
+		        <th>头像</th>
+		        <th>添加时间</th>
+		        <th>操作</th>
+		    </tr>
+		</thead>
+		<tbody>
+			<tr th:each="item:${list}" >
+				<td th:text="${itemStat.count}" ></td>
+					<td th:title="${item.get('wx_name')}" th:text="${item.get('wx_name')} ? (${#strings.length(item.get('wx_name'))} &gt; 40 ? ${#strings.substring(item.get('wx_name'),0,40)} :${item.get('wx_name')} ) :'' ">
+					</td>
+					<td th:switch="${item.get('type')}" >
+				    <a href="javascript:;" th:case="1" >馆长助理</a>
+				    <a href="javascript:;" th:case="0" >馆长</a>
+					</td>
+					<td  class="imgtd">
+							<img  th:if="${item.get('photo')}!=null" th:src="${imgUrl}+''+${item.get('photo')}" style="width: 50px;height: 50px;" />
+					</td>
+					<td  th:text="${#calendars.format(item.get('create_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
+					<td>
+						<a href="javascript:;" th:onclick="'deleteById(\''+${item.id}+'\')'" class="tablelink" >删除</a>
+						<a  href="javascript:;"   th:onclick="'updateById(\''+${item.id}+'\')'"   class="tablelink">修改</a>
+				    </td>
+				
+			</tr>
+		</tbody>
+	</table>
+	<!-- 分页 -->
+	<div class="pagin">
+    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录,当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
+    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
+   	</div>
+</div>
+</body>
+<script type="text/javascript">
+function deleteById(id){
+	layer.confirm("确定删除该管理员?",
+			{icon: 4, btn: ['确定','取消']
+	}, function(){
+		$.ajax({
+			url: '[[${sysUrl}]]/sys/lib/libReadManagerDelete',
+			type: "post",
+			data:{
+				'id': id
+			},
+			dataType: "json",
+			success:function(data){
+					
+					if(data.meta.success){
+						layer.msg("删除成功",{icon:1});
+				    	setTimeout(function(){
+				    		location.reload();
+						},1000);
+					}else{
+						layer.msg(data.meta.message,{icon:11});
+					}
+			}
+		});
+	});
+}
+
+function updateById(id){
+	layer.open({
+		type: 2,
+		title: "修改姓名",
+		closeBtn: 1, //不显示关闭按钮
+		shift: 0.8,
+		//offset: '100px',
+		area: ['55%', '55%'],
+		content: "[[${sysUrl}]]/sys/lib/libReadManagerEdit.html?id="+id
+	});
+}
+
+function addAdmin(id,type){
+	var   title ='添加图书馆管理员';
+	if(type==0){
+		title="添加馆长";
+	}
+	var content= '[[${sysUrl}]]/sys/lib/selectUserList.html?libId='+id+'&type='+type;
+	layer.open({
+	    type: 2,
+	    title: title,
+	    closeBtn: 1, //不显示关闭按钮
+	    shift: 0.8,
+	    //offset: '100px',
+	    area: ['80%', '80%'],
+	    content:content
+	});
+}
+</script>
+</html>