In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "SpringMVC framework how to build idea operation database". In daily operation, I believe many people have doubts about how to build idea operation database in SpringMVC framework. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to build idea operation database in SpringMVC framework". Next, please follow the editor to study!
1. Catalogue
2.PersonControllerpackage com.sk.controller;import com.sk.entity.Person;import com.sk.service.PersonService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody / * * @ Author Songke * @ Date 17:36 on 2022-3-31 * @ Version 1.0 * / @ Controller@RequestMapping ("/ com/sk/Person") public class PersonController {@ Autowired private PersonService personService; @ RequestMapping ("/ getPersonById") @ ResponseBody public Object getPersonById (Integer id) {return personService.getById (id);} @ RequestMapping ("/ savePerson") @ ResponseBody public Boolean savePerson (Person person) {return personService.save (person) } @ RequestMapping ("/ getPersonList") @ ResponseBody public Object getPersonList () {return personService.list ();}} 3.PersonMapperpackage com.sk.dao;import com.baomidou.mybatisplus.core.mapper.BaseMapper;import com.sk.entity.Person;/** * @ Author Songke * @ Date on 2022-3-31 17:36 * @ Version 1.0 * / public interface PersonMapper extends BaseMapper {} 4.Personpackage com.sk.entity;import com.baomidou.mybatisplus.annotation.IdType Import com.baomidou.mybatisplus.annotation.TableId;import lombok.Data;/** * @ Author Songke * @ Date 2022-3-31 17:30 * @ Version 1.0 * / @ Datapublic class Person {/ * personID * / @ TableId (type = IdType.ASSIGN_ID) private String personId; * name private String personName; * Age private Integer personAge;} 5.PersonServiceImplpackage com.sk.service.Impl Import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;import com.sk.dao.PersonMapper;import com.sk.entity.Person;import com.sk.service.PersonService;import org.springframework.stereotype.Service;/** * @ Author Songke * @ Date 17:35 on 2022-3-31 * @ Version 1.0 * / @ Servicepublic class PersonServiceImpl extends ServiceImpl implements PersonService {} 6.PersonServicepackage com.sk.service;import com.baomidou.mybatisplus.extension.service.IService;import com.sk.entity.Person Import org.apache.ibatis.annotations.Mapper / * * @ Author Songke * @ Date 17:35 on 2022-3-31 * @ Version 1.0 * / public interface PersonService extends IService {} 7.jdbc.propertiesjdbc.driver=com.mysql.cj.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8jdbc.username=rootjdbc.password=1234568.springmvc-servlet.xml 9.sql-person-CREATE TABLE `test` (`test` (`person_ id`int NOT NULL AUTO_INCREMENT COMMENT 'primary key id' `Name` varchar (255) NULL COMMENT 'name', `person_ age`int NULL COMMENT 'age, PRIMARY KEY (`person_ id`) -- 10.pom 4.0.0 org.example spring-mvc 1.0-SNAPSHOT 11 11 org.springframework spring-core 5.3.16 spring-web Spring-webmvc 5.3.17 spring-aop org.webjars.bower jquery 3.6.0 org.projectlombok lombok 1.18.20 com.baomidou mybatis-plus 3.3.1 Mysql mysql-connector-java 8.0.28 com.alibaba druid 1.1.9 com.microsoft.sqlserver mssql-jdbc 8.4.1.jre8 spring-context spring-expression Spring-tx 4.3.22.RELEASE com.fasterxml.jackson.core jackson-annotations 2.9.3 jackson-core jackson-databind spring-jdbc to this On the "SpringMVC framework how to build idea operation database" study is over, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.