2020.2.15修复了管理员信息模糊查询后不分页

main
ppdxzz 5 years ago
parent c83a705aee
commit f8533f0fa0

@ -8,6 +8,7 @@
<component name="ChangeListManager">
<list default="true" id="8033210d-c341-4f39-a328-95fe94016f00" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/controller/AdminController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/controller/AdminController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/dao/AdminDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/dao/AdminDao.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/service/AdminService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/service/AdminService.java" afterDir="false" />
@ -15,9 +16,10 @@
<change beforePath="$PROJECT_DIR$/src/main/resources/spring-mvc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/spring-mvc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-edit.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-edit.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/error.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/error.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/login.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/login.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/main.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/main.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/js/excel.min.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/cn/ppdxzz/controller/AdminController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/cn/ppdxzz/controller/AdminController.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/cn/ppdxzz/dao/AdminDao.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/cn/ppdxzz/dao/AdminDao.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/cn/ppdxzz/service/AdminService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/cn/ppdxzz/service/AdminService.class" afterDir="false" />
@ -30,9 +32,10 @@
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/classes/spring-mvc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/classes/spring-mvc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-edit.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-edit.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/error.jsp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/login.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/login.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/main.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/main.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/web.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/web.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/js/excel.min.js" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -93,9 +96,6 @@
<property name="settings.editor.selected.configurable" value="editor.preferences.gutterIcons" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\Development tools\IDEA\IntelliJ IDEA 2019.2.4\hellossm\src\main\webapp" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\Development tools\IDEA\IntelliJ IDEA 2019.2.4\hellossm\src\main\webapp\js" />
<recent name="D:\Development tools\IDEA\IntelliJ IDEA 2019.2.4\hellossm\src\main\webapp\images" />
@ -103,6 +103,9 @@
<recent name="D:\Development tools\IDEA\IntelliJ IDEA 2019.2.4\hellossm\src\main\webapp" />
<recent name="D:\Development tools\IDEA\IntelliJ IDEA 2019.2.4\hellossm\src\main\webapp\WEB-INF\jsp" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\Development tools\IDEA\IntelliJ IDEA 2019.2.4\hellossm\src\main\webapp" />
</key>
</component>
<component name="RunManager" selected="Tomcat Server.Tomcat 9.0.24">
<configuration name="MD5Util" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
@ -216,7 +219,7 @@
<path>
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
<item name="Tomcat Server" type="7427dc5b:ServiceModel$ServiceGroupNode" />
<item name="Running" type="7427dc5b:ServiceModel$ServiceGroupNode" />
<item name="Finished" type="7427dc5b:ServiceModel$ServiceGroupNode" />
</path>
</expand>
<select />
@ -250,7 +253,7 @@
<workItem from="1581573464530" duration="26409000" />
<workItem from="1581649259154" duration="10514000" />
<workItem from="1581662911720" duration="23085000" />
<workItem from="1581731575582" duration="2079000" />
<workItem from="1581731575582" duration="47721000" />
</task>
<servers />
</component>
@ -270,90 +273,90 @@
<screen x="0" y="0" width="1366" height="728" />
</state>
<state x="137" y="23" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1366.728@0.0.1366.728" timestamp="1581485477637" />
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser" timestamp="1581683925355">
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser" timestamp="1581771525224">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser/0.0.1366.728@0.0.1366.728" timestamp="1581683925355" />
<state width="1059" height="283" key="GridCell.Tab.0.bottom" timestamp="1581733809238">
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser/0.0.1366.728@0.0.1366.728" timestamp="1581771525224" />
<state width="1059" height="2" key="GridCell.Tab.0.bottom" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.0.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581733809238" />
<state width="1059" height="283" key="GridCell.Tab.0.center" timestamp="1581733809237">
<state width="1059" height="2" key="GridCell.Tab.0.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.0.center" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.0.center/0.0.1366.728@0.0.1366.728" timestamp="1581733809237" />
<state width="1059" height="283" key="GridCell.Tab.0.left" timestamp="1581733809236">
<state width="1059" height="2" key="GridCell.Tab.0.center/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.0.left" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.0.left/0.0.1366.728@0.0.1366.728" timestamp="1581733809236" />
<state width="1059" height="283" key="GridCell.Tab.0.right" timestamp="1581733809238">
<state width="1059" height="2" key="GridCell.Tab.0.left/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.0.right" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.0.right/0.0.1366.728@0.0.1366.728" timestamp="1581733809238" />
<state width="1059" height="264" key="GridCell.Tab.1.bottom" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.0.right/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.1.bottom" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.1.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.1.center" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.1.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.1.center" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.1.center/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.1.left" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.1.center/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.1.left" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.1.left/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.1.right" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.1.left/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.1.right" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.1.right/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.2.bottom" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.1.right/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.2.bottom" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.2.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.2.center" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.2.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.2.center" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.2.center/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.2.left" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.2.center/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.2.left" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.2.left/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="264" key="GridCell.Tab.2.right" timestamp="1581690420801">
<state width="1059" height="2" key="GridCell.Tab.2.left/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.2.right" timestamp="1581782641454">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="264" key="GridCell.Tab.2.right/0.0.1366.728@0.0.1366.728" timestamp="1581690420801" />
<state width="1059" height="283" key="GridCell.Tab.3.bottom" timestamp="1581733811544">
<state width="1059" height="2" key="GridCell.Tab.2.right/0.0.1366.728@0.0.1366.728" timestamp="1581782641454" />
<state width="1059" height="2" key="GridCell.Tab.3.bottom" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.3.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581733811544" />
<state width="1059" height="283" key="GridCell.Tab.3.center" timestamp="1581733811544">
<state width="1059" height="2" key="GridCell.Tab.3.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.3.center" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.3.center/0.0.1366.728@0.0.1366.728" timestamp="1581733811544" />
<state width="1059" height="283" key="GridCell.Tab.3.left" timestamp="1581733811544">
<state width="1059" height="2" key="GridCell.Tab.3.center/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.3.left" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.3.left/0.0.1366.728@0.0.1366.728" timestamp="1581733811544" />
<state width="1059" height="283" key="GridCell.Tab.3.right" timestamp="1581733811544">
<state width="1059" height="2" key="GridCell.Tab.3.left/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.3.right" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="283" key="GridCell.Tab.3.right/0.0.1366.728@0.0.1366.728" timestamp="1581733811544" />
<state width="1059" height="233" key="GridCell.Tab.4.bottom" timestamp="1581662103502">
<state width="1059" height="2" key="GridCell.Tab.3.right/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.4.bottom" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="233" key="GridCell.Tab.4.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581662103502" />
<state width="1059" height="233" key="GridCell.Tab.4.center" timestamp="1581662103502">
<state width="1059" height="2" key="GridCell.Tab.4.bottom/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.4.center" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="233" key="GridCell.Tab.4.center/0.0.1366.728@0.0.1366.728" timestamp="1581662103502" />
<state width="1059" height="233" key="GridCell.Tab.4.left" timestamp="1581662103502">
<state width="1059" height="2" key="GridCell.Tab.4.center/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.4.left" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="233" key="GridCell.Tab.4.left/0.0.1366.728@0.0.1366.728" timestamp="1581662103502" />
<state width="1059" height="233" key="GridCell.Tab.4.right" timestamp="1581662103502">
<state width="1059" height="2" key="GridCell.Tab.4.left/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state width="1059" height="2" key="GridCell.Tab.4.right" timestamp="1581775851407">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state width="1059" height="233" key="GridCell.Tab.4.right/0.0.1366.728@0.0.1366.728" timestamp="1581662103502" />
<state width="1059" height="2" key="GridCell.Tab.4.right/0.0.1366.728@0.0.1366.728" timestamp="1581775851407" />
<state x="213" y="23" key="Maven.ArtifactSearchDialog" timestamp="1581325031095">
<screen x="0" y="0" width="1366" height="728" />
</state>

