基于javaweb的SpringBoot宠物商城系统宠物交易平台(java+springboot+maven+mybatis+vue+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

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

功能说明

100123032402

110123032402

120123032402

130123032402

150123032402

160123032402

基于javaweb的SpringBoot宠物商城系统宠物交易平台(java+springboot+maven+mybatis+vue+mysql)

一、项目运行 环境配置:

Jdk1.8 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + 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
46
47
48
49
50
51
    }
return map;
}

//修改密码
@PostMapping("/changepassword")
public Map changepsaaword(User user,@RequestParam(value = "oldpassword")String oldpassword){
Map map = new HashMap();
map.put("uid",user.getUid());
User user1 = userService.queryUser(map);
map.remove("uid");
if(user1.getPassword().equals(oldpassword)){
userService.updateUser(user);
map.put("flag",1);
map.put("msg","修改成功");
return map;
}else {
map.put("flag",0);
map.put("msg","旧密码错误");
return map;
}
}

//删除用户
@GetMapping("/deleteUser")
public String deleteUser(Long uid){
Map map = new HashMap();
map.put("uid",uid);
userService.deleteUser(map);
petService.deletePet(map);
addressService.deleteAddress(map);
map.remove("uid");
map.put("fromuid",uid);
contactService.deleteContact(map);
return "该用户已被删除";
}

//查找所有用户
@GetMapping("/queryalluser")
public List<User> querAllUser(@RequestParam(name = "page",required = false) Integer page,@RequestParam(name = "count",required = false) Integer count){
Map map = new HashMap();
if (page != null && count != null) {
map.put("min",(page-1)*count);
map.put("max",count);
}
List<User> user = userService.queryAllUser(map);
return user;
}

@GetMapping("/countuser")
public int countuser() {
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
54
    if(skid != null && skid != ""){
map.put("skid",skid);
}else if (bkid !=null && bkid != ""){
map.put("bkid",bkid);
}
if (age != null && age != ""){
map.put("age",age);
}
if (maxprice != null){
map.put("maxprice",maxprice);
}
if (price != null){
map.put("price",price);
}
if (petname != null && petname != ""){
map.put("petname",petname);
}
if (date != null && date != ""){
map.put("date",date);
}
if (sort != null && sort != ""){
map.put("sort",sort);
}
List<Pet> pet = petService.queryPetpage(map);
return pet;
}

//查询宠物条数
@GetMapping("/querypetcount")
public int querypetcount(@RequestParam(name = "pid",required = false) Integer pid,
@RequestParam(name = "uid",required = false) Integer uid,
@RequestParam(name = "pk",required = false) Integer pk,
@RequestParam(name = "bkid",required = false) String bkid,
@RequestParam(name = "skid",required = false) String skid,
@RequestParam(name = "age",required = false) String age,
@RequestParam(name = "price",required = false) Double price,
@RequestParam(name = "date",required = false) String date,
@RequestParam(name = "petname",required = false) String petname) {
Map map = new HashMap();
if(pid != null) {
map.put("pid",pid);
}
if(uid != null) {
map.put("uid",uid);
}
if (pk != null) {
map.put("pk", pk);
}
if (skid != null && skid != "") {
map.put("skid", skid);
} else if (bkid != null && bkid != "") {
map.put("bkid", bkid);
}
if (age != null && age != ""){
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
        if (petname != null && petname != ""){
map.put("petname",petname);
}
if (price != null){
map.put("price",price);
}
if (date != null && date != ""){
map.put("date",date);
}
return petService.querypetcount(map);
}

//查询所有宠物的最高价
@GetMapping("/queryMaxPrice")
public String queryMaxPrice(){
return petService.queryMaxPrice();
}

//查询所有宠物年龄
@GetMapping("/queryage")
public List<Map> queryage(){
return petService.queryage();
}
}
package com.example.controller;



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
//登录
@GetMapping("/login")
public Map login(String username, String password){
//查找该用户名(即该账户)是否存在
Map map = new HashMap();
map.put("username", username);
map.put("telphone", username);
map.put("email", username);
User user = userService.queryUser(map);
map.remove("username");
map.remove("telphone");
map.remove("email");
if (user == null){
map.put("flag",0);
map.put("msg","用户不存在");
return map;
}else if (password.equals(user.getPassword())){
map.put("flag",1);
map.put("uid",user.getUid());
map.put("avatar",user.getAvatar());
map.put("type",user.getType());
map.put("msg","欢迎,"+user.getUsername());
return map;
}else {
map.put("flag",0);
map.put("msg","密码错误");
return map;
}
}

//查找单个用户的信息
@GetMapping("/queryuser")
public User queryuser(Long uid){
Map map = new HashMap();
map.put("uid",uid);
User user = userService.queryUser(map);
if(user.getType() == 1){
String idcard = user.getIdcard();
String start = idcard.substring(0,1);
String end = idcard.substring(idcard.length()-1);
String center = idcard.substring(1,idcard.length()-1);
String newidcard = start + center.replaceAll("[0-9Xx]","*") + end;
user.setIdcard(newidcard);
}
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
        return "种类修改成功";
}

@GetMapping("/queryallskind")
public List<SKind> queryAllSKind(SKind sKind){
Map map = new HashMap();
if(sKind.getBkid() != null){
map.put("bkid",sKind.getBkid());
}
if(sKind.getSkid() != null) {
map.put("skid",sKind.getSkid());
}
if(sKind.getSkindname() != null && sKind.getSkindname() != "") {
map.put("skindname",sKind.getSkindname());
}
return sKindService.queryAllSKind(map);
}
}
package com.example.controller;



@RestController
@RequestMapping("/contact")
public class ContactController {
@Autowired
private ContactService contactService;

@PostMapping("/updatecontact")
public String updatecontact(Contact contact){
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
                String filename = createUUID.getUUID() + files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf("."));
//创建文件对象,设置文件保存路径
File dest = new File(path + filename);
//将文件对象转化为文件
files[i].transferTo(dest);
photo.setUrl("petimg/" + filename);
photoService.addPhoto(photo);
}
}
else {
photo.setUrl("defaultpetimg/nodata.jpg");
photoService.addPhoto(photo);
}
}
return "发布成功";
}

//删除宠物
@GetMapping("/deletePet")
public String deletePet(@RequestParam(name = "uid",required = false) Long uid, @RequestParam(name = "pid",required = false) Long pid){
Map map = new HashMap();
if(uid != null){
map.put("uid",uid);
}else{
map.put("pid",pid);
map.put("postatu",0);
}
List<Petorder> petorder = petorderService.querypetorder(map);
map.remove("postatu");
if(petorder.size() == 0){
petService.deletePet(map);
photoService.deletePhoto(map);
return "删除成功";
}else {
return "该宠物已被购买,无法删除";
}
}

//更新宠物信息
@PostMapping("/updatePet")
public String updatePet(@RequestParam(name = "files",required = false) MultipartFile[] files,@RequestParam(name = "ppid",required = false) Long[] ppid, Pet pet) throws IOException {
Date date = new Date();
pet.setDate(date);
Photo photo = new Photo();
photo.setPid(pet.getPid());
//删除图片
if(ppid != null) {
if(ppid.length > 0) {
Map photomap = new HashMap();
for(int i=0; i < ppid.length; i++) {
photomap.put("ppid",ppid[i]);
photoService.deletePhoto(photomap);
photomap.remove("ppid");


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