Design and implementation of music playing system based on Java Springboot+Vue+MyBatis

?? Author home page: Li Yangyong?

?? Introduction: high quality creator in Java field Java Li Yangyong, author's resume template, learning materials, interview question bank, technical assistance [pay attention to me and give it to you]

?? Welcome to like?? Collect messages??

Video demonstration: get the contact information of the source code at the end of the article

springboot+vue music website

Summary:

With the development of network technology and computer, netizens have increasingly high requirements for the network. Usually, they listen to the Internet and use a lot of download software to download them, which also needs to be managed and occupy space. For example, it is very inconvenient to download and delete pop songs. The implementation of Online music library has changed this situation. It itself is a digital music interaction. Through it, users can easily, quickly and safely realize the largest music search in China, find songs, listen in real time, add their favorite songs to the collection, and establish a free, independent and safe world LAN for users. Music came into being under the premise of such demand. It brings great fun to people's daily life and allows people to relax after busy and tired work. Based on this situation, after fully analyzing the market prospect of the industry and investigating the needs of users, the music is designed.

One of the reasons why pop music is called "pop" is that it has the timeliness of transmission. Most pop songs can become famous overnight. But they also disappear from people's minds quickly. The records that people tried hard to buy in the past may be put on the shelf soon. What people pursue is always different from the previous "new" stars. However, the emergence of the Internet, on the one hand, has exacerbated this timeliness due to the improvement of communication speed, on the other hand, it makes these pop music have a certain durability by using its infinite network mind. If these two aspects are exactly what people need, then these should be attributed to music. As the network carrier of music, music has had an unprecedented impact on the development of pop music in terms of creation, dissemination and appreciation methods:
1) With the development of computer network technology, people come into contact with more pop music through music.
2) The surge in the number of Internet users has brought more people into contact with pop music through music.
3) Music provides more convenience for pop music creation.
4) Music stimulated the spread of pop music.
5) Music has changed the way pop music is appreciated.
6) Music not only stimulates the spread of pop music, but also stimulates the frequent upgrading of electronic and digital products.

Main design:

Functional design:

Client: login and registration function, home page song list information viewing, search, listening to songs, song settings, comments, and my music, etc.

Administrator side: login, graphical tree view data viewing, user management, song list management, singer management, song editing, evaluation, etc.

Main technologies:

Springboot+SpringMvc+mybatis+lombok+cache + interceptor + jQuery + HTML + Vue + node JS et al

Function screenshot:

Client home page:

Login registration:

Song list information: users can search songs according to the song list information on the home page

Singer information: users can search songs according to the singer information on the home page

My music:

Comments and likes:

Administrator side:

Home page:

User management:

Singer Management:

Song list management:

Part code:

@RestController
@Controller
public class ConsumerController {

    @Autowired
    private ConsumerServiceImpl consumerService;

