首页 > 编程知识 正文

网上商城源代码在数据库完整版,淘客系统源码下载

时间:2023-05-05 02:55:11 阅读:55274 作者:4291

ssm商城系统(爱淘淘购物)项目演示

本系统采用SSM架构来搭建。

服务器:tomcat7

java虚拟机:jdk1.7

数据库:mysql

前端:Vue + Bootstrap

管理员用户:root  root

普通用户:jack 123

访问路径:

http://localhost:8080/app/index.jsp

http://localhost:8080/app/login.jsp

注意点:商品名字不要太长,价格不要用小数,用整数。

可用于毕业设计,课程设计,应急用。基本的商品增删改查,上传商品等逻辑都是有的,具体可以看演示视频~~

源码下载:

链接:https://pan.baidu.com/s/1GV7TR4sphunYVEMMp-TU0Q

提取码:1234

UserController.java

package com.tz.web.admin;import java.util.List;import java.util.Map;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import com.tz.bean.TblSysUser;import com.tz.bean.TblSysUserExample;import com.tz.core.CommonVo;import com.tz.core.ProcessException;import com.tz.dao.TblSysMenuMapper;import com.tz.dao.TblSysUserMapper;import com.tz.util.ResponseUtil;import com.tz.util.TmStringUtils;import net.sf.json.JSONObject;@Controllerpublic class UserController extends BaseController{@AutowiredTblSysUserMapper tblSysUserMapper;@AutowiredTblSysMenuMapper tblSysMenuMapper;@RequestMapping("/getTblSysUserById")@ResponseBodypublic JSONObject getTblSysUserById(Integer id,HttpServletRequest request){com.tz.bean.TblSysUser selectByPrimaryKey = tblSysUserMapper.selectByPrimaryKey(id);vo.setData(selectByPrimaryKey);return JSONObject.fromObject(vo);}@RequestMapping("/deleteUser")@ResponseBodypublic JSONObject deleteUser(Integer id,HttpServletRequest request) throws Exception{try{tblSysUserMapper.deleteByPrimaryKey(id);}catch(Exception e){throw new ProcessException("系统故障,请联系管理员!");}return JSONObject.fromObject(vo) ;}@RequestMapping("/getUserList")@ResponseBodypublic JSONObject getUserList(String userName,HttpServletRequest request) throws Exception{TblSysUserExample tblSysUserExample = new TblSysUserExample();tblSysUserExample.createCriteria().andUserNameLike("%"+userName+"%");tblSysUserExample.setOrderByClause("create_time desc");List list = tblSysUserMapper.selectByExample(tblSysUserExample);vo.setList(list);return JSONObject.fromObject(vo) ;}@RequestMapping("/register")@ResponseBodypublic TblSysUser TblSysUser(TblSysUser user) throws Exception{//检查用户名是否重复TblSysUser tblSysUserByUserName = commonService.getTblSysUserByUserName(user.getUserName());if(tblSysUserByUserName != null){throw new ProcessException("用户名重复");}user.setRoleId(1); //默认角色1,测试用System.out.println(TmStringUtils.getNow());user.setCreateTime(TmStringUtils.getNow());int i = tblSysUserMapper.insert(user);return null;}@RequestMapping("/userAdd")@ResponseBodypublic CommonVo userAdd(TblSysUser user) throws Exception{//检查用户名是否重复TblSysUser tblSysUserByUserName = commonService.getTblSysUserByUserName(user.getUserName());if(tblSysUserByUserName != null){throw new ProcessException("用户名重复");}user.setRoleId(1); //默认角色1,测试用user.setCreateTime(TmStringUtils.getNow());int i = tblSysUserMapper.insert(user);return vo;}@RequestMapping("/userEdit")@ResponseBodypublic CommonVo userEdit(TblSysUser user) throws Exception{tblSysUserMapper.updateByPrimaryKeySelective(user);return vo;}@RequestMapping("/login")@ResponseBodypublic TblSysUser login(TblSysUser user,HttpServletRequest request,HttpServletResponse response) throws Exception{TblSysUser tblSysUserByUserName = commonService.getTblSysUserByUserName(user.getUserName());if(tblSysUserByUserName == null){throw new ProcessException("用户名不存在");}TblSysUser tblSysUser = commonService.getTblSysUserByUserNamePassword(user);if(tblSysUser == null){throw new ProcessException("用户名或者密码错误");}request.getSession().setAttribute("loginUser", tblSysUser);if(tblSysUser.getRoleId() == 1){vo.setData(tblSysUser);ResponseUtil.write(JSONObject.fromObject(vo), response);return null;}//查询该用户所拥有的所有菜单List> menus = tblSysUserMapper.getMenus(tblSysUser.getId());String MENUS = (String) menus.get(0).get("MENUS");List> menusList = tblSysUserMapper.getMenusList(MENUS);request.getSession().setAttribute("menusList", menusList);vo.setData(tblSysUser);ResponseUtil.write(JSONObject.fromObject(vo), response);return null;}@RequestMapping("/getAuth")@ResponseBodypublic JSONObject getAuth(HttpServletRequest request) throws Exception{List menusList = (List) request.getSession().getAttribute("menusList");if(menusList == null){throw new ProcessException("用户尚未登录!");}//获取当前的用户角色TblSysUser tblSysUser = (com.tz.bean.TblSysUser) request.getSession().getAttribute("loginUser");vo.setData(tblSysUser.getRoleId());vo.setList(menusList);return JSONObject.fromObject(vo) ;}}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。