4.0.0com.yanproduct0.0.1-SNAPSHOTproductDemo project for Spring Boot1.8UTF-8UTF-
82.6.13org.springframework.bootspring-boot-starter-webcom.baomidoumybatis-plus-boot-starter3.5.3.1com.alibabadruid-spring-boot-starter1.2.18com.mysqlmysql-connector-jruntimeorg.springframework.bootspring-boot-devtoolsruntimetrueorg.projectlomboklomboktrueorg.springframework.bootspring-boot-starter-testtestorg.springframework.bootspring-boot-dependencies${spring-boot.version}pomimportorg.apache.maven.pluginsmaven-compiler-plugin3.10.11.81.8UTF-8org.springframework.bootspring-boot-maven-plugin${spring-boot.version}com.yan.ProductApplicationtruerepackagerepackage
create table if not exists tbl_catalog(
id bigint primary key auto_increment,
name varchar(32) not null unique,
memo varchar(100)
) engine=innodb default charset utf8;
create table if not exists tbl_produce(
id bigint primary key auto_increment,
name varchar(32) not null,
catalog_id bigint,
price numeric(8,2),
store_num int
)engine=innodb default charset utf8;
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type 'com.yan.mapper.CatalogMapper' available: expected at
least 1 bean which qualifies as autowire candidate. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatc
hingBeanFound(DefaultListableBeanFactory.java:1801) ~[spring-beans-
5.3.23.jar:5.3.23]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDe
pendency(DefaultListableBeanFactory.java:1357) ~[spring-beans-5.3.23.jar:5.3.23]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDepe
ndency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.23.jar:5.3.23]
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcesso
r$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.j
ava:656) ~[spring-beans-5.3.23.jar:5.3.23]
... 39 common frames omitted
@MapperScan(basePackages = "com.yan.mapper") //注册自动扫描mapper接口,完成mapper接
口的注册
@SpringBootConfiguration //用于声明当前类时一个配置类
public class MybatisPlusConfig {
}
8、针对类目进行分页显示 分页操作可以利用MP中提供的分页插件实现,修改MP的配置类引入分页插件
@MapperScan(basePackages = "com.yan.mapper") //注册自动扫描mapper接口,完成mapper接
口的注册
@SpringBootConfiguration //用于声明当前类时一个配置类
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor interceptor=new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new
PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}
控制器类定义,这里需要传递分页参数。传递分页参数的值bean有多种写法
@Data //主要用于供前端实现分页导航
public class PageBean implements Serializable {
private long pageNum;//当前页面值
private long maxPage;//最大页面值
private long rowsNum;//总行数
private long rowsPerPage=15;//每页行数
//另外写法有:添加属性Object data存储查询结果集
}
1. If语句作为表达式
val properties = if (jobIdToActiveJob.contains(jobId)) {
jobIdToActiveJob(stage.jobId).properties
} else {
// this stage will be assigned to "default" po
基础测试题
卷面上不能出现任何的涂写文字,所有的答案要求写在答题纸上,考卷不得带走。
选择题
1、 What will happen when you attempt to compile and run the following code? (3)
public class Static {
static {
int x = 5; // 在static内有效
}
st
表里的一行对于一个数据块太大的情况有二种(一行在一个数据块里放不下)
第一种情况:
INSERT的时候,INSERT时候行的大小就超一个块的大小。Oracle把这行的数据存储在一连串的数据块里(Oracle Stores the data for the row in a chain of data blocks),这种情况称为行链接(Row Chain),一般不可避免(除非使用更大的数据
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?
For example,Given sorted array nums = [1,1,1,2,2,3],
Your function should return length