当前位置:网站首页>SSM second hand trading website
SSM second hand trading website
2022-07-02 07:19:00 【Night Weiyang 5788】
Author URI : In the middle of the night 5788
brief introduction :Java Quality creators in the field 、Java project 、 Learning materials 、 Technical assistance
Get the source code at the end of the article
Project introduction
The project is divided into front and back stages , Foreground ordinary user role , Background administrator role .
The main functions of the administrator are as follows :
land , Commodity classification management , Commodity management , Commodity order management , User management and other functions .
The main functions of user roles are as follows :
It includes the following functions : See all the products , User login registration , View items by category , Release commodities , Check out the seller's home page , Contact the seller , Leave a message for the product , Check the order , Modify and view personal data and other functions .
Environmental needs
1. Running environment : It is best to java jdk 1.8, We run on this platform . Other versions can, in theory .
2.IDE Environmental Science :IDEA,Eclipse,Myeclipse Fine . recommend IDEA;
3.tomcat Environmental Science :Tomcat 7.x,8.x,9.x All versions are available
4. Hardware environment :windows 7/8/10 1G Above memory ; perhaps Mac OS;
5. database :MySql 5.7 edition ;
6. whether Maven project : yes ;
Technology stack
1. Back end :Spring+SpringMVC+Mybatis
2. front end :JSP+BootStrap+jQuery
Instructions
1. Use Navicat Or other tools , stay mysql Create a database with the corresponding name in , And import the sql file ;
2. Use IDEA/Eclipse/MyEclipse Import the project ,Eclipse/MyEclipse Import time , if maven Item, please select maven;
if maven project , After importing successfully, please execute maven clean;maven install command , And then run ;
3. In the project mybatis.xml Change the database configuration in the configuration file to your own configuration ;
4. Run the project , Input localhost:8080/ssm_ershou_shop Sign in
Run a screenshot
Foreground interface

Backend interface

