零碎知识点记录
1. 数据库
(1)union 和 union all 都是对sql查询语句取并集
union 去重
union all不去重
(2)数据库驱动:
DB2:
driverClassName: com.ibm.db2.jcc.DB2Driver
url: jdbc:db2://localhost:50000/sample
Oracle:
driverClassName: oracle.jdbc.driver.OracleDriver
url:jdbc:oracle:thin:@localhost:1521:orcl
MySql:
driverClassName: com.mysql.jdbc.Driver
url:jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
(3) MySQL错误Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT)解决方法:
原主句:select b.* from a,b where a.pid=b.pid
修改后语句:select b.* from a,b where a.pid=CONVERT(b.pid USING utf8) COLLATE utf8_unicode_ci
原文地址:
(4) oracle卸载:
搜索栏打开 regedit 打开注册表页面,删除一下路径下Oracle相关的服务注册表信息
(1)选择HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE,按del键删除这个入口
(2)选择HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services,滚动这个列表,删除所有Oracle入口(以oracle开头的键) //这就是服务里的所有的服务
(3)选择HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application,删除所有Oracle入口。
(4)删除HKEY_CLASSES_ROOT目录下所有以Ora或Oracle为前缀的键。
计算机–>属性–>高级系统设置–>高级–>环境变量,删除环境变量CLASSPATH和PATH中有关Oracle的设定
(这点很重要,我安装的时候就是有一次安装成功了,之后用plsql连接的时候需要配置一个环境变量,之后一直连接不上,后来查看oracle还是安装错了,之后卸载的时候就忘了把那个配置的有oracle信息的path变量删除,之后就导致了一系列的错误)
删除所有与Oracle相关的目录(如果删不掉,重启计算机后再删就可以了)包括:
1)C:\Program Files\Oracle目录。
2)Oracle的安装目录,比如D:\app
3)C:\WINDOWS\system32\config\systemprofile\Oracle目录。
4)C:\用户\用户名\Oracle
最后一步,卸载之后千万要重启电脑,否则卸载不干净,下次安装的时候还出现同样的问题。
PS.当完全卸载后就可以安心的安装了。
转载出处:
2.java
(1) mybatisPlus:
a.标注字段再数据库中不存在
@TableField(exist = false)
private String userDept;
(2) pom问题:
a) Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer报错
原因;
POM中包含有maven-war-plugin插件,插件版本太低
解决办法:
在build中加入如下代码:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>
原文链接:
(3) 文件下载
Springboot项目在开发环境中,使用 ResourceUtils.getFile(“classpath:files/test.xlsx”) 能读取到文件,结果打包成jar后,读取报错了
解决方法:
// 第一种使用 ClassPathResource 读取文件
ClassPathResource resource = new ClassPathResource(“files/test.xlsx”);
File sourceFile = resource.getFile();
InputStream fis = resource.getInputStream();
// 第二种使用 getClassLoader()读取文件
InputStream fis = ExcelReadUtil.class.getClassLoader().getResourceAsStream(“files/test.xlsx”)
————————————————
原文链接:
3.前端
(1) checkbox样式修改: input checkbox 复选框大小修改 设置zoom属性(放大)
利用style:
利用css3: input[type=“radio”],input[type=“checkbox”]{ zoom:180%; }
(2) miniui的grid的combox选中设置对应的字段数据:
grid.getCurrentCell()[0].headUserId = e.selected.user_id;
var paymentContractId=e.selected.paymentContractId;
//根据合同id获取客户简称
var combo = e.sender;
var row = grid.getEditorOwnerRow(combo);
row.paymentContractId = paymentContractId;
var editor = grid.getCellEditor("unitNameJc", row);
editor.setValue(getUnitNameJcByHtId(paymentContractId));
editor.disable();
editor.enable();
(3) miniui隐藏表字段属性: visible=“false”
(4)miniui动态设置表格数据是否换行
function expandRow(){
let grid = mini.get(datagrid1
)
grid.setAllowCellWrap(!grid.getAllowCellWrap());
grid.reload(); // 重新渲染表格,否则不生效
}
(5) mini设置virtualScroll后添加allowCellWrap属性单元格不会自动填充增加高度
(6) miniui禁用表单修改
form.setEnabled(false);
表单设置数据
form.setData(data);
(7) json对象
首先如果直接取值可以data[‘rescourceCode’],
(8) miniui文本框文字居中
inputStyle=“text-align:right”
4.idea使用
(1) idea自动部署:
1.进入file->project struct中
2.选择web application exploded
3.添加完成后
4.主要时这块
5点击deployment中选择第一二部设置的项目
6 在file->setting中设置如下:
目前为至,至少我这边是可以了
(2) 新导入的maven项目在idea中没有maven工具栏
右击项目的maven文件,点击add as maven project
5.java
- HashSet是无序集合,LinkedHashSet是有序集合
set遍历用 set.iterator() - date转为localdatetime
原文地址:
package insping;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
public class Test {
public static void main(String[] args) {
Date date = new Date();
Instant instant = date.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
System.out.println("Date = " + date);
System.out.println("LocalDateTime = " + localDateTime);
}
}
LocalDateTime转换为Date
package insping;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
public class Test {
public static void main(String[] args) {
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime localDateTime = LocalDateTime.now();
ZonedDateTime zdt = localDateTime.atZone(zoneId);
Date date = Date.from(zdt.toInstant());
System.out.println("LocalDateTime = " + localDateTime);
System.out.println("Date = " + date);
}
}
6.mave
(1) 将jar包添加进本地仓库中
mvn install:install-file "-Dfile=本地jar包所在路径" "-DgroupId=设置groupId" "-DartifactId=设置artifactId" "-Dversion=设置版本" "-Dpackaging=jar"
# 如下,用的是bat指令方式
mvn install:install-file "-Dfile=C:/Users/windows/Desktop/temp/common-0.0.1-SNAPSHOT.jar" "-DgroupId=com.cn.hr.cloud" "-DartifactId=common" "-Dversion=0.0.1-SNAPSHOT" "-Dpackaging=jar"