当前位置: 首页 > news >正文

网站的建设和品牌价值的关系百度域名收录提交入口

网站的建设和品牌价值的关系,百度域名收录提交入口,k大原画培训班官网,深圳市网站建设制作设计平台前言: 第一点:过于依赖代码生成器或AI,导致基于mybaits的CRUD通通忘了,所以为了找回遗忘的记忆,有了该系列内容。 第二点:通过实践而发现真理,又通过实践而证实真理和发展真理。从感性认识而能…

前言:

第一点:过于依赖代码生成器或AI,导致基于mybaits的CRUD通通忘了,所以为了找回遗忘的记忆,有了该系列内容。

第二点:通过实践而发现真理,又通过实践而证实真理和发展真理。从感性认识而能动地发展到理性认识,又从理性认识而能动地指导革命实践,改造主观世界和客观世界。实践、认识、再实践、再认识,这种形式,循环往复以至无穷,而实践和认识之每一循环的内容,都比较地进到了高一级的程度。

正片:

基于springBoot——maven项目

第一步:安装依赖

        第一个依赖:对应数据库驱动——Mysql-Driver

        第二个依赖:JDBC框架——本系列采用Mybaits

pop.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.4.1</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>org.example</groupId><artifactId>mybatis</artifactId><version>0.0.1-SNAPSHOT</version><name>mybatis</name><description>mybatis</description><url/><licenses><license/></licenses><developers><developer/></developers><scm><connection/><developerConnection/><tag/><url/></scm><properties><java.version>17</java.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>3.0.4</version></dependency><dependency><groupId>com.mysql</groupId><artifactId>mysql-connector-j</artifactId><scope>runtime</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter-test</artifactId><version>3.0.4</version><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

第二步:启动项目

理论结果——产生报错

实践结果——产生报错即为成功

第三步:添加数据库配置

第一步:在Resource文件下创建启动配置文件——application.yaml

第二步:根据自身内容添加数据库
spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driver #数据库驱动路径url: jdbc:mysql://localhost:3306/steel #数据库表路径username: root    #数据库登录账号password: 123456  #数据库登录密码server:port: 8084     #springBoot内置服务器自定义端口
第三步:运行

理论结果:无报错

实践验证:无报错

第四步:这是作者曾经常用的CRUD模板

第一步:添加实体类——对应数据库表

实体类:

为了更好使用,添加lombok框架——在pop.xml文件中的<dependencies></dependencies>标签内添加以下代码

        <dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><scope>annotationProcessor</scope></dependency>
@Data
public class entity {int id;String username;String password;
}

注意:实体类中的变量名需要严格对应数据库表名!

实践认知:会尝试不必要的报错(可尝试)

第二步:添加Mapper(注解式写法)

第三步:增加XML文件 OR添加对应注解

@Mapper
public interface UserMapper {/*查询ID返回全部内容*/@Select("SELECT id,username,password form user_test where id =#{id}")List<entity> userByAll(int id);/*单独查询*/@Select("SELECT id,username,password form user_test where id =#{id}")entity userById(int id);
}

到了第四步,剩下的我们可以不做了,因为从第四步开始就是处理数据了

现在可以直接调用方法打印数据

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form steel.user_test' at line 1

报错了,是最基础的SQL报错!

问题找到了,如果你不经常写from,这个会因为form写起来顺手,写错。。。。。

@Mapper
public interface UserMapper {/*查询ID返回全部内容*/@Select("SELECT id,username,password from user_test where id =#{id}")List<entity> userByAll(Long[] id);/*单独查询*/@Select("SELECT id,username,password from user_test where id =#{id}")entity userById(int id);
}

http://www.ritt.cn/news/14518.html

相关文章:

  • 免费奖励的网站有哪些友情链接的四个技巧
  • 做英文网站哪里好国外网页模板
  • 专业的龙岗网站建设海外营销推广服务
  • 广州网站建设首选快优搜索引擎的工作原理是什么
  • 网站开发安装平台推广是什么意思
  • 各类网站网站建设的目标是什么意思海南seo顾问服务
  • 怎么做二维码让别人扫码进入网站成人技能培训
  • 用网站做的简历模板百度指数官方下载
  • wordpress 随机展示杭州seo网站建设
  • 东莞专业建网站baidu百度一下
  • 美橙网站建设公众号推广接单平台
  • 做新媒体国外网站快速排名怎么做
  • 怎么做网站注册名密码seo蜘蛛屯
  • 网站轮播图片怎么做的佣金高的推广平台
  • 建网站要多少钱 优帮云爱站小工具
  • 怎么做企业的网站百度移动端排名
  • 假网站怎么制作网络营销swot分析
  • 重庆网站优化排名十大舆情网站
  • 深圳网站设计与制作互联网项目推广是什么
  • 济南免费建站廊坊seo快速排名
  • 小说网站个人可以做吗查询网站域名
  • 有哪些品牌做打底衫的网站黑龙江seo关键词优化工具
  • 大都会app下载最新版本seo的基本步骤是什么
  • 大庆城乡建设局网站首页优化seo搜索
  • 诸城网站做的好的搜索技巧
  • 网站by wordpress个人免费自助建站网站
  • 网站源码制作线上营销策划案例
  • 郑州校园兼职网站建设百度竞价推广后台
  • 网站建设技术协议书全网最好的推广平台
  • 做app网站有哪些功能中国seo