Related codes
Administrator controller
@Controller
@RequestMapping(value = "admin")
public class AdminController {
private final UserService userService;
private final GoodService goodService;
private final TypeService typeService;
private final OrderService orderService;
@Autowired
public AdminController(UserService userService, GoodService goodService, TypeService typeService, OrderService orderService) {
this.userService = userService;
this.goodService = goodService;
this.typeService = typeService;
this.orderService = orderService;
}
@RequestMapping(value = "/adminLogin", method = RequestMethod.GET)
public String getAdminLogin(){
return "admin/adminLogin";
}
@RequestMapping(value = "/adminLogin", method = RequestMethod.POST)
public String postAdminLogin(ModelMap model,
@RequestParam(value = "email", required = false) String email,
@RequestParam(value = "password", required = false) String password,
HttpSession session) {
User admin = userService.getUserByEmail(email);
String message;
if (admin != null){
String mdsPass = DigestUtils.md5DigestAsHex((password + admin.getCode()).getBytes());
// if (!mdsPass .equals(admin.getPassword())){
// message = " User password error !";
// }
if (!password .equals(admin.getPassword())){
message = " User password error !";
} else if (admin.getRoleId() != 101){
message = " The user does not have access !";
} else {
session.setAttribute("admin",admin);
return "redirect:/admin/adminPage";
}
} else {
message = " The user doesn't exist !";
}
model.addAttribute("message", message);
return "admin/adminLogin";
}
@RequestMapping(value = "/adminLogout", method = RequestMethod.GET)
public String adminLogout(@RequestParam(required = false, defaultValue = "false" )String adminLogout, HttpSession session){
if (adminLogout.equals("true")){
session.removeAttribute("admin");
}
// adminLogout = "false";
return "redirect:/";
}
@RequestMapping(value = "/adminPage", method = RequestMethod.GET)
public String getAdminPage(ModelMap model,
HttpSession session){
User admin = (User) session.getAttribute("admin");
if (admin == null){
return "redirect:/admin/adminLogin";
}
List<Good> goodList = goodService.getAllGoodList();
for (Good good : goodList) {
good.setGoodUser(userService.getUserById(good.getUserId()));
good.setGoodSecondType(typeService.getSecondTypeById(good.getSecondTypeId()));
}
List<User> userList = userService.getAllUser();
List<FirstType> firstTypeList = typeService.getAllFirstType();
List<Order> orderList = orderService.getOrderList();
model.addAttribute("goodList", goodList);
model.addAttribute("userList", userList);
model.addAttribute("firstTypeList", firstTypeList);
model.addAttribute("orderList", orderList);
return "admin/adminPage";
}
@RequestMapping(value = "/user/update/status/{statusId}&{userId}", method = RequestMethod.GET)
public ResponseEntity updateUserStatus(@PathVariable Integer statusId,
@PathVariable Integer userId){
Boolean success = userService.updateUserStatus(statusId, userId);
if (success){
List<User> userList = userService.getAllUser();
return ResponseEntity.ok(userList);
}
return ResponseEntity.ok(success);
}
@RequestMapping(value = "/user/delete/{userId}", method = RequestMethod.GET)
public ResponseEntity deleteUser(@PathVariable Integer userId){
Boolean success = userService.deleteUser(userId);
if (success){
List<User> userList = userService.getAllUser();
return ResponseEntity.ok(userList);
}
return ResponseEntity.ok(success);
}
}
Home controller
@Controller
public class HomeController {
private final UserService userService;
@Autowired
public HomeController(UserService userService) {
this.userService = userService;
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage(ModelMap mode, HttpServletRequest request) {
String preURL = request.getHeader("Referer");
mode.addAttribute("preURL", preURL);
return "home/login";
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String loginSubmit(ModelMap model,
@RequestParam(value = "preURL", required = false, defaultValue = "") String preURL,
@RequestParam(value = "email", required = false) String email,
@RequestParam(value = "password", required = false) String password,
HttpSession session) {
User user = userService.getUserByEmail(email);
String message;
if (user != null){
String mdsPass = DigestUtils.md5DigestAsHex((password + user.getCode()).getBytes());
if (!mdsPass .equals(user.getPassword())){
message = " User password error !";
} else {
if (user.getStatusId() == 4){
session.setAttribute("user",user);
if (preURL.equals("")){
return "redirect:/";
} else {
return "redirect:" + preURL;
}
} else {
message = " The user is invalid !";
}
}
} else {
message = " The user doesn't exist !";
}
model.addAttribute("message", message);
return "home/login";
}
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(@RequestParam(required = false, defaultValue = "false" )String logout, HttpSession session){
if (logout.equals("true")){
session.removeAttribute("user");
}
return "redirect:/";
}
@RequestMapping(value = "/register", method = RequestMethod.GET)
public String registerPage(ModelMap model) {
User user = new User();
model.addAttribute("user", user);
return "home/register";
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String registerSuccess(ModelMap model,
@Valid User user) {
String status;
Boolean insertSuccess;
InfoCheck infoCheck = new InfoCheck();
if (!infoCheck.isMobile(user.getMobile())){
status = " Please input the correct mobile number !";
} else if (!infoCheck.isEmail(user.getEmail())){
status = " Please enter the correct email !";
} else if (userService.getUserByMobile(user.getMobile()) != null) {
status = " This phone number is already in use !";
} else if (userService.getUserByEmail(user.getEmail()) != null) {
status = " This mailbox is already in use !";
} else if (user.getPassword2() == null){
status = " Please confirm the password !";
} else {
RandomString randomString = new RandomString();
user.setCode(randomString.getRandomString(5));
String md5Pass = DigestUtils.md5DigestAsHex((user.getPassword() + user.getCode()).getBytes());
user.setPassword(md5Pass);
insertSuccess = userService.registerUser(user);
if (insertSuccess){
return "home/login";
} else {
status = " Registration failed !";
model.addAttribute("user", user);
model.addAttribute("status", status);
return "home/register";
}
}
System.out.println(user.getMobile());
System.out.println(status);
model.addAttribute("user", user);
model.addAttribute("status", status);
return "home/register";
}
}
If you want to learn this system , Now get . reply :88ssm
边栏推荐
- 【信息检索导论】第六章 词项权重及向量空间模型
- 图解Kubernetes中的etcd的访问
- How to call WebService in PHP development environment?
- Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
- CRP implementation methodology
- 2021-07-17c /cad secondary development creation circle (5)
- Sqli labs customs clearance summary-page2
- 【信息检索导论】第七章搜索系统中的评分计算
- Two table Association of pyspark in idea2020 (field names are the same)
- SSM实验室设备管理
猜你喜欢

【信息检索导论】第二章 词项词典与倒排记录表

Oracle EBs and apex integrated login and principle analysis

Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"

Go package name

软件开发模式之敏捷开发(scrum)

【模型蒸馏】TinyBERT: Distilling BERT for Natural Language Understanding

SQL injection closure judgment

@Transational踩坑

IDEA2020中测试PySpark的运行出错

Oracle 11g uses ords+pljson to implement JSON_ Table effect
随机推荐
2021-07-19c CAD secondary development creates multiple line segments
ORACLE EBS接口开发-json格式数据快捷生成
SSM实验室设备管理
CSRF攻击
UEditor . Net version arbitrary file upload vulnerability recurrence
Agile development of software development pattern (scrum)
搭建frp进行内网穿透
php中生成随机的6位邀请码
类加载器及双亲委派机制
Pratique et réflexion sur l'entrepôt de données hors ligne et le développement Bi
一个中年程序员学习中国近代史的小结
Oracle RMAN automatic recovery script (migration of production data to test)
【论文介绍】R-Drop: Regularized Dropout for Neural Networks
Oracle EBs and apex integrated login and principle analysis
离线数仓和bi开发的实践和思考
MySQL组合索引加不加ID
【Torch】解决tensor参数有梯度,weight不更新的若干思路
php中时间戳转换为毫秒以及格式化时间
php中的数字金额转换大写数字
华为机试题-20190417