• Java项目:音乐专辑商城系统(java+SSM+JSP+jQuery+Mysql)


    源码获取:俺的博客首页 "资源" 里下载!

    项目介绍


    本项目分为前后台,前台普通用户登录,后台管理员登录;

    管理员角色包含以下功能:
    管理员登录,修改个人信息,人员管理,图片管理,订单管理,图表管理,专辑管理等功能。

    用户角色包含以下功能:
    按分类查看歌曲,用户登录,查看商品详情,加入购物车,提交订单,修改个人信息,查看订单等功能。

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
    2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
    3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
    4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
    5.数据库:MySql 5.7版本;
    6.是否Maven项目:是;


    技术栈

    1. 后端:Spring+SpringMVC+Mybatis
    2. 前端:JSP+CSS+JavaScript+jQuery


    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
    4. 运行项目,前台地址:http://localhost:8080/snack/shop/index 
    后台地址:http://localhost:8080/snack/admin/login/adminLogin
     

     

     

     

     

     

    后台用户管理控制层: 

    1. @Controller
    2. @RequestMapping("/admin/user/")
    3. public class AdminUserControll {
    4. @Autowired
    5. private adminUserService adminUserService;
    6. @RequestMapping("mainToUserinfo")
    7. public String mainToUserinfo(){
    8. return "admin/user/adminUserinfo";
    9. }
    10. //加载用户
    11. @RequestMapping("adminUserinfoLimit")
    12. @ResponseBody
    13. public DataTables adminUserinfoLimit(HttpServletRequest request,int start,int length,Userinfo userinfo){
    14. Map<Object,Object> map=new HashMap<Object, Object>();
    15. map.put("pageStart",start);
    16. map.put("pageSize",length);
    17. PageHelp<Userinfo> pageHelp= adminUserService.selectAdminUserinfoLimit(map,userinfo);
    18. DataTables datatable=new DataTables();
    19. datatable.setData(pageHelp.getList());
    20. datatable.setRecordsFiltered(pageHelp.getRecord());
    21. datatable.setRecordsTotal(pageHelp.getRecord());
    22. return datatable;
    23. }
    24. //删除用户
    25. @RequestMapping("delUserinfoById")
    26. @ResponseBody
    27. public String delUserinfoById(int uId){
    28. return ResponseUtil.successToClient(adminUserService.delUserinfoById(uId));
    29. }
    30. //更新加载用户
    31. @RequestMapping("updateGoUserinfoById")
    32. @ResponseBody
    33. public String updateGoUserinfoById(int uId){
    34. return ResponseUtil.successToClient(adminUserService.updateGoUserinfoById(uId));
    35. }
    36. //更新用户
    37. @RequestMapping("updateUserinfoById")
    38. @ResponseBody
    39. public String updateUserinfoById(Userinfo userinfo){
    40. return ResponseUtil.successToClient(adminUserService.updateUserinfoById(userinfo));
    41. }
    42. @RequestMapping("mainToAdmin")
    43. public String mainToAdmin(){
    44. return "admin/user/adminAdmin";
    45. }
    46. //加载用户
    47. @RequestMapping("adminAdminLimit")
    48. @ResponseBody
    49. public DataTables adminAdminLimit(HttpServletRequest request,int start,int length,DoAdmin doAdmin){
    50. Map<Object,Object> map=new HashMap<Object, Object>();
    51. map.put("pageStart",start);
    52. map.put("pageSize",length);
    53. PageHelp<Admin> pageHelp= adminUserService.selectAdminLimit(map,doAdmin);
    54. DataTables datatable=new DataTables();
    55. datatable.setData(pageHelp.getList());
    56. datatable.setRecordsFiltered(pageHelp.getRecord());
    57. datatable.setRecordsTotal(pageHelp.getRecord());
    58. return datatable;
    59. }
    60. //新建
    61. @RequestMapping("addNewAdmin")
    62. @ResponseBody
    63. public String addNewAdmin(Admin admin){
    64. return ResponseUtil.successToClient(adminUserService.addAdmin(admin));
    65. }
    66. //删除用户
    67. @RequestMapping("delAdminById")
    68. @ResponseBody
    69. public String delAdminById(Admin admin){
    70. return ResponseUtil.successToClient(adminUserService.delAdmin(admin));
    71. }
    72. //更新加载用户
    73. @RequestMapping("updateGoAdminById")
    74. @ResponseBody
    75. public String updateGoAdminById(HttpServletRequest request,Admin admin){
    76. return ResponseUtil.successToClient(adminUserService.selectAdminByOne(admin));
    77. }
    78. //更新用户
    79. @RequestMapping("updateAdminById")
    80. @ResponseBody
    81. public String updateAdminById(Admin admin){
    82. return ResponseUtil.successToClient(adminUserService.updateAdmin(admin));
    83. }
    84. }

    用户管理控制层:

    1. @Controller
    2. @RequestMapping("/user/")
    3. public class UserControll {
    4. @Autowired
    5. private userService userService;
    6. @Autowired
    7. private sorderService sorderService;
    8. @Autowired
    9. private adminOrderService adminOrderService;
    10. //跳转注册
    11. @RequestMapping("userRegisterGet")
    12. public String gotoRegister(){
    13. return "user/register";
    14. }
    15. //注册判断用户名存在
    16. @RequestMapping("selectUserOne")
    17. @ResponseBody
    18. public AjaxResult getUserOne(Userinfo userinfo){
    19. AjaxResult aj=new AjaxResult();
    20. Userinfo rs = userService.selectUserOne(userinfo);
    21. aj.setTag(rs);
    22. return aj;
    23. }
    24. //注册
    25. @RequestMapping("addUserRegister")
    26. @ResponseBody
    27. public AjaxResult addUserOne(Userinfo userinfo){
    28. AjaxResult aj=new AjaxResult();
    29. int rs = userService.addUserOne(userinfo);
    30. aj.setTag(rs);
    31. return aj;
    32. }
    33. //查登陆的用户
    34. @RequestMapping("readUserinfo")
    35. @ResponseBody
    36. public AjaxResult readUserinfo(Userinfo userinfo,HttpServletRequest request){
    37. AjaxResult aj=new AjaxResult();
    38. Userinfo usr= userService.selectUserinfoById(userinfo);
    39. if(usr!=null){
    40. aj.setTag(usr);
    41. }
    42. return aj;
    43. }
    44. //修改个人信息
    45. @RequestMapping("editUserinfo")
    46. @ResponseBody
    47. public int editUserinfo(Userinfo userinfo){
    48. int rs= userService.updateUserinfoById(userinfo);
    49. return rs;
    50. }
    51. //跳转注册
    52. @RequestMapping("userPersonalInfo")
    53. public String gotoPersonalInfo(){
    54. return "user/personalInfo";
    55. }
    56. //加载个人信息界面
    57. @RequestMapping("userInfo")
    58. public String gotoUserInfo(){
    59. return "user/userInfo";
    60. }
    61. //跳转个人积分页面
    62. @RequestMapping("userIntegral")
    63. public String userIntegral(){
    64. return "user/integral";
    65. }
    66. //跳转个人图片
    67. @RequestMapping("userGerenImg")
    68. public String userGerenImg(){
    69. return "user/gerenImg";
    70. }
    71. //加载个人积分
    72. @RequestMapping("userIntegralLimit")
    73. @ResponseBody
    74. public DataTables userIntegralLimit(HttpServletRequest request,int start,int length){
    75. Map<Object,Object> map=new HashMap<Object, Object>();
    76. map.put("uId",request.getSession().getAttribute("frontuserId"));
    77. map.put("pageStart",start);
    78. map.put("pageSize",length);
    79. PageHelp<Integral> pageHelp= userService.selectIntegralLimit(map);
    80. DataTables datatable=new DataTables();
    81. datatable.setData(pageHelp.getList());
    82. datatable.setRecordsFiltered(pageHelp.getRecord());
    83. datatable.setRecordsTotal(pageHelp.getRecord());
    84. return datatable;
    85. }
    86. //跳转个人账户页面
    87. @RequestMapping("userAccount")
    88. public String userAccount(){
    89. return "user/account";
    90. }
    91. //加载个人积分
    92. @RequestMapping("userAccountLimit")
    93. @ResponseBody
    94. public DataTables userAccountLimit(HttpServletRequest request,int start,int length){
    95. Map<Object,Object> map=new HashMap<Object, Object>();
    96. map.put("uId",request.getSession().getAttribute("frontuserId"));
    97. map.put("pageStart",start);
    98. map.put("pageSize",length);
    99. PageHelp<Account> pageHelp= userService.selectAccountLimit(map);
    100. DataTables datatable=new DataTables();
    101. datatable.setData(pageHelp.getList());
    102. datatable.setRecordsFiltered(pageHelp.getRecord());
    103. datatable.setRecordsTotal(pageHelp.getRecord());
    104. return datatable;
    105. }
    106. //获得金额
    107. @RequestMapping("getMoneyAcount")
    108. @ResponseBody
    109. public Object getMoneyAcount(HttpServletRequest request){
    110. return request.getSession().getAttribute("money");
    111. }
    112. //查看当前订单
    113. @RequestMapping("userOrderLimit")
    114. @ResponseBody
    115. public DataTables userOrderLimit(HttpServletRequest request,int start,int length){
    116. Map<Object,Object> map=new HashMap<Object, Object>();
    117. map.put("uId",request.getSession().getAttribute("frontuserId"));
    118. map.put("pageStart",start);
    119. map.put("pageSize",length);
    120. PageHelp<DoMyOrder> pageHelp= userService.selectOrderLimit(map);
    121. DataTables datatable=new DataTables();
    122. datatable.setData(pageHelp.getList());
    123. datatable.setRecordsFiltered(pageHelp.getRecord());
    124. datatable.setRecordsTotal(pageHelp.getRecord());
    125. return datatable;
    126. }
    127. //跳转订单页面
    128. @RequestMapping("userGoOrder")
    129. public String userGoOrder(HttpSession session){
    130. return "user/myOrder";
    131. }
    132. //跳转历史订单
    133. @RequestMapping("userGoSuccessOrder")
    134. public String userGoSuccessOrder(){
    135. return "user/myOrderSuccess";
    136. }
    137. //查看当前订单
    138. @RequestMapping("userSucOrderLimit")
    139. @ResponseBody
    140. public DataTables userSucOrderLimit(HttpServletRequest request,int start,int length){
    141. Map<Object,Object> map=new HashMap<Object, Object>();
    142. map.put("uId",request.getSession().getAttribute("frontuserId"));
    143. map.put("pageStart",start);
    144. map.put("pageSize",length);
    145. PageHelp<DoMyOrder> pageHelp= userService.selectMySuccessOrderLimit(map);
    146. DataTables datatable=new DataTables();
    147. datatable.setData(pageHelp.getList());
    148. datatable.setRecordsFiltered(pageHelp.getRecord());
    149. datatable.setRecordsTotal(pageHelp.getRecord());
    150. return datatable;
    151. }
    152. //请确认收货
    153. @RequestMapping("userOrderConfirm")
    154. @ResponseBody
    155. public String userOrderConfirm(HttpServletRequest request,int id,int typeNum){
    156. int eId;
    157. if(typeNum==0){
    158. eId = (int)request.getSession().getAttribute("adminId");
    159. }else{
    160. eId=0;
    161. }
    162. return ResponseUtil.successToClient(userService.upDateByorderConfirm(id,typeNum,eId));
    163. }
    164. //去付款
    165. @RequestMapping("userOrderPayMoney")
    166. @ResponseBody
    167. public String userOrderPayMoney(HttpServletRequest request,String oId){
    168. DoPayMoney dpm=new DoPayMoney();
    169. Userinfo selectUserinfoMoney = userService.selectUserinfoMoney((int)request.getSession().getAttribute("frontuserId"));
    170. Double selectOrderdetailPayMoney = sorderService.selectOrderdetailPayMoney(oId);
    171. dpm.setPayMoney(selectOrderdetailPayMoney.toString());
    172. dpm.setuMoney(selectUserinfoMoney.getuMoney());
    173. return ResponseUtil.successToClient(dpm);
    174. }
    175. //确认付款
    176. @RequestMapping("userOrderPayMoneyConfirm")
    177. @ResponseBody
    178. public String userOrderPayMoneyConfirm(HttpServletRequest request,Float payNumber,Float uMoney,String uPasword,String oId){
    179. Userinfo userinfo = (Userinfo)request.getSession().getAttribute("exituser");
    180. if(userinfo.getuPassword().equals(uPasword)){
    181. sorderService.updateOrderByoId(oId);
    182. userService.updateUserinfoBypay(userinfo.getuId(), uMoney-payNumber);
    183. }else{
    184. return ResponseUtil.errorToClient();
    185. }
    186. return ResponseUtil.successToClient();
    187. }
    188. //删除订单
    189. @RequestMapping("deleteMyOrder")
    190. @ResponseBody
    191. public String deleteAdminOrder(String oId){
    192. return ResponseUtil.successToClient(adminOrderService.deleteAdminOrder(oId));
    193. }
    194. //跳转管理员信息
    195. @RequestMapping("mainToAdminuser")
    196. public String mainToAdminuser(){
    197. return "admin/persionInfo/adminInfo";
    198. }
    199. //加载管理员信息
    200. @RequestMapping("mainSelectAdminuser")
    201. @ResponseBody
    202. public String mainSelectAdminuser(HttpServletRequest request){
    203. int adId =(int)request.getSession().getAttribute("adminId");
    204. return ResponseUtil.successToClient(userService.selectAdminInfo(adId));
    205. }
    206. //更新管理员信息
    207. @RequestMapping("mainUpdateAdminuser")
    208. @ResponseBody
    209. public String mainUpdateAdminuser(DoAdminInfo admin){
    210. return ResponseUtil.successToClient(userService.updateAdminInfo(admin));
    211. }
    212. }

    登录管理控制层:

    1. @Controller
    2. @RequestMapping("/admin/login/")
    3. public class AdminLogin {
    4. @Autowired
    5. private adminLoginService adminLoginService;
    6. @Autowired
    7. private AccountMapper accountMapper;
    8. @Autowired
    9. private typeService typeService;
    10. //登录login
    11. @RequestMapping("adminLogin")
    12. public String adminLogin(){
    13. System.out.println("存储过程相加:"+accountMapper.selectNum(4, 6));
    14. return "admin/adminLogin";
    15. }
    16. //登录
    17. @RequestMapping("adminGoLogin")
    18. public String adminGoLogin(HttpServletRequest request,Admin admin){
    19. List<Admin> adminSelect = adminLoginService.adminLogin(admin);
    20. if(adminSelect.size()==1){
    21. request.getSession().setAttribute("adminName", adminSelect.get(0).getAdUsername());
    22. request.getSession().setAttribute("adminId", adminSelect.get(0).getAdId());
    23. List<Permission> allPer = adminLoginService.selectAllPermission();
    24. List<Permission> userPer = adminLoginService.selectRolePermission(adminSelect.get(0).getRoleId());
    25. request.getSession().setAttribute("allPer", allPer);
    26. request.getSession().setAttribute("userPer", userPer);
    27. return "redirect:adminGoMain";
    28. }
    29. request.setAttribute("msg","用户名或密码错误");
    30. return "admin/adminLogin";
    31. }
    32. //登录Main
    33. @RequestMapping("adminGoMain")
    34. public String adminLogin(HttpServletRequest request){
    35. List<Type> typeList = typeService.getall();
    36. request.setAttribute("adminMenu",adminLoginService.selectAllAdminMenu());
    37. request.setAttribute("adminMenuChild",adminLoginService.selectAllAdminMenuChild());
    38. request.getSession().setAttribute("type",typeList);
    39. return "admin/adminMain";
    40. }
    41. //退出
    42. @RequestMapping("adminMainToLoginOut")
    43. @ResponseBody
    44. public String adminMainToLoginOut(HttpServletRequest request){
    45. request.getSession().removeAttribute("adminName");
    46. return ResponseUtil.successToClient();
    47. }
    48. }

    源码获取:俺的博客首页 "资源" 里下载!

  • 相关阅读:
    git中的分支运用(branch建立、 conflict处理)
    数据库 — 增删查改
    Go分布式缓存 使用 Protobuf 通信(day7)
    yolov8-pose的数据集标注
    java学习第三周总结。。。
    建联合作1000+达人,如何高效管理?
    Python爬虫爬取豆瓣电影短评(爬虫入门,Scrapy框架,Xpath解析网站,jieba分词)
    嵌入式算法19---国家商用密码SM算法
    TDengine 3.0 数据订阅功能的“独家”使用经验,只此一份!
    学生党蓝牙耳机性价比排行榜,好评榜TOP5机型推荐
  • 原文地址:https://blog.csdn.net/m0_66863468/article/details/125496616