首页 > 分享 > SSM框架开发超市订单管理系统包含MySQL数据库资源

SSM框架开发超市订单管理系统包含MySQL数据库资源

package com.dzl.smbms.controller; import java.io.File; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.math.RandomUtils; import org.apache.log4j.Logger; 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.multipart.MultipartFile; import com.dzl.smbms.pojo.User; import com.dzl.smbms.service.RoleService; import com.dzl.smbms.service.UserService; import com.dzl.smbms.tools.Constants; import com.dzl.smbms.tools.PageSupport; import com.mysql.jdbc.StringUtils; import com.alibaba.fastjson.JSONArray; import com.dzl.smbms.pojo.Role; @Controller @RequestMapping("/user") public class UserController {private Logger logger = Logger.getLogger(UserController.class);@Resourceprivate UserService userService;@Resourceprivate RoleService roleService;// 登录成功 -----首页@RequestMapping(value = "/main.html")public String main(HttpSession session) {if (session.getAttribute(Constants.USER_SESSION) == null) {return "redirect:/login.html";// 跳转到登录页面}return "jsp/frame"; // 登录成功:跳转到首页}// 退出登录@RequestMapping(value = "/logout.html")public String logout(HttpSession session) {// 清除sessionsession.removeAttribute(Constants.USER_SESSION);return "login";}// 用户条件查询 --------分页@RequestMapping(value = "/userlist.html")public String getUserlist(Model model,@RequestParam(value = "queryUserName", required = false) String queryUserName,@RequestParam(value = "queryUserRole", required = false) String queryUserRole,@RequestParam(value = "pageIndex", required = false) String pageIndex) {int _queryUserRole = 0;List<User> userList = null;// 设置页面容量int pageSize = Constants.pageSize;// 当前页码int currentPageNo = 1;if (queryUserName == null) {queryUserName = "";}if (queryUserRole != null && !queryUserRole.equals("")) {_queryUserRole = Integer.parseInt(queryUserRole);}if (pageIndex != null) {try {currentPageNo = Integer.valueOf(pageIndex);} catch (NumberFormatException e) {return "redirect:/user/syserror.html";}}// 总数量(表)int totalCount = userService.getUserCount(queryUserName, _queryUserRole);// 总页数PageSupport pages = new PageSupport();pages.setCurrentPageNo(currentPageNo);pages.setPageSize(pageSize);pages.setTotalCount(totalCount);int totalPageCount = pages.getTotalPageCount();// 控制首页和尾页if (currentPageNo < 1) {currentPageNo = 1;} else if (currentPageNo > totalPageCount) {currentPageNo = totalPageCount;}userList = userService.getUserList(queryUserName, _queryUserRole, currentPageNo, pageSize);model.addAttribute("userList", userList);List<Role> roleList = null;roleList = roleService.selectRoleList();model.addAttribute("roleList", roleList);model.addAttribute("queryUserName", queryUserName);model.addAttribute("queryUserRole", queryUserRole);model.addAttribute("totalPageCount", totalPageCount);model.addAttribute("totalCount", totalCount);model.addAttribute("currentPageNo", currentPageNo);return "jsp/userlist";}@RequestMapping(value = "/syserror.html")public String sysError() {return "syserror";}// 跳到修改密码页面@RequestMapping(value = "/pwdmodify.html")public String pwdmodify() {return "jsp/pwdmodify";}// 查询原始密码是否正确@ResponseBody@RequestMapping(value = "/pwd.html", method = RequestMethod.GET)public String pwd(@RequestParam String oldpassword, HttpSession session) {Map<String, String> map = new HashMap<String, String>();User user = (User) session.getAttribute(Constants.USER_SESSION);if (user.getUserPassword().equals(oldpassword)) {map.put("result", "true");} else if (!oldpassword.equals(user.getUserPassword())) {map.put("result", "false");} else if (user.getUserPassword().equals("") && user.getUserPassword() == null) {map.put("result", "sessionerror");} else {map.put("result", "error");}return JSONArray.toJSONString(map);}// 修改密码@RequestMapping(value = "/updatepwd.html", method = RequestMethod.POST)public String updatepwd(@RequestParam String method, @RequestParam String newpassword) {userService.updatePwd(Integer.valueOf(method), newpassword);return "redirect:/user/login.html";}// 根据用户id删除用户信息@ResponseBody@RequestMapping(value = "/deluser.html", method = RequestMethod.GET)public String deluser(@RequestParam String uid) {Map<String, String> resultMap = new HashMap<String, String>();if (StringUtils.isNullOrEmpty(uid)) {resultMap.put("delResult", "notexist");} else {if (userService.deleteByPrimaryKey(Integer.parseInt(uid)) > 0) {resultMap.put("delResult", "true");}else {resultMap.put("delResult", "false");}}return JSONArray.toJSONString(resultMap);}// 根据用户id查询指定用户信息@RequestMapping(value = "/view", method = RequestMethod.GET)public String view(@RequestParam String uid, Model model) {User user = userService.selectByPrimaryKey(Integer.valueOf(uid));model.addAttribute("user", user);return "jsp/userview";}// 根据用户id查询指定用户信息 (显示usermodify.jsp)@RequestMapping(value = "/usermodify", method = RequestMethod.GET)public String usermodify(@RequestParam String uid, Model model) {User user = userService.selectByPrimaryKey(Integer.valueOf(uid));model.addAttribute("user", user);return "jsp/usermodify";}// 显示全部用户角色(返回JSON)@ResponseBody@RequestMapping(value = "/getrolelist.html", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")public String getrolelist() {List<Role> roleList = roleService.selectRoleList();return JSONArray.toJSONString(roleList);}// 修改用户信息@RequestMapping(value = "/usermodifysave.html", method = RequestMethod.POST)public String modifyUserSave(User user, HttpSession session) {logger.debug("modifyUserSave userid===================== " + user.getId());user.setModifyBy(((User) session.getAttribute(Constants.USER_SESSION)).getId());user.setModifyDate(new Date());if (userService.updateByPrimaryKeySelective(user) > 0) {return "redirect:/user/userlist.html";}return "jsp/usermodify";}// 跳转到添加用户页面@RequestMapping("/useradd.html")public String useradd() {return "jsp/useradd";}// 查询userCode是否存在@ResponseBody@RequestMapping(value = "/ucexist.html")public String ucexist(@RequestParam String userCode) {Map<String, Object> map = new HashMap<String, Object>();User user = userService.selectUserCodeExist(userCode);if (user != null) {map.put("userCode", "exist");}return JSONArray.toJSONString(map);}// 添加用户操作@RequestMapping(value="/addUser.html",method=RequestMethod.POST)public String addUser(User user, HttpSession session, HttpServletRequest request,@RequestParam(value = "attachs", required = false) MultipartFile[] attachs) {String idPicPath = null;String workPicPath = null;String errorInfo = null;boolean flag = true;String path = "F:/Work/SSM/SSM-MyS

相关知识

宠物商城+ssm框架+jsp页面+mysql数据库
SSM框架开发超市订单管理系统包含MySQL数据库资源
基于vue框架的宠物店管理系统的设计与实现4czn0(程序+源码+数据库+调试部署+开发环境)系统界面在最后面。
java计算机毕业设计ssm宠物店管理系统
基于SSM的宠物(流浪猫狗)领养管理系统
SSM爱心宠物中心管理系统uupju(程序+源码+数据库+调试部署+开发环境)
SSM宠物寄养管理系统41n70
java计算机毕业设计ssm宠物店管理系统element vue前后端分离
基于vue框架的宠物交流平台1n2n3(程序+源码+数据库+调试部署+开发环境)系统界面在最后面。
ssm宠物交流网站(程序+源码+数据库+调试部署+开发环境)

网址: SSM框架开发超市订单管理系统包含MySQL数据库资源 https://m.mcbbbk.com/newsview403776.html

所属分类:萌宠日常
上一篇: 智能手表成本分析
下一篇: 创新宠物摄影:保持独特竞争力的秘