@ -147,13 +147,23 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<!--PageHelper分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.5</version>
</dependency>
</dependencies>
<build>

@ -8,6 +8,7 @@ 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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
@ -29,7 +30,6 @@ import java.util.List;
@Controller
public class AdminController {
private PrintWriter writer;
private AdminService adminService;
@Autowired
public void setAdminService(AdminService adminService) {
@ -89,11 +89,11 @@ public class AdminController {
response.setCharacterEncoding("utf-8");
ModelAndView mv = new ModelAndView();
List<Admin> admins = null;
String username = request.getParameter("username");
if (username == null || username.trim().equals("") || username.length() == 0) {
String keyword = request.getParameter("keyword");
if (keyword == null || keyword.trim().equals("") || keyword.length() == 0) {
admins = adminService.findAll(page,size);
}else {
admins = adminService.serarchInfo(page,size,username);
admins = adminService.serarchInfo(page,size,keyword);
}
//PageInfo就是一个封装了分页数据的bean
PageInfo pageInfo = new PageInfo(admins);
@ -101,7 +101,7 @@ public class AdminController {
mv.setViewName("admin-list");
return mv;
}
/**
*
*/
@ -185,13 +185,12 @@ public class AdminController {
//修改管理员信息
@RequestMapping("/editAdmin")
public void editAdmin(Admin admin,HttpServletResponse response) throws Exception {
writer = response.getWriter();
PrintWriter writer = response.getWriter();
if (admin == null) {
writer.write("false");
return;
}else {
if(admin.getUsername() == null || "".trim().equals(admin.getUsername())
|| admin.getPassword() == null ||"".trim().equals(admin.getPassword())
|| admin.getName() == null || "".trim().equals(admin.getName())
|| admin.getPhone() == null || "".trim().equals(admin.getPhone())
|| admin.getDescription() == null || "".trim().equals(admin.getDescription())) {
@ -199,12 +198,37 @@ public class AdminController {
return;
}
}
admin.setPassword(MD5Util.MD5EncodeUtf8(admin.getPassword()));
//admin.setPassword(MD5Util.MD5EncodeUtf8(admin.getPassword()));
adminService.updateAdmin(admin);
//更新成功进行提示信息回显
writer.write("true");
}
/**
*
*/
@RequestMapping("/put_power")
public void put_power(Admin admin,HttpServletResponse response) throws Exception {
PrintWriter writer = response.getWriter();
if (admin == null) {
writer.write("false");
return;
}
if (admin.getPower() < 0 || admin.getPower() > 3) {
writer.write("false");
return;
}
adminService.put_power(admin);
writer.write("true");
}
@ResponseBody
@RequestMapping(value = "/exportAdminInfo")
public List<Admin> export() throws Exception {
List<Admin> admins = adminService.exportAdminInfo();
return admins;
}

@ -31,11 +31,19 @@ public interface AdminDao {
Admin findAdminById(Integer id) throws Exception;
/**
*
*
*/
@Select("select * from admins")
List<Admin> findAll() throws Exception;
/**
*
* @return
* @throws Exception
*/
@Select("select * from admins")
List<Admin> exportAdminInfo() throws Exception;
/**
* id
* @param id
@ -49,7 +57,7 @@ public interface AdminDao {
* @param admin
* @throws Exception
*/
@Update("update admins set username= #{username},password = #{password},name = #{name}, phone = #{phone}, power = #{power}, description = #{description} where id = #{id}")
@Update("update admins set username= #{username},name = #{name}, phone = #{phone}, description = #{description} where id = #{id}")
void updateAdmin(Admin admin) throws Exception;
/**
@ -77,7 +85,15 @@ public interface AdminDao {
//select * from admins where username like '%p%' or name like '%万%' or power like '%1%' or description like '%管理员%';
//模糊搜索管理员信息查询结果返回一个list集合
@Select("select * from admins where username like '%${tip}%' or name like '%${tip}%' or power like '%${tip}%' or description like '%${tip}%'")
List<Admin> serarchInfo(@Param(value="tip") String tip) throws Exception;
@Select("select * from admins where username like '%${keyword}%' or name like '%${keyword}%' or phone like '%${keyword}%' or power like '%${keyword}%' or description like '%${keyword}%' ")
List<Admin> serarchInfo(@Param(value="keyword") String keyword) throws Exception;
/**
*
* 0 1 2 3
* @param admin
* @throws Exception
*/
@Update("update admins set power = #{power} where id = #{id} ")
void put_power(Admin admin) throws Exception;
}

@ -28,5 +28,15 @@ public interface AdminService {
Boolean checkUserName(String u_name) throws Exception;
//模糊搜索管理员信息查询结果返回一个list集合
List<Admin> serarchInfo(int page,int size,String tip) throws Exception;
List<Admin> serarchInfo(int page,int size,String keyword) throws Exception;
//授权
void put_power(Admin admin) throws Exception;
/**
*
* @return
* @throws Exception
*/
List<Admin> exportAdminInfo() throws Exception;
}

@ -101,14 +101,24 @@ public class AdminServiceImpl implements AdminService {
/**
*
* @param tip
* @param keyword
* @return
* @throws Exception
*/
@Override
public List<Admin> serarchInfo(int page,int size,String tip) throws Exception {
public List<Admin> serarchInfo(int page,int size,String keyword) throws Exception {
PageHelper.startPage(page,size);
List<Admin> list = adminDao.serarchInfo(tip);
List<Admin> list = adminDao.serarchInfo(keyword);
return list;
}
@Override
public void put_power(Admin admin) throws Exception {
adminDao.put_power(admin);
}
@Override
public List<Admin> exportAdminInfo() throws Exception {
return adminDao.exportAdminInfo();
}
}

@ -18,6 +18,12 @@
<context:component-scan base-package="cn.ppdxzz">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<!--配置视图解析器-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
@ -32,7 +38,6 @@
<mvc:resources location="/layui_exts/" mapping="/layui_exts/**" />
<mvc:resources location="/layer/" mapping="/layer/**" />
<!--开启SpringMVC的注解支持-->
<mvc:annotation-driven />
<!--
支持AOP的注解支持AOP底层使用代理技术
JDK动态代理要求必须有接口

@ -25,12 +25,6 @@
<input type="text" readonly value="${ad.username}" class="form-control" name="username" id="username">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label form-label">密码:</label>
<div class="col-sm-8">
<input type="text" value="${ad.password}" class="form-control" name="password" id="password">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label form-label">姓名:</label>
<div class="col-sm-8">
@ -43,7 +37,7 @@
<input type="text" value="${ad.phone}" class="form-control" name="phone" id="phone">
</div>
</div>
<div class="form-group">
<%--<div class="form-group">
<label class="col-sm-2 control-label form-label">权限:</label>
<div class="col-sm-8">
<c:if test="${ad.power == 0}">
@ -69,7 +63,7 @@
</select>
</c:if>
</div>
</div>
</div>--%>
<div class="form-group">
<label class="col-sm-2 control-label form-label">描述:</label>
<div class="col-sm-8">
@ -96,7 +90,6 @@
name:"notEmpty",
description:"notEmpty",
phone:"mobile",
password:"notEmpty"
},
/*submitFun里面为检验成功后要执行的方法*/
submitFun:function(){
@ -108,10 +101,8 @@
//增加管理员,异步提交管理员表单
var id = $("#id").val().trim();
var username = $("#username").val().trim();
var password = $("#password").val().trim();
var name = $("#name").val().trim();
var phone = $("#phone").val().trim();
var power = $("#power").val().trim();
var description = $("#description").val().trim();
$.ajax({
url: "${pageContext.request.contextPath}/editAdmin",//要请求的服务器url
@ -120,10 +111,8 @@
data: {
id:$("#id").val().trim(),
username:$("#username").val().trim(),
password:$("#password").val().trim(),
name: $("#name").val().trim(),
phone: $("#phone").val().trim(),
power: $("#power").val().trim(),
description: $("#description").val().trim(),
},
type: "POST", //请求方式为POST

@ -20,6 +20,8 @@
<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/xadmin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
<script type="text/javascript" charset="UTF-8" src="${pageContext.request.contextPath}/layui_exts/excel.js"></script>
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
@ -32,20 +34,23 @@
location.href = "${pageContext.request.contextPath}/findAllAdmin?page=1&size="+ pageSize;
}
$("#serarch_btn").click(function () {
var username = $("#username").val();
var password = $("#password").val();
location.href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4&username="+username;
var keyword = $("#keyword").val();
location.href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4&keyword="+keyword;
});
$("#refresh").click(function () {
$("#myform").reset();
location.href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4";
});
</script>
</head>
<body>
<%--<div class="x-nav">
&lt;%&ndash;<span class="layui-breadcrumb">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素</cite></a>
</span>&ndash;%&gt;
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>--%>
@ -54,19 +59,16 @@
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body ">
<form class="layui-form layui-col-space5">
<div class="layui-inline layui-show-xs-block">
<input class="layui-input" type="text" autocomplete="on" placeholder="用户名" name="username" id="username" value="${param.username}">
</div>
<div class="layui-inline layui-show-xs-block">
<input class="layui-input" type="text" autocomplete="off" placeholder="姓名" name="name" id="name">
</div>
<form id="myform" class="layui-form layui-col-space5">
<div class="layui-inline layui-show-xs-block">
<input type="text" name="description" id="description" placeholder="描述" autocomplete="off" class="layui-input">
<input class="layui-input" type="text" autocomplete="off" placeholder="请输入关键字" name="keyword" id="keyword" value="${param.keyword}">
</div>
<div class="layui-inline layui-show-xs-block">
<button class="layui-btn" id="serarch_btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
</div>
<div class="layui-inline layui-show-xs-block x-right">
<a class="layui-btn layui-btn-normal" href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4"><i class="layui-icon">&#xe669;</i></a>
</div>
</form>
</div>
<xblock>
@ -78,6 +80,7 @@
<table class="layui-table layui-form">
<thead>
<tr style="text-align: center">
<th style="text-align: center">ID</th>
<th style="text-align: center">用户名</th>
<th style="text-align: center">姓名</th>
<th style="text-align: center">联系方式</th>
@ -86,8 +89,12 @@
<th style="text-align: center">操作</th>
</thead>
<tbody>
<%
int j = 1;
%>
<c:forEach items="${pageInfo.list}" var="admin">
<tr style="text-align: center">
<tr id="light" style="text-align: center">
<td><%=j++%></td>
<td>${admin.username}</td>
<td>${admin.name}</td>
<td>${admin.phone}</td>
@ -97,22 +104,24 @@
<a title="编辑" href="${pageContext.request.contextPath}/adminEdit?id=${admin.id}">
<i class="layui-icon">&#xe642;</i>
</a>
<a onclick="member_stop(this,'10001')" href="javascript:;" title="授权">
<a title="授权" onclick="put_power(this,${admin.id},${sessionScope.adminInfo.power})" href="javascript:;">
<i class="layui-icon">&#xe672;</i>
</a>
<a title="删除" onclick="member_del(this,${admin.id},${sessionScope.adminInfo.power})" href="javascript:;">
<a title="删除" onclick="member_del(this,${admin.id},${sessionScope.adminInfo.power},${admin.power})" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</td>
</c:forEach>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div class="pull-left">
<div class="form-group form-inline">
当前页:${pageInfo.pageNum}&nbsp;/&nbsp;${pageInfo.pages}&emsp; 每页
共&nbsp;${pageInfo.pages}&nbsp;页&emsp;当前页:${pageInfo.pageNum}&nbsp;/&nbsp;${pageInfo.pages}&emsp; 每页
<select class="form-control" id="changePageSize" onchange="changePageSize()">
<option value="1">${pageInfo.size}</option>
<option value="2">2</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="10">10</option>
@ -121,47 +130,142 @@
</select> 条
</div>
</div>
<div class="box-tools pull-right">
<ul class="pagination">
<li>
<a href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=${pageInfo.pageSize}&username=${param.username}" aria-label="Previous">首页</a>
</li>
<c:if test="${pageInfo.pageNum > 1}">
<li><a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}&username=${param.username}">上一页</a></li>
</c:if>
<c:forEach begin="1" end="${pageInfo.pages}" var="pageNum">
<li><a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageNum}&size=${pageInfo.pageSize}&username=${param.username}">${pageNum}</a></li>
</c:forEach>
<c:if test="${pageInfo.pageNum < pageInfo.pages}">
<li><a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&username=${param.username}">下一页</a></li>
</c:if>
<li>
<a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pages}&size=${pageInfo.pageSize}&username=${param.username}" aria-label="Next">尾页</a>
</li>
</ul>
<c:choose>
<c:when test="${pageInfo.pages < 5}">
<c:set var="begin" value="1">
</c:set>
<c:set var="end" value="${pageInfo.pages}">
</c:set>
</c:when>
<c:when test="${pageInfo.pageNum <= 3}">
<c:set var="begin" value="1">
</c:set>
<c:set var="end" value="5">
</c:set>
</c:when>
<c:when test="${pageInfo.pageNum > 3 and pageInfo.pageNum <= pageInfo.pages-2}">
<c:set var="begin" value="${pageInfo.pageNum - 2}">
</c:set>
<c:set var="end" value="${pageInfo.pageNum + 2}">
</c:set>
</c:when>
<c:otherwise>
<c:set var="begin" value="${pageInfo.pages - 4}">
</c:set>
<c:set var="end" value="${pageInfo.pages}">
</c:set>
</c:otherwise>
</c:choose>
<div class="layui-card-body x-right" style="height: min-content">
<div class="page">
<div>
<a class="next" href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=${pageInfo.pageSize}&keyword=${param.keyword}">首页</a>
<c:if test="${pageInfo.pageNum > 1}">
<a class="prev" href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">上一页</a>
</c:if>
<c:forEach var="i" begin="${begin}" end="${end}" step="1">
<c:if test="${pageInfo.pageNum == i}">
<span class="current">${i}</span>
</c:if>
<c:if test="${pageInfo.pageNum != i}">
<a class="num" href="${pageContext.request.contextPath}/findAllAdmin?page=${i}&size=${pageInfo.pageSize}&keyword=${param.keyword}">${i}</a>
</c:if>
</c:forEach>
<c:if test="${pageInfo.pageNum < pageInfo.pages}">
<a class="next" href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">下一页</a>
</c:if>
<a class="next" href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pages}&size=${pageInfo.pageSize}&keyword=${param.keyword}">尾页</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
/*function edit_admin(obj,id) {
//layer.msg('编辑'+id);
var index = layer.open({
type: 2 //Page层类型
,area: ['900px', '480px']
,title: '修改信息'
,shade: 0.6 //遮罩透明度
,maxmin: true //允许全屏最小化
,anim: 2 //0-6的动画形式-1不开启
,content: 'http://localhost:8080/hellossm/adminEdit?id='+id
layui.config({
base: 'layui_exts/',
}).extend({
excel: 'excel',
});
layui.use(['jquery', 'excel', 'form','layer','laydate'], function(){
var form = layui.form,
$ = layui.jquery,
laydate = layui.laydate;
var excel = parent.layui.excel;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
layer.full(index);
}*/
/*用户-删除*/
function member_del(obj,id,power){
form.render();
form.on('submit(toolbarDemo)', function(){
$.ajax({
url: '${pageContext.request.contextPath}/exportAdminInfo',
type: 'post',
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (data) {
// 假如返回的 data 是需要导出的列表数据
console.log(data);
// 1. 如果需要调整顺序,请执行梳理函数
var dt = excel.filterExportData(data, [
'id'
,'username'
,'password'
,'name'
,'phone'
,'power'
,'description'
]);
// 2. 数组头部新增表头
dt.unshift({id: 'ID', username: '用户名', password: '密码', name: '姓名', phone: '手机号', power: '权限', description: '权限描述'});
// 3.自定义导出Excel各字段的宽度
var colConf = excel.makeColConfig({
'A': 40,
'B': 50,
'C': 120,
'D': 80,
'F': 120
}, 60);
var time_start = Date.now();
// 3. 执行导出函数,系统会弹出弹框
excel.exportExcel({
sheet1: dt
}, '管理员导出数据.xlsx', 'xlsx', {
extend: {
'!cols': colConf
}
});
var time_end = Date.now();
var spent_time = (time_end - time_start) / 1000;
layer.msg('导出数据共耗时'+spent_time+'s');
//setTimeout(function () {window.location.href='/findAdmin';},2000);
},
error: function () {
//console.log(data);
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/findAllAdmin';},2000);
}
});
});
});
</script>
<script>
function member_del(obj,id,power,del_power){
layer.confirm('确认要删除吗?',function(index){
if (power == 0){
if (power == 0 || power < del_power){
layer.msg('对不起,您没有权限!');
return false;
}
@ -178,6 +282,46 @@
});
});
}
function put_power(obj,id,power) {
//验证是否拥有权限
if (power == 0) {
layer.msg('对不起,您没有权限!');
return false;
}
//prompt层
layer.prompt({title: '输入授权密码,完成身份校验', formType: 1}, function(password, index){
if (password != 123) {
layer.msg('授权密码有误,身份验证失败');
layer.close(index);
return false;
}
layer.close(index);
layer.prompt({title: '输入权限级别,并确认授权', formType: 1}, function(level, index){
if (level < 0 || level > 3) {
layer.msg('授权等级输入有误,请重新输入!')
return false;
}
if (level > power) {
layer.msg('对不起,您权限不足!')
layer.close(index);
return false;
}
$.get("${pageContext.request.contextPath}/put_power",{"id":id,"power":level},function (data) {
if(data){
layer.msg('授权成功!');
layer.close(index);
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/findAllAdmin';},2000);
}else {
layer.msg('授权失败,请联系管理员!');
layer.close(index);
}
});
layer.close(index);
});
});
}
</script>
</body>
</html>

@ -64,11 +64,6 @@
<div class="sk-rotating-plane"></div>
</div>
</form>
<%--<c:if test="${msg != null}">
<script>
layer.msg("${msg}");
</script>
</c:if>--%>
<script src="${pageContext.request.contextPath}/js/particles.min.js"></script>
<script src="${pageContext.request.contextPath}/js/app.js"></script>
<script type="text/javascript">

@ -29,36 +29,13 @@
<div class="left_open">
<a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
</div>
<%--<ul class="layui-nav left fast-add" lay-filter="">
<li class="layui-nav-item">
<a href="javascript:;">+新增</a>
<dl class="layui-nav-child">
<!-- 二级菜单 -->
<dd>
<a onclick="xadmin.open('最大化','http://www.baidu.com','','',true)">
<i class="iconfont">&#xe6a2;</i>弹出最大化</a></dd>
<dd>
<a onclick="xadmin.open('弹出自动宽高','http://www.baidu.com')">
<i class="iconfont">&#xe6a8;</i>弹出自动宽高</a></dd>
<dd>
<a onclick="xadmin.open('弹出指定宽高','http://www.baidu.com',500,300)">
<i class="iconfont">&#xe6a8;</i>弹出指定宽高</a></dd>
<dd>
<a onclick="xadmin.add_tab('在tab打开','member-list.html')">
<i class="iconfont">&#xe6b8;</i>在tab打开</a></dd>
<dd>
<a onclick="xadmin.add_tab('在tab打开刷新','member-del.html',true)">
<i class="iconfont">&#xe6b8;</i>在tab打开刷新</a></dd>
</dl>
</li>
</ul>--%>
<ul class="layui-nav right" lay-filter="">
<li class="layui-nav-item">
<a href="javascript:;">${sessionScope.adminInfo.name}</a>
<dl class="layui-nav-child">
<!-- 二级菜单 -->
<dd>
<a onclick="xadmin.open('个人信息','http://www.baidu.com')">个人信息</a></dd>
<a onclick="xadmin.add_tab('个人信息','http://www.baidu.com')">个人信息</a></dd>
<dd>
<a href="${pageContext.request.contextPath}/loginOut">切换帐号</a></dd>
<dd>
@ -79,14 +56,8 @@
<a href="javascript:;">
<i class="iconfont left-nav-li" lay-tips="学生管理">&#xe6b8;</i>
<cite>学生管理</cite>
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('统计页面','welcome1.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>统计页面</cite></a>
</li>
</ul>
<i class="iconfont nav_right">&#xe697;</i>
</a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('学生信息','welcome1.html')">
@ -170,16 +141,6 @@
<cite>系统统计</cite>
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('拆线图','echarts1.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>拆线图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('拆线图','echarts2.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>拆线图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('地图','echarts3.html')">
<i class="iconfont">&#xe6a7;</i>
@ -190,26 +151,6 @@
<i class="iconfont">&#xe6a7;</i>
<cite>饼图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('雷达图','echarts5.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>雷达图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('k线图','echarts6.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>k线图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('热力图','echarts7.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>热力图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('仪表图','echarts8.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>仪表图</cite></a>
</li>
</ul>
</li>
</ul>

@ -53,10 +53,10 @@
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<!--<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
</error-page>-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>

File diff suppressed because one or more lines are too long

@ -0,0 +1,53 @@
function highlight(s,id) {
if(s.length == 0) {
var obj = document.getElementById(id);
var t = obj.innerHTML.replace(/<span\s+class=.?highlight.?>([^<>]*)<\/span>/gi, "$1");
obj.innerHTML = t;
return false;
}
s = encode(s);
var obj = document.getElementById(id);
var t = obj.innerHTML.replace(/<span\s+class=.?highlight.?>([^<>]*)<\/span>/gi, "$1");
obj.innerHTML = t;
var cnt = loopSearch(s, obj);
t = obj.innerHTML
var r = /{searchHL}(({(?!\/searchHL})|[^{])*){\/searchHL}/g
t = t.replace(r, "<span class='highlight'>$1</span>");
obj.innerHTML = t;
function encode(s) {
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/([\\\.\*\[\]\(\)\$\^])/g, "\\$1");
}
function decode(s) {
return s.replace(/\\([\\\.\*\[\]\(\)\$\^])/g, "$1").replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&");
}
function loopSearch(s, obj) {
var cnt = 0;
if(obj.nodeType == 3) {
cnt = replace(s, obj);
return cnt;
}
for(var i = 0, c; c = obj.childNodes[i]; i++) {
if(!c.className || c.className != "highlight") {
cnt += loopSearch(s, c);
}
}
return cnt;
}
function replace(s, dest) {
var r = new RegExp(s, "g");
var tm = null;
var t = dest.nodeValue;
var cnt = 0;
if(tm = t.match(r)) {
cnt = tm.length;
t = t.replace(r, "{searchHL}" + decode(s) + "{/searchHL}")
dest.nodeValue = t;
}
return cnt;
}
}

@ -18,6 +18,12 @@
<context:component-scan base-package="cn.ppdxzz">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<!--配置视图解析器-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
@ -32,7 +38,6 @@
<mvc:resources location="/layui_exts/" mapping="/layui_exts/**" />
<mvc:resources location="/layer/" mapping="/layer/**" />
<!--开启SpringMVC的注解支持-->
<mvc:annotation-driven />
<!--
支持AOP的注解支持AOP底层使用代理技术
JDK动态代理要求必须有接口

@ -18,6 +18,12 @@
<context:component-scan base-package="cn.ppdxzz">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<!--配置视图解析器-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
@ -32,7 +38,6 @@
<mvc:resources location="/layui_exts/" mapping="/layui_exts/**" />
<mvc:resources location="/layer/" mapping="/layer/**" />
<!--开启SpringMVC的注解支持-->
<mvc:annotation-driven />
<!--
支持AOP的注解支持AOP底层使用代理技术
JDK动态代理要求必须有接口

@ -25,12 +25,6 @@
<input type="text" readonly value="${ad.username}" class="form-control" name="username" id="username">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label form-label">密码:</label>
<div class="col-sm-8">
<input type="text" value="${ad.password}" class="form-control" name="password" id="password">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label form-label">姓名:</label>
<div class="col-sm-8">
@ -43,7 +37,7 @@
<input type="text" value="${ad.phone}" class="form-control" name="phone" id="phone">
</div>
</div>
<div class="form-group">
<%--<div class="form-group">
<label class="col-sm-2 control-label form-label">权限:</label>
<div class="col-sm-8">
<c:if test="${ad.power == 0}">
@ -69,7 +63,7 @@
</select>
</c:if>
</div>
</div>
</div>--%>
<div class="form-group">
<label class="col-sm-2 control-label form-label">描述:</label>
<div class="col-sm-8">
@ -96,7 +90,6 @@
name:"notEmpty",
description:"notEmpty",
phone:"mobile",
password:"notEmpty"
},
/*submitFun里面为检验成功后要执行的方法*/
submitFun:function(){
@ -108,10 +101,8 @@
//增加管理员,异步提交管理员表单
var id = $("#id").val().trim();
var username = $("#username").val().trim();
var password = $("#password").val().trim();
var name = $("#name").val().trim();
var phone = $("#phone").val().trim();
var power = $("#power").val().trim();
var description = $("#description").val().trim();
$.ajax({
url: "${pageContext.request.contextPath}/editAdmin",//要请求的服务器url
@ -120,10 +111,8 @@
data: {
id:$("#id").val().trim(),
username:$("#username").val().trim(),
password:$("#password").val().trim(),
name: $("#name").val().trim(),
phone: $("#phone").val().trim(),
power: $("#power").val().trim(),
description: $("#description").val().trim(),
},
type: "POST", //请求方式为POST

@ -17,9 +17,11 @@
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/xadmin.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
<%--<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>--%>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/xadmin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
<script type="text/javascript" charset="UTF-8" src="${pageContext.request.contextPath}/layui_exts/excel.js"></script>
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
@ -32,20 +34,23 @@
location.href = "${pageContext.request.contextPath}/findAllAdmin?page=1&size="+ pageSize;
}
$("#serarch_btn").click(function () {
var username = $("#username").val();
var password = $("#password").val();
location.href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4&username="+username;
var keyword = $("#keyword").val();
location.href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4&keyword="+keyword;
});
$("#refresh").click(function () {
$("#myform").reset();
location.href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4";
});
</script>
</head>
<body>
<%--<div class="x-nav">
&lt;%&ndash;<span class="layui-breadcrumb">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素</cite></a>
</span>&ndash;%&gt;
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>--%>
@ -54,19 +59,16 @@
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body ">
<form class="layui-form layui-col-space5">
<div class="layui-inline layui-show-xs-block">
<input class="layui-input" type="text" autocomplete="on" placeholder="用户名" name="username" id="username" value="${param.username}">
</div>
<div class="layui-inline layui-show-xs-block">
<input class="layui-input" type="text" autocomplete="off" placeholder="姓名" name="name" id="name">
</div>
<form id="myform" class="layui-form layui-col-space5">
<div class="layui-inline layui-show-xs-block">
<input type="text" name="description" id="description" placeholder="描述" autocomplete="off" class="layui-input">
<input class="layui-input" type="text" autocomplete="off" placeholder="请输入关键字" name="keyword" id="keyword" value="${param.keyword}">
</div>
<div class="layui-inline layui-show-xs-block">
<button class="layui-btn" id="serarch_btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
</div>
<div class="layui-inline layui-show-xs-block x-right">
<a class="layui-btn layui-btn-normal" href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=4"><i class="layui-icon">&#xe669;</i></a>
</div>
</form>
</div>
<xblock>
@ -78,6 +80,7 @@
<table class="layui-table layui-form">
<thead>
<tr style="text-align: center">
<th style="text-align: center">ID</th>
<th style="text-align: center">用户名</th>
<th style="text-align: center">姓名</th>
<th style="text-align: center">联系方式</th>
@ -86,8 +89,12 @@
<th style="text-align: center">操作</th>
</thead>
<tbody>
<%
int j = 1;
%>
<c:forEach items="${pageInfo.list}" var="admin">
<tr style="text-align: center">
<tr id="light" style="text-align: center">
<td><%=j++%></td>
<td>${admin.username}</td>
<td>${admin.name}</td>
<td>${admin.phone}</td>
@ -97,22 +104,24 @@
<a title="编辑" href="${pageContext.request.contextPath}/adminEdit?id=${admin.id}">
<i class="layui-icon">&#xe642;</i>
</a>
<a onclick="member_stop(this,'10001')" href="javascript:;" title="授权">
<a title="授权" onclick="put_power(this,${admin.id},${sessionScope.adminInfo.power})" href="javascript:;">
<i class="layui-icon">&#xe672;</i>
</a>
<a title="删除" onclick="member_del(this,${admin.id},${sessionScope.adminInfo.power})" href="javascript:;">
<a title="删除" onclick="member_del(this,${admin.id},${sessionScope.adminInfo.power},${admin.power})" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</td>
</c:forEach>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div class="pull-left">
<div class="form-group form-inline">
当前页:${pageInfo.pageNum}&nbsp;/&nbsp;${pageInfo.pages}&emsp; 每页
共&nbsp;${pageInfo.pages}&nbsp;页&emsp;当前页:${pageInfo.pageNum}&nbsp;/&nbsp;${pageInfo.pages}&emsp; 每页
<select class="form-control" id="changePageSize" onchange="changePageSize()">
<option value="1">${pageInfo.size}</option>
<option value="2">2</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="10">10</option>
@ -121,47 +130,142 @@
</select> 条
</div>
</div>
<div class="box-tools pull-right">
<ul class="pagination">
<li>
<a href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=${pageInfo.pageSize}&username=${param.username}" aria-label="Previous">首页</a>
</li>
<c:if test="${pageInfo.pageNum > 1}">
<li><a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}&username=${param.username}">上一页</a></li>
</c:if>
<c:forEach begin="1" end="${pageInfo.pages}" var="pageNum">
<li><a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageNum}&size=${pageInfo.pageSize}&username=${param.username}">${pageNum}</a></li>
</c:forEach>
<c:if test="${pageInfo.pageNum < pageInfo.pages}">
<li><a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&username=${param.username}">下一页</a></li>
</c:if>
<li>
<a href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pages}&size=${pageInfo.pageSize}&username=${param.username}" aria-label="Next">尾页</a>
</li>
</ul>
<c:choose>
<c:when test="${pageInfo.pages < 5}">
<c:set var="begin" value="1">
</c:set>
<c:set var="end" value="${pageInfo.pages}">
</c:set>
</c:when>
<c:when test="${pageInfo.pageNum <= 3}">
<c:set var="begin" value="1">
</c:set>
<c:set var="end" value="5">
</c:set>
</c:when>
<c:when test="${pageInfo.pageNum > 3 and pageInfo.pageNum <= pageInfo.pages-2}">
<c:set var="begin" value="${pageInfo.pageNum - 2}">
</c:set>
<c:set var="end" value="${pageInfo.pageNum + 2}">
</c:set>
</c:when>
<c:otherwise>
<c:set var="begin" value="${pageInfo.pages - 4}">
</c:set>
<c:set var="end" value="${pageInfo.pages}">
</c:set>
</c:otherwise>
</c:choose>
<div class="layui-card-body x-right" style="height: min-content">
<div class="page">
<div>
<a class="next" href="${pageContext.request.contextPath}/findAllAdmin?page=1&size=${pageInfo.pageSize}&keyword=${param.keyword}">首页</a>
<c:if test="${pageInfo.pageNum > 1}">
<a class="prev" href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum-1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">上一页</a>
</c:if>
<c:forEach var="i" begin="${begin}" end="${end}" step="1">
<c:if test="${pageInfo.pageNum == i}">
<span class="current">${i}</span>
</c:if>
<c:if test="${pageInfo.pageNum != i}">
<a class="num" href="${pageContext.request.contextPath}/findAllAdmin?page=${i}&size=${pageInfo.pageSize}&keyword=${param.keyword}">${i}</a>
</c:if>
</c:forEach>
<c:if test="${pageInfo.pageNum < pageInfo.pages}">
<a class="next" href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pageNum+1}&size=${pageInfo.pageSize}&keyword=${param.keyword}">下一页</a>
</c:if>
<a class="next" href="${pageContext.request.contextPath}/findAllAdmin?page=${pageInfo.pages}&size=${pageInfo.pageSize}&keyword=${param.keyword}">尾页</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
/*function edit_admin(obj,id) {
//layer.msg('编辑'+id);
var index = layer.open({
type: 2 //Page层类型
,area: ['900px', '480px']
,title: '修改信息'
,shade: 0.6 //遮罩透明度
,maxmin: true //允许全屏最小化
,anim: 2 //0-6的动画形式-1不开启
,content: 'http://localhost:8080/hellossm/adminEdit?id='+id
layui.config({
base: 'layui_exts/',
}).extend({
excel: 'excel',
});
layui.use(['jquery', 'excel', 'form','layer','laydate'], function(){
var form = layui.form,
$ = layui.jquery,
laydate = layui.laydate;
var excel = parent.layui.excel;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
layer.full(index);
}*/
/*用户-删除*/
function member_del(obj,id,power){
form.render();
form.on('submit(toolbarDemo)', function(){
$.ajax({
url: '${pageContext.request.contextPath}/exportAdminInfo',
type: 'post',
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (data) {
// 假如返回的 data 是需要导出的列表数据
console.log(data);
// 1. 如果需要调整顺序,请执行梳理函数
var dt = excel.filterExportData(data, [
'id'
,'username'
,'password'
,'name'
,'phone'
,'power'
,'description'
]);
// 2. 数组头部新增表头
dt.unshift({id: 'ID', username: '用户名', password: '密码', name: '姓名', phone: '手机号', power: '权限', description: '权限描述'});
// 3.自定义导出Excel各字段的宽度
var colConf = excel.makeColConfig({
'A': 40,
'B': 50,
'C': 120,
'D': 80,
'F': 120
}, 60);
var time_start = Date.now();
// 3. 执行导出函数,系统会弹出弹框
excel.exportExcel({
sheet1: dt
}, '管理员导出数据.xlsx', 'xlsx', {
extend: {
'!cols': colConf
}
});
var time_end = Date.now();
var spent_time = (time_end - time_start) / 1000;
layer.msg('导出数据共耗时'+spent_time+'s');
//setTimeout(function () {window.location.href='/findAdmin';},2000);
},
error: function () {
//console.log(data);
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/findAllAdmin';},2000);
}
});
});
});
</script>
<script>
function member_del(obj,id,power,del_power){
layer.confirm('确认要删除吗?',function(index){
if (power == 0){
if (power == 0 || power < del_power){
layer.msg('对不起,您没有权限!');
return false;
}
@ -178,6 +282,46 @@
});
});
}
function put_power(obj,id,power) {
//验证是否拥有权限
if (power == 0) {
layer.msg('对不起,您没有权限!');
return false;
}
//prompt层
layer.prompt({title: '输入授权密码,完成身份校验', formType: 1}, function(password, index){
if (password != 123) {
layer.msg('授权密码有误,身份验证失败');
layer.close(index);
return false;
}
layer.close(index);
layer.prompt({title: '输入权限级别,并确认授权', formType: 1}, function(level, index){
if (level < 0 || level > 3) {
layer.msg('授权等级输入有误,请重新输入!')
return false;
}
if (level > power) {
layer.msg('对不起,您权限不足!')
layer.close(index);
return false;
}
$.get("${pageContext.request.contextPath}/put_power",{"id":id,"power":level},function (data) {
if(data){
layer.msg('授权成功!');
layer.close(index);
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/findAllAdmin';},2000);
}else {
layer.msg('授权失败,请联系管理员!');
layer.close(index);
}
});
layer.close(index);
});
});
}
</script>
</body>
</html>

@ -64,11 +64,6 @@
<div class="sk-rotating-plane"></div>
</div>
</form>
<%--<c:if test="${msg != null}">
<script>
layer.msg("${msg}");
</script>
</c:if>--%>
<script src="${pageContext.request.contextPath}/js/particles.min.js"></script>
<script src="${pageContext.request.contextPath}/js/app.js"></script>
<script type="text/javascript">

@ -29,36 +29,13 @@
<div class="left_open">
<a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
</div>
<%--<ul class="layui-nav left fast-add" lay-filter="">
<li class="layui-nav-item">
<a href="javascript:;">+新增</a>
<dl class="layui-nav-child">
<!-- 二级菜单 -->
<dd>
<a onclick="xadmin.open('最大化','http://www.baidu.com','','',true)">
<i class="iconfont">&#xe6a2;</i>弹出最大化</a></dd>
<dd>
<a onclick="xadmin.open('弹出自动宽高','http://www.baidu.com')">
<i class="iconfont">&#xe6a8;</i>弹出自动宽高</a></dd>
<dd>
<a onclick="xadmin.open('弹出指定宽高','http://www.baidu.com',500,300)">
<i class="iconfont">&#xe6a8;</i>弹出指定宽高</a></dd>
<dd>
<a onclick="xadmin.add_tab('在tab打开','member-list.html')">
<i class="iconfont">&#xe6b8;</i>在tab打开</a></dd>
<dd>
<a onclick="xadmin.add_tab('在tab打开刷新','member-del.html',true)">
<i class="iconfont">&#xe6b8;</i>在tab打开刷新</a></dd>
</dl>
</li>
</ul>--%>
<ul class="layui-nav right" lay-filter="">
<li class="layui-nav-item">
<a href="javascript:;">${sessionScope.adminInfo.name}</a>
<dl class="layui-nav-child">
<!-- 二级菜单 -->
<dd>
<a onclick="xadmin.open('个人信息','http://www.baidu.com')">个人信息</a></dd>
<a onclick="xadmin.add_tab('个人信息','http://www.baidu.com')">个人信息</a></dd>
<dd>
<a href="${pageContext.request.contextPath}/loginOut">切换帐号</a></dd>
<dd>
@ -79,14 +56,8 @@
<a href="javascript:;">
<i class="iconfont left-nav-li" lay-tips="学生管理">&#xe6b8;</i>
<cite>学生管理</cite>
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('统计页面','welcome1.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>统计页面</cite></a>
</li>
</ul>
<i class="iconfont nav_right">&#xe697;</i>
</a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('学生信息','welcome1.html')">
@ -170,16 +141,6 @@
<cite>系统统计</cite>
<i class="iconfont nav_right">&#xe697;</i></a>
<ul class="sub-menu">
<li>
<a onclick="xadmin.add_tab('拆线图','echarts1.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>拆线图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('拆线图','echarts2.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>拆线图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('地图','echarts3.html')">
<i class="iconfont">&#xe6a7;</i>
@ -190,26 +151,6 @@
<i class="iconfont">&#xe6a7;</i>
<cite>饼图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('雷达图','echarts5.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>雷达图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('k线图','echarts6.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>k线图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('热力图','echarts7.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>热力图</cite></a>
</li>
<li>
<a onclick="xadmin.add_tab('仪表图','echarts8.html')">
<i class="iconfont">&#xe6a7;</i>
<cite>仪表图</cite></a>
</li>
</ul>
</li>
</ul>

@ -53,10 +53,10 @@
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<!--<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
</error-page>-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>

File diff suppressed because one or more lines are too long

@ -0,0 +1,53 @@
function highlight(s,id) {
if(s.length == 0) {
var obj = document.getElementById(id);
var t = obj.innerHTML.replace(/<span\s+class=.?highlight.?>([^<>]*)<\/span>/gi, "$1");
obj.innerHTML = t;
return false;
}
s = encode(s);
var obj = document.getElementById(id);
var t = obj.innerHTML.replace(/<span\s+class=.?highlight.?>([^<>]*)<\/span>/gi, "$1");
obj.innerHTML = t;
var cnt = loopSearch(s, obj);
t = obj.innerHTML
var r = /{searchHL}(({(?!\/searchHL})|[^{])*){\/searchHL}/g
t = t.replace(r, "<span class='highlight'>$1</span>");
obj.innerHTML = t;
function encode(s) {
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/([\\\.\*\[\]\(\)\$\^])/g, "\\$1");
}
function decode(s) {
return s.replace(/\\([\\\.\*\[\]\(\)\$\^])/g, "$1").replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&");
}
function loopSearch(s, obj) {
var cnt = 0;
if(obj.nodeType == 3) {
cnt = replace(s, obj);
return cnt;
}
for(var i = 0, c; c = obj.childNodes[i]; i++) {
if(!c.className || c.className != "highlight") {
cnt += loopSearch(s, c);
}
}
return cnt;
}
function replace(s, dest) {
var r = new RegExp(s, "g");
var tm = null;
var t = dest.nodeValue;
var cnt = 0;
if(tm = t.match(r)) {
cnt = tm.length;
t = t.replace(r, "{searchHL}" + decode(s) + "{/searchHL}")
dest.nodeValue = t;
}
return cnt;
}
}

@ -1,9 +1,10 @@
### 宿管系统SSM框架日进度
### 宿管系统SSM框架日进度总结
1. 2020.2.11首次接触并搭建了SSM框架环境完成持久层基本CRUD的功能测试并提供了管理员的登录校验功能以及登录页面用户名是否存在的功能。
2. 2020.2.12实现查询所有管理员信息并显示到页面添加基本的分页期间存在的一些问题是一开始不了解SpringMVC视图解析器的映射规则导致出现页面无法跳转的问题目前我SSM框架技术知识面了解有限暂时把页面跳转放在controller中后续技术更新后再另行解决。
3. 2020.2.13用bootstrap框架完成了管理员添加和修改的页面实现并加入jQuery校验字段是否为空最终实现了管理员添加以及修改功能。
4. 2020.2.14把原来的登录页面更换成动态特效的登录页面并使用ajax完成登录的后台校验管理员查询功能完成了模糊查询但是模糊查询带上分页技术后页面跳转出现问题点击分页按钮后又重新查询了全部数据的分页查看了相关资料进行改进目前并未完全实现。
5. 2020.2.15实现了管理员信息模糊查询并分页的效果并增加了超级管理员可给普通管理员授权的功能着手实现数据导出功能发现程序运行时报错经验证后发现是json格式从后台传向前台需要经过解析故导入了相关依赖即可而后又遇到layui的Excel模块不可用开始着手解决。

Loading…
Cancel
Save