基于javaweb的SSH微信小程序商城+后台管理系统(java+ssh+jsp+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

080923541103

090923541103

100923541103

110923541103

120923541103

140923541103

基于javaweb的SSH微信小程序商城+后台管理系统(java+ssh+jsp+jquery+mysql)

项目介绍

本项目为小程序商城系统前后台,前台为普通会员用户登录,后台为管理员登录;

程序功能: 1.小程序前台:用户注册登录、首页、轮播图、新品推荐、分类、购物车、我的订单。 2.网站后台:管理员登录、用户管理、商品类别管理、商品管理、订单管理、公告管理;

环境需要

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+struts+hibernate 2. 前端:JSP+css+javascript+jquery

使用说明

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

前台小程序运行: 1.使用微信开发者工具导入项目; 2.导入成功后编译运行; 3.运行成功后登录账号; 普通用户:ceshi/111111  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53


//-------------------------华丽分割线---------------------------------------------

//============文件上传start=======================================================


public Integer getLbId() {
return lbId;
}
public void setLbId(Integer lbId) {
this.lbId = lbId;
}
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=========================================================
public String jsonAction() {
// dataMap中的数据将会被Struts2转换成JSON字符串,所以这里要先清空其中的数据
jsonMap.clear();
jsonMap.put("success", true);
return JSON_TYPE;
}
//-------------------------华丽分割线---------------------------------------------//

//=============公=======共=======方=======法==========区=========start============//
/**
* 列表分页查询
*/
public String pp(){
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Pp where 1=1 and lb.id="+lbId);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	 * @return
*/
public String exUpdate(){
User n = userService.getById(user.getId());
userService.update(n);
ActionContext.getContext().put("url", "/user_user.do");
return "redirect";
}


/**
* 删除
* @return
*/
public String delete(){
User n = userService.getById(user.getId());
n.setIsDelete(1);
userService.update(n);
ActionContext.getContext().put("url", "/user_user.do");
return "redirect";
}

//=============公=======共=======方=======法==========区=========end============//

//-------------------------华丽分割线---------------------------------------------//

//=============自=======定=======义=========方=======法==========区=========start============//




//=============自=======定=======义=========方=======法==========区=========end============//



}
package com.my.pro.action;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
		n.setIsDelete(1);
userService.update(n);
ActionContext.getContext().put("url", "/user_user.do");
return "redirect";
}

//=============公=======共=======方=======法==========区=========end============//

//-------------------------华丽分割线---------------------------------------------//

//=============自=======定=======义=========方=======法==========区=========start============//




//=============自=======定=======义=========方=======法==========区=========end============//



}
package com.my.pro.action;



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//用户登陆
public String utlogin(){
String hql = "from User where userName = :userName and passWord = :passWord";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",name);
alias.put("passWord", pass);
List<User> manageList=userService.getByHQL(hql, alias);
if(manageList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("userName", manageList.get(0).getRealName());
session.setAttribute("userId",manageList.get(0).getId() );
session.setAttribute("manage", manageList.get(0));
session.setAttribute("roleId", role);
jsonMap.put("result", 1);
jsonMap.put("userId", manageList.get(0).getId() );
return "json";
}else{
jsonMap.put("result", 2);
return "json";
}

}
//登录
public String toLogin(){
String hql = "from Manage where name = :userName and passWord = :passWord";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",userName);
alias.put("passWord", passWord);
List<Manage> manageList=manageService.getByHQL(hql, alias);
if(manageList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("role", manageList.get(0).getType());
session.setAttribute("userName", manageList.get(0).getRealName());
session.setAttribute("userId",manageList.get(0).getId() );
session.setAttribute("manage", manageList.get(0));
session.setAttribute("roleId", role);
return "index";
}else{
return "login";
}
}

//退出
public String tuichu() {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

@Controller("manageAction")
@Scope("prototype")
public class ManageAction extends BaseAction implements ModelDriven<Manage>{
private Manage manage;
@Autowired
private UserService userService;
@Autowired
private ManageService manageService;
private int userId;
private String userName;
private int sayId;
private String new1;
public String getNew1() {
return new1;
}

public void setNew1(String new1) {
this.new1 = new1;
}

/**
* 登陆以后进入首页
* @return
*/
public String index(){
Manage ma = manageService.login(manage);
if(ma == null){
return "login";
}
HttpSession session = ServletActionContext.getRequest().getSession();
session.setAttribute("userName", ma.getName());
session.setAttribute("userIdLogo", ma.getId());
session.setAttribute("userType", ma.getType());
session.setAttribute("userId", ma.getType());
return "index";
}

/**
* 跳到管理员页面,并且顺带查询管理员列表分页
* @return
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
			
}

}
jsonMap.put("newgoods",list);
return JSON_TYPE;
}
public String home() {
return "success";
}

//注册
public String res() throws UnsupportedEncodingException{


User user = new User();
if(!isEmpty(realName)){
String str = URLDecoder.decode((new String(realName.getBytes("ISO8859-1"), "UTF-8")), "UTF-8");
user.setRealName(str);
}
user.setCreateTime(new Date());
user.setPassWord(pass);
user.setPhone(phone);
user.setIsDelete(0);
user.setUserName(name);
Integer id = userService.save2(user);
return "json";
}

//用户登陆
public String utlogin(){
String hql = "from User where userName = :userName and passWord = :passWord";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",name);
alias.put("passWord", pass);
List<User> manageList=userService.getByHQL(hql, alias);
if(manageList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("userName", manageList.get(0).getRealName());


项目链接:
https://javayms.github.io?id=391023491103200yo
https://javayms.pages.dev?id=391023491103200yo