    @Configuration
    public class MyPicConfig implements WebMvcConfigurer {
        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
            String os = System.getProperty("os.name");
            if (os.toLowerCase().startsWith("win")) { // windos system
                registry.addResourceHandler("/img/avatorImages/**")
                        .addResourceLocations("file:" + Constants.RESOURCE_WIN_PATH + "\img\avatorImages\");
            } else { // MAC, Linux system
                registry.addResourceHandler("/img/avatorImages/**")
                        .addResourceLocations("file:" + Constants.RESOURCE_MAC_PATH + "/img/avatorImages/");
            }
        }
    }

//    Add user
    @ResponseBody
    @RequestMapping(value = "/user/add", method = RequestMethod.POST)
    public Object addUser(HttpServletRequest req){
        JSONObject jsonObject = new JSONObject();
        String username = req.getParameter("username").trim();
        String password = req.getParameter("password").trim();
        String sex = req.getParameter("sex").trim();
        String phone_num = req.getParameter("phone_num").trim();
        String email = req.getParameter("email").trim();
        String birth = req.getParameter("birth").trim();
        String introduction = req.getParameter("introduction").trim();
        String location = req.getParameter("location").trim();
        String avator = req.getParameter("avator").trim();

        if (username.equals("") || username == null){
            jsonObject.put("code", 0);
            jsonObject.put("msg", "Wrong user name or password");
            return jsonObject;
        }
        Consumer consumer = new Consumer();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date myBirth = new Date();
        try {
            myBirth = dateFormat.parse(birth);
        } catch (Exception e){
            e.printStackTrace();
        }
        consumer.setUsername(username);
        consumer.setPassword(password);
        consumer.setSex(new Byte(sex));
        if (phone_num == "") {
            consumer.setPhoneNum(null);
        } else{
            consumer.setPhoneNum(phone_num);
        }

        if (email == "") {
            consumer.setEmail(null);
        } else{
            consumer.setEmail(email);
        }
        consumer.setBirth(myBirth);
        consumer.setIntroduction(introduction);
        consumer.setLocation(location);
        consumer.setAvator(avator);
        consumer.setCreateTime(new Date());
        consumer.setUpdateTime(new Date());

        boolean res = consumerService.addUser(consumer);
        if (res) {
            jsonObject.put("code", 1);
            jsonObject.put("msg", "login was successful");
            return jsonObject;
        } else {
            jsonObject.put("code", 0);
            jsonObject.put("msg", "login has failed");
            return jsonObject;
        }
    }

//    Judge whether the login is successful
    @ResponseBody
    @RequestMapping(value = "/user/login/status", method = RequestMethod.POST)
    public Object loginStatus(HttpServletRequest req, HttpSession session){

        JSONObject jsonObject = new JSONObject();
        String username = req.getParameter("username");
        String password = req.getParameter("password");
//        System.out.println(username+"  "+password);
        boolean res = consumerService.veritypasswd(username, password);

        if (res){
            jsonObject.put("code", 1);
            jsonObject.put("msg", "Login successful");
            jsonObject.put("userMsg", consumerService.loginStatus(username));
            session.setAttribute("username", username);
            return jsonObject;
        }else {
            jsonObject.put("code", 0);
            jsonObject.put("msg", "Wrong user name or password");
            return jsonObject;
        }

    }

//    Return all users
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public Object allUser(){
        return consumerService.allUser();
    }

//    Returns the user with the specified ID
    @RequestMapping(value = "/user/detail", method = RequestMethod.GET)
    public Object userOfId(HttpServletRequest req){
        String id = req.getParameter("id");
        return consumerService.userOfId(Integer.parseInt(id));
    }

//    delete user
    @RequestMapping(value = "/user/delete", method = RequestMethod.GET)
    public Object deleteUser(HttpServletRequest req){
        String id = req.getParameter("id");
        return consumerService.deleteUser(Integer.parseInt(id));
    }

//    Update user information
    @ResponseBody
    @RequestMapping(value = "/user/update", method = RequestMethod.POST)
    public Object updateUserMsg(HttpServletRequest req){
        JSONObject jsonObject = new JSONObject();
        String id = req.getParameter("id").trim();
        String username = req.getParameter("username").trim();
        String password = req.getParameter("password").trim();
        String sex = req.getParameter("sex").trim();
        String phone_num = req.getParameter("phone_num").trim();
        String email = req.getParameter("email").trim();
        String birth = req.getParameter("birth").trim();
        String introduction = req.getParameter("introduction").trim();
        String location = req.getParameter("location").trim();
        // String avator = req.getParameter("avator").trim();
        // System.out.println(username+"  "+password+"  "+sex+"   "+phone_num+"     "+email+"      "+birth+"       "+introduction+"      "+location);

        if (username.equals("") || username == null){
            jsonObject.put("code", 0);
            jsonObject.put("msg", "Wrong user name or password");
            return jsonObject;
        }
        Consumer consumer = new Consumer();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date myBirth = new Date();
        try {
            myBirth = dateFormat.parse(birth);
        }catch (Exception e){
            e.printStackTrace();
        }
        consumer.setId(Integer.parseInt(id));
        consumer.setUsername(username);
        consumer.setPassword(password);
        consumer.setSex(new Byte(sex));
        consumer.setPhoneNum(phone_num);
        consumer.setEmail(email);
        consumer.setBirth(myBirth);
        consumer.setIntroduction(introduction);
        consumer.setLocation(location);
        // consumer.setAvator(avator);
        consumer.setUpdateTime(new Date());

        boolean res = consumerService.updateUserMsg(consumer);
        if (res){
            jsonObject.put("code", 1);
            jsonObject.put("msg", "Modified successfully");
            return jsonObject;
        }else {
            jsonObject.put("code", 0);
            jsonObject.put("msg", "Modification failed");
            return jsonObject;
        }
    }

//    Update user Avatar
    @ResponseBody
    @RequestMapping(value = "/user/avatar/update", method = RequestMethod.POST)
    public Object updateUserPic(@RequestParam("file") MultipartFile avatorFile, @RequestParam("id")int id){
        JSONObject jsonObject = new JSONObject();

        if (avatorFile.isEmpty()) {
            jsonObject.put("code", 0);
            jsonObject.put("msg", "File upload failed!");
            return jsonObject;
        }
        String fileName = System.currentTimeMillis()+avatorFile.getOriginalFilename();
        String filePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "img" + System.getProperty("file.separator") + "avatorImages" ;
        File file1 = new File(filePath);
        if (!file1.exists()){
            file1.mkdir();
        }

        File dest = new File(filePath + System.getProperty("file.separator") + fileName);
        String storeAvatorPath = "/img/avatorImages/"+fileName;
        try {
            avatorFile.transferTo(dest);
            Consumer consumer = new Consumer();
            consumer.setId(id);
            consumer.setAvator(storeAvatorPath);
            boolean res = consumerService.updateUserAvator(consumer);
            if (res){
                jsonObject.put("code", 1);
                jsonObject.put("avator", storeAvatorPath);
                jsonObject.put("msg", "Upload successful");
                return jsonObject;
            }else {
                jsonObject.put("code", 0);
                jsonObject.put("msg", "Upload failed");
                return jsonObject;
            }
        }catch (IOException e){
            jsonObject.put("code", 0);
            jsonObject.put("msg", "Upload failed"+e.getMessage());
            return jsonObject;
        }finally {
            return jsonObject;
        }
    }

Database design:

The database adopts mysql5 version and meets the three paradigms of database design. The encoding adopts utf8 – UTF-8 Unicode, and the sorting rule adopts utf8_general_ci

User table:

CREATE TABLE `consumer` (
`id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`username`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`password`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`sex`  tinyint(4) NULL DEFAULT NULL ,
`phone_num`  char(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`email`  char(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`birth`  datetime NULL DEFAULT NULL ,
`introduction`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`location`  varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`avator`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`create_time`  datetime NOT NULL ,
`update_time`  datetime NOT NULL ,
PRIMARY KEY (`id`),
UNIQUE INDEX `username_UNIQUE` (`username`) USING BTREE ,
UNIQUE INDEX `phone_num_UNIQUE` (`phone_num`) USING BTREE ,
UNIQUE INDEX `email_UNIQUE` (`email`) USING BTREE 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=30
ROW_FORMAT=COMPACT
;

Comment form:

CREATE TABLE `comment` (
`id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`user_id`  int(10) UNSIGNED NOT NULL ,
`song_id`  int(10) UNSIGNED NULL DEFAULT NULL ,
`song_list_id`  int(10) UNSIGNED NULL DEFAULT NULL ,
`content`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`create_time`  datetime NULL DEFAULT NULL ,
`type`  tinyint(4) NOT NULL ,
`up`  int(10) UNSIGNED NOT NULL DEFAULT 0 ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=59
ROW_FORMAT=COMPACT
;

Collection table:

CREATE TABLE `collect` (
`id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`user_id`  int(10) UNSIGNED NOT NULL ,
`type`  tinyint(4) NOT NULL ,
`song_id`  int(10) UNSIGNED NULL DEFAULT NULL ,
`song_list_id`  int(10) UNSIGNED NULL DEFAULT NULL ,
`create_time`  datetime NOT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=54
ROW_FORMAT=COMPACT
;

Singer song list:

CREATE TABLE `singer` (
`id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`name`  varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`sex`  tinyint(4) NULL DEFAULT NULL ,
`pic`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`birth`  datetime NULL DEFAULT NULL ,
`location`  varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`introduction`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=46
ROW_FORMAT=COMPACT
;

Singer list:

CREATE TABLE `song` (
`id`  int(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`singer_id`  int(10) UNSIGNED NOT NULL ,
`name`  varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`introduction`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`create_time`  datetime NOT NULL COMMENT 'Release time' ,
`update_time`  datetime NOT NULL ,
`pic`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`lyric`  text CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`url`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=115
ROW_FORMAT=COMPACT
;

Forward wonderful sharing:

Design and implementation of epidemic prevention system based on java ssm springboot+VUE

Design and implementation of front and back office of film ticketing website management system based on java springboot+mybatis

Design and implementation of spring boot + mybatis winery internal management system based on Java SSM

Design and implementation of smart life sharing platform based on JAVA springboot+mybatis

Design and implementation of furniture mall platform based on Java springboot+vue+redis

Design and implementation of anti epidemic substance information management system based on JAVA SSM springboot

Design and implementation of course selection recommendation communication platform system based on java ssm springboot

Design and implementation of e-commerce Bookstore platform system based on JAVA springboot+mybatis

Design and implementation of front desk + background of Aiyou travel platform based on java springboot+mybatis

Design and implementation of luggage deposit management system in spring boot scenic spot based on Java SSM

Design and implementation of book management system based on java springboot

Simple student achievement information management system based on jsp+mysql+mybatis+Spring boot

Design and implementation of Ms. springboot e-commerce platform system based on Java SSM

Design and implementation of nursing home management system based on Java+jsp+servlet

Design and implementation of jsp online fruit sales mall system based on jsp+mysql

Design and implementation of student information management system based on Java Web SSM mybatis

Design and implementation of online liquor mall project based on Java Web (springboot + mybatis)

Design and implementation of SSM online cake mall sales website project based on jsp+mysql+Spring

Design and implementation of house rental system based on java SSM

Design and implementation of SSM mail sending and receiving information system based on Java Web

Design and implementation of springboot wedding photography booking website based on JavaWeb SSM

Design and implementation of SpringBoot recruitment website project based on jsp+mysql+Spring

Student dormitory management system based on java web jsp+servlet

Design and implementation of SSM auto insurance claim management system based on jsp+mysql+Spring+mybatis

Project summary:

Generally speaking, the function of this project is relatively simple and excellent. It is suitable for beginners as a reference for curriculum design and graduation design

In addition, you need other completed projects or white whoring java learning materials, including 10G material gift packages such as JVM, Netty, Mysql, Mybatis, Redis, Dubbo, Nginx and design mode. You can see my home page or private blogger

Punch in Java project update 29 / 100 days

You can like, collect, pay attention to and comment on me. Click below to get the contact information of the source code

Keywords: Java Front-end Spring Spring Boot html

Added by RavenStar on Wed, 02 Mar 2022 07:01:53 +0200