CentOS7中文乱码

系统中文乱码

1
2
3
4
5
6
7
8
9
10
11
12
[root@iZqryz7xfamf9rZ categories]# locale -a |grep "zh_CN"
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
[root@iZqryz7xfamf9rZ categories]# vim /etc/locale.conf
[root@iZqryz7xfamf9rZ categories]# cat /etc/locale.conf
LANG=zh_CN
[root@iZqryz7xfamf9rZ categories]# localectl set-locale LANG=zh_CN
[root@iZqryz7xfamf9rZ categories]# yum install convmv
[root@iZqryz7xfamf9rZ categories]# convmv -f gbk -t utf-8 -r --notest /

PageHelper分页

经过试验,存在问题!!!

PageHelper单表查询分页

1
2
3
4
5
public PageInfo findByPage(PageVO page) {
PageHelper.startPage(page.getPageNum(), page.getPageSize());
List<Project> all = projectMapper.findByPage();//分页SQL方法
return new PageInfo<>(all);//返回
}

多表关联查询分页

多表关联查询分页可能会存在分页数量不正确的情况,通过如下方式解决
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public PageInfo findAll(PageVO page) {
PageHelper.startPage(page.getPageNum(), page.getPageSize()).doCount(
() -> projectMapper.doCount() //自定义查询总数量方法,这里的返回值要求是long
);
List<Project> all = projectMapper.findAll();
return new PageInfo<>(all);
}

public PageInfo findByPage(PageVO page) {
PageHelper.startPage(page.getPageNum(), page.getPageSize()).doCount(new ISelect() {
@Override
public void doSelect() {
logn count = projectMapper.doCount();//自定义查询总数量方法,这里的返回值要求是long
}
});
List<Project> all = projectMapper.findByPage();
return new PageInfo<>(all);
}
projectMapper
1
2
@Select("SELECT COUNT(id) FROM `project`")
long doCount();

SpringBoot整合Docker自动化部署

配置pom.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!--使用docker-maven-plugin插件-->
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>

<configuration>
<!--指定远程 docker api地址-->
<dockerHost>http://47.99.143.64:2375</dockerHost>

<!--指定生成的镜像名-->
<imageName>${project.artifactId}</imageName>

<!-- 指定 Dockerfile 路径 ${project.basedir}:项目根路径下-->
<dockerDirectory>${project.basedir}</dockerDirectory>

<!-- 这里是复制 jar 包到 docker 容器指定目录配置 -->
<resources>
<resource>
<targetPath>/</targetPath>
<!--jar 包所在的路径 此处配置的 即对应 target 目录-->
<directory>${project.build.directory}</directory>
<!-- 需要包含的 jar包 ,这里对应的是 Dockerfile中添加的文件名 -->
<include>${project.build.finalName}.jar</include>
</resource>
</resources>

<!-- 以下两行是为了docker push到DockerHub使用的。 -->
<!-- <serverId>docker-hub</serverId>-->
<!-- <registryUrl>https://index.docker.io/v1</registryUrl>-->
</configuration>
</plugin>
</plugins>
</build>