基于javaweb的SpringBoot在线游戏商城系统(java+springboot+mybatis+mysql+maven+layui+thymeleaf+html)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

180023112402

190023112402

200023112402

220023112402

230023112402

240023112402

基于javaweb的SpringBoot在线游戏商城系统(java+springboot+mybatis+mysql+maven+layui+thymeleaf+html)

一、项目简述功能包括: 用户管理,游戏商品管理,在线购买,上传,售卖记录,商品审核等等。

二、项目运行环境配置:

Jdk1.8 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等  

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
    if (price != 0){
if (price == 1){
/**升序*/
Collections.sort(commodityList, new Comparator<Commodity>() {//此处创建了一个匿名内部类
int i;
@Override
public int compare(Commodity o1, Commodity o2) {
if (o1.getThinkmoney().compareTo(o2.getThinkmoney()) > -1) {
System.out.println("===o1大于等于o2===");
i = 1;
} else if (o1.getThinkmoney().compareTo(o2.getThinkmoney()) < 1) {
i = -1;
System.out.println("===o1小于等于o2===");
}
return i;
}
});
}else if (price == 2){
/**降序*/
Collections.sort(commodityList, new Comparator<Commodity>() {//此处创建了一个匿名内部类
int i;
@Override
public int compare(Commodity o1, Commodity o2) {
if (o1.getThinkmoney().compareTo(o2.getThinkmoney()) > -1) {
System.out.println("===o1大于等于o2===");
i = -1;
} else if (o1.getThinkmoney().compareTo(o2.getThinkmoney()) < 1) {
System.out.println("===o1小于等于o2===");
i = 1;
}
return i;
}
});
}
}
return new ResultVo(true,StatusCode.OK,"查询成功",commodityList);
}

/**
* 分页展示个人各类商品信息
*前端传入页码、分页数量
*前端传入商品信息状态码(commstatus)-->全部:100,已审核:1,待审核:3,违规:0,已完成:4
*/
@GetMapping("/user/commodity/{commstatus}")
@ResponseBody
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

/**
* 管理员首页默认展示图
* */
@GetMapping("/echars/console")
public String echars(){
return "/admin/echars/console";
}


@GetMapping("/app/message/index")
public String appmessageindex(){
return "/admin/app/message/index";
}

/**
* 用户收藏列表
* */
@GetMapping("/user/collect")
public String usercollect(){
return "/user/collect/collectlist";
}

/**
* 用户售出记录
* */
@GetMapping("/user/sold")
public String sold(){
return "/user/sold/soldrecord";
}

/**
* 销量列表
* */
@GetMapping("/admin/sold")
public String adminSold(){
return "/admin/sold/soldrecord";
}

/**
* 首页公告清单
* */
@GetMapping("/user/newslist")
public String userNews(){
return "/common/listnews";
}

/**
* 管理员公告列表
* */
@GetMapping("/admin/newslist")
public String adminNews(){
return "/admin/news/newslist";
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
        return new LayuiPageVo("", 0,dataNumber,noticesList);
}

}

package com.controller;



