mybits学习
爱吃米饭的捣蛋鬼
2019年本科毕业,喜欢编程,但只是个初学的菜鸟。
2023年研究生就要毕业了,写python程序问题不大。可以把遇到的问题转化为程序语言。Java还不太熟练。算是个程序入门的选手。
展开
-
浏览器访问
##浏览器访问localhost:8080/dept/1查询操作localhost:8080/dept?departmentName=QQ对数据库进行插入操作##navicat新建数据库:字符集:utf8 – UTF-8 Unicode;记得表名要和类名相同;记得设计表时需要id设为主键,才可以勾选自增id....原创 2020-11-17 23:30:18 · 162 阅读 · 0 评论 -
entity实体类
Entity实体类:书写规范:1.java中包和类的建立和书写: 包名可以自己定义,但最好是全部小写; 包下边的类与接口全部使用驼峰命名规则。 (首字母要大写,第二个单词的首字母也要大写。) 注意:要新建**类而不是包**,包名和类名之间用点隔开(如图1) 2.实体类与数据库的映射关系: entity包下的实体类要全部保持和数据库的表名一致; 类属性值要与数据库字段对应。(如图2) 特别说明: 数据库的名应该在application原创 2020-11-17 18:23:39 · 2235 阅读 · 5 评论 -
连接数据库的配置文件
application.ymal连接数据库的配置文件spring: datasource: username: **** password: ****** url: jdbc:mysql://localhost:3306/mybits01?serverTimezone=UTC&useUnicode=true&charaterEncoding=utf-8&useSSL=false driver-class-name: com.mysql.cj.j原创 2020-11-17 23:05:43 · 291 阅读 · 0 评论 -
DepartmentMapper
##DepartmentMapper基于注解的对数据库单表crud操作package com.mybits000.Mapper;import com.mybits000.entity.Department;import org.apache.ibatis.annotations.*;//指定一个操作数据库的mapper@Mapper//基于注解的方式连接数据库public interface DepartmentMapper { @Select("select * from D原创 2020-11-17 23:11:50 · 257 阅读 · 0 评论 -
Controller
Controller调用DepartmentMapper对数据库进行操作import com.mybits000.entity.Department;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.Request原创 2020-11-17 23:16:06 · 107 阅读 · 0 评论