Skip to content

Instantly share code, notes, and snippets.

@ZcMx007
ZcMx007 / A表替换B表数据.sql
Last active September 21, 2021 14:02
表数据转换SQL
有两个表A和B,均有key和value两个字段,如果B的key在A中也有,就把B的value替换为A中对应的value
update B b set b.value=(select max(a.value) from A a where b.key=a.key)
where exists(select 1 from A c where b.key=c.key)
有A、B两表,表结构都为key和value。当B的key与A的key相同时将B的value赋给A的value
UPDATE A a,(select a.`key`,b.`value` from A INNER JOIN B on a.`key`=b.`key`) b
SET a.`value` = b.`value` WHERE a.`key` = b.`key`
能够一条条进行表数据的相互替换主要是由于where条件是逐条匹配的
@ZcMx007
ZcMx007 / setting.xml
Created September 20, 2021 10:35
maven
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@ZcMx007
ZcMx007 / Windows GC
Created August 4, 2021 16:47
windows清缓存
该文件夹下的数据可清空:
C:\Users\Think\AppData\Local\Temp
@ZcMx007
ZcMx007 / druid.xml
Created July 16, 2021 09:52
maven中pom.xml的相关配置
可以有两种引入方式:
1、原生
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.6</version>
</dependency>
2、集成
<dependency>
<groupId>com.alibaba</groupId>
@ZcMx007
ZcMx007 / LocalDateTimeToDate.java
Created July 16, 2021 08:47
mysql时区时间转java时间
public static Date LocalDateTimeToDate(LocalDateTime localDateTime) {
Function<Object, Date> objectDateFunction = Function.identity().andThen(time -> Date.from(((LocalDateTime) time).atZone(ZoneId.systemDefault()).toInstant()));
return objectDateFunction.apply(localDateTime);
}
@ZcMx007
ZcMx007 / formModel.js
Created July 10, 2021 18:22
js模拟表单提交
createInput(name, value) {
let inputElement = document.createElement("input");
inputElement.type = "hidden";
inputElement.name = name;
if (value != null) {
inputElement.value = value;
}
return inputElement;
}
// 创建表单
@ZcMx007
ZcMx007 / npmInstall.sh
Last active September 21, 2021 12:49
npm install 报ERROR
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
最后实在还是不行,则使用cnpm install
@ZcMx007
ZcMx007 / url传参.txt
Created July 9, 2021 08:47
url传参特殊字符丢失
下面是javascript的encode函数:
1.escape - 采用ISO Latin字符集对指定的字符串进行编码。不会被此方法编码的字符: @ * / +
2.encodeURI - 把URI字符串采用UTF-8编码格式转化成escape格式的字符串不会被此方法编码的字符:! @ # $& * ( ) = : / ; ? + ‘
3.encodeURIComponent - 把URI字符串采用UTF-8编码格式转化成escape格式的字符串。不会被此方法编码的字符:! * ( ) ‘
@ZcMx007
ZcMx007 / utf8mb4.txt
Created July 9, 2021 08:45
mysql编码问题
mysql支持的utf-8编码默认的是utf8mb3,但是它很多字符例如表情Emoji是没有编码的,因此会在传输到前台时显示为乱码,因此需要更改为utf8mb4的编码格式,具体原文如下:
首先,想要把字符集从utf8mb3转换到utf8mb4,其实是问题不大的:
对于BMP字符,utf8mb4和utf8mb3具有相同的存储特征:相同的编码值,相同的编码,相同的长度。
对于补充字符,utf8mb4需要4个字节来存储它,而utf8mb3根本不能存储该字符。当将utf8mb3列转换为utf8mb4时,您不必担心转换补充字符,因为没有补充字符。
假设有一张已知表使用了utf8mb3:
CREATE TABLE t1 (
@ZcMx007
ZcMx007 / 部署.sh
Created July 9, 2021 08:43
在Tomcat上部署项目
# 查看进程;
ps -ef | grep emp-client
# 查杀进程;
kill -9 进程的pid
#进webapps目录将服务包删除;
rm -rf 文件名称 或者文件夹名称
#上传工程包;
rz 回车
#回到bin目录, 启动服务;