/**
* <p>
* 销售记录控制器
* </p>
*
*/
@Controller
public class SoldrecordController {
@Autowired
private SoldrecordService soldrecordService;

/**
* 删除售出记录
* 1.前端传入需删除记录的id(id)
* 2.判断是否是本人
* */
@ResponseBody
@PutMapping("/soldrecord/delect/{id}")
public ResultVo delectSold (@PathVariable("id") String id) {
Integer i = soldrecordService.deleteSold(id);
if (i == 1){
return new ResultVo(true, StatusCode.OK,"删除记录成功");
}
return new ResultVo(false, StatusCode.ERROR,"删除记录失败");
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
    UserInfo userInfo = new UserInfo().setUserid(userid).setUimage(uimgUrl);
userInfoService.UpdateUserInfo(userInfo);
return res;
}

/**
* 展示个人信息
*/
@RequiresPermissions("user:userinfo")
@GetMapping("/user/lookinfo")
public String lookinfo(HttpSession session, ModelMap modelMap) {
String userid = (String) session.getAttribute("userid");
UserInfo userInfo = userInfoService.LookUserinfo(userid);
modelMap.put("userInfo",userInfo);
return "/user/userinfo";
}

/**
* 跳转到完善个人信息
*/
@GetMapping("/user/perfectinfo")
public String perfectInfo(HttpSession session, ModelMap modelMap) {
String userid = (String) session.getAttribute("userid");
UserInfo userInfo = userInfoService.LookUserinfo(userid);
modelMap.put("perfectInfo",userInfo);
return "/user/perfectinfo";
}

/**
* 修改个人信息
* 1.前端传入用户昵称(username)、用户邮箱(email)、性别(sex)、游戏(server
* 2.前端传入变更后的字段,未变更的不传入后台
* 3.判断更改的用户名是否已存在
* 4.修改个人信息
*/
@ResponseBody
@PostMapping("/user/updateinfo")
public ResultVo updateInfo(@RequestBody UserInfo userInfo, HttpSession session) {
String username = userInfo.getUsername();

String sessionname = (String) session.getAttribute("username");
String userid = (String) session.getAttribute("userid");
Login login = new Login();
//如果传入用户名不为空
if (!StringUtils.isEmpty(username)){
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


/**
* <p>
* 登录注册 控制器
* </p>
*
*/
@Controller
public class LoginController {
@Autowired
private LoginService loginService;
@Autowired
private UserInfoService userInfoService;
@Autowired
private UserRoleService userRoleService;
/**手机号和注册验证码map集合*/
private static Map<String, String> phonecodemap1 = new HashMap<>();
/**手机号和重置密码验证码map集合*/
private static Map<String, String> phonecodemap2 = new HashMap<>();
/**
*图片验证码
* */
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
 * 0:封号  1:解封
*/
@PutMapping("/admin/user/forbid/{userid}/{userstatus}")
@ResponseBody
public ResultVo adminuserlist(@PathVariable("userid") String userid,@PathVariable("userstatus") Integer userstatus) {
if (userstatus == 0){
Integer i = loginService.updateLogin(new Login().setUserid(userid).setUserstatus(userstatus));
Integer j = userInfoService.UpdateUserInfo(new UserInfo().setUserid(userid).setUserstatus(userstatus));
if (i ==1 && j == 1){
/**发出封号的系统通知*/
Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")
.setWhys("因为您的不良行为,您在该网站的账号已被封号。");
noticesService.insertNotices(notices);
return new ResultVo(true, StatusCode.OK, "封号成功");
}
return new ResultVo(true, StatusCode.ERROR, "封号失败");
}else if (userstatus == 1){
Integer i = loginService.updateLogin(new Login().setUserid(userid).setUserstatus(userstatus));
Integer j = userInfoService.UpdateUserInfo(new UserInfo().setUserid(userid).setUserstatus(userstatus));
if (i ==1 && j == 1){
/**发出解封的系统通知*/
Notices notices = new Notices().setId(KeyUtil.genUniqueKey()).setUserid(userid).setTpname("系统通知")
.setWhys("您在该网站的账号已被解封,希望您保持良好的行为。");
noticesService.insertNotices(notices);
return new ResultVo(true, StatusCode.OK, "解封成功");
}
return new ResultVo(true, StatusCode.ERROR, "解封失败");
}
return new ResultVo(false,StatusCode.ACCESSERROR,"违规操作");
}

/**
* 管理员商品列表
* */
@GetMapping("/admin/product")
public String adminproduct(){
return "/admin/product/productlist";
}

/**
* 分页管理员查看各类商品信息
*前端传入页码、分页数量
*前端传入商品信息状态码(commstatus)-->全部:100,违规:0,已审核:1,待审核:3 已完成:4
* 因为是管理员查询,将userid设置为空
*/
@GetMapping("/admin/commodity/{commstatus}")


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