用collection必须加id

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<select id="getAll" resultMap="HeadItemMap">
select ft.title label, st.title cl, ft.id, st.id ci
from first_title ft,
second_title st
where ft.id = st.first_title_id
order by ft.`order`, ft.id, st.`order`, st.id
</select>

<resultMap id="HeadItemMap" type="headItem">
<id property="id" column="id"/>
<collection property="children" ofType="headItem">
<id property="id" column="ci"/>
<result property="label" column="cl"/>
</collection>
</resultMap>

操控剪切板

1
2
3
4
5
6
// 复制
function copyUrlHandler(url) {
navigator.clipboard.writeText(url).then(() => {
CommSeccess("复制成功");
})
}

他妈的ref传值(对象数组)报错

1
const todayRegionalTree = ref([] as any[]);

要么回调,要么asnyc await,妈的再忘了,几次了

只要沾上Promise就一定要想异步问题,axios请求也一样

v-for加上key,必须加妈的,别他妈再不加了

啊,听到没有

妈的怎么获取元素的高

1
<div ref="wdnmd"/>
1
2
const wdnmd = ref([想放什么放什么,反正没影响]);
wdnmd.value.$el.[debug看吧,这逼东西好几个值];

改变时调用

输入框内容改变

1
<q-input @update:model-value="tip"/>

vue3 watch 新旧值一样

别监听对象,监听基本类型

之前的,错误的

1
2
3
4
watch(cardProps,(value, oldValue)=>{
// to do something
},{deep: true})

最新的,正确的

1
2
3
4
5
6
7
8
9
10
11
12
watch(() => ({
width: cardProps.value.width,
height: cardProps.value.height,
dotSize: cardProps.value.dotSize,
radius: cardProps.value.radius,
rotateX: cardProps.value.rotateX
}), (value, oldValue) => {
console.log('card props change');
console.log(value, oldValue);
const {width, height, dotSize, radius, rotateX} = value;
createImageList();
}, {deep: true})

删除不小心上传的文件

1
git rm --cached .\src\main\resources\sdadgz.cn.jks # 文件夹加上-r

关闭代理

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy

开启代理

1
2
git config --global http.proxy https://127.0.0.1:7890
git config --global http.proxy http://127.0.0.1:7890

scoop入门

权限设置

1
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

设置安装目录

1
2
$env:SCOOP='D:\tool\scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')

安装

1
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

rabbitmq入门

安装

1
docker run -d --name web_rabbitmq -p 15673:15672 -p 5673:5672 -e RABBITMQ_DEFAULT_USER=root -e RABBITMQ_DEFAULT_PASS=sdadgz.cn --network website_net rabbitmq:3.9-management

hello world

生产者

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@Test
void rabbitPublish() throws IOException, TimeoutException {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("sdadgz.cn");
factory.setPort(5673);
factory.setVirtualHost("/");
factory.setUsername("root");
factory.setPassword("sdadgz.cn");

@Cleanup Connection connection = factory.newConnection();
@Cleanup Channel channel = connection.createChannel();

channel.queueDeclare("hello_world", true, false, false, null);

for (int i = 0; i < 100; i++) {
/*
交换机名
队列名
参数
内容
*/
channel.basicPublish("", "hello_world", null, (i + "massage~~").getBytes(StandardCharsets.UTF_8));
}
}

消费者

可以多个,还有,别手欠加上close

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@Test
void rabbitConsumer() throws IOException, TimeoutException {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("sdadgz.cn");
factory.setPort(5673);
factory.setVirtualHost("/");
factory.setUsername("root");
factory.setPassword("sdadgz.cn");

Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare("hello_world", true, false, false, null);

channel.basicConsume("hello_world", true, new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
System.out.println(new String(body));
}
});
}

workqueues

hello world多个消费者就是work queues

pub/sub

1
2
3
4
5
6
7
8
channel.exchangeDeclare([交换机名称], [交换机类型], [持久化], [自动啥暗处], [内部使用,一般false], [参数]);
交换机类型:
direct定向
fanout广播
topic
headers参数匹配
channel.queueDeclare([队列名], [是否独占], [是否自动删除], [参数]);
channel.queueBind([队列名], [交换机名], [routingKey 广播设空字符串]);

routing

常用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
docker run -it -p 80:80 --name nginx01 nginx /bin/bash
#docker run [options] [image] [command]
option:
-it # 交互方式运行
-d # 后台
-p # 端口
-p [本机端口]:[容器端口]
-p [本机容器同端口]
-P # 随机端口
--name [name] # 容器名
-v [本机路径]:[容器路径] # 挂载数据卷
--network [name] # 自定义网络
-e TZ="Asia/Shanghai" # 容器内乱码
--env LC_ALL=C.UTF-8 # 乱码问题 不行试试en_US.UTF-8。
--env LANG=C.UTF-8 # 乱码问题 不行试试en_US.UTF-8。
-w [workspase] # 工作目录
arg:
/bin/bash -c ./start.sh
# jdk /use/local/[springboot]
docker start student-springboot nacos springboot wg-esay redis_website mysql_website website

时区乱套了

1
2
3
4
5
docker run -e TZ="Asia/Shanghai" -d -p 80:80  --name nginx  nginx

# 对于已经创建的
docker cp /usr/share/zoneinfo/Asia/Shanghai 容器ID:/etc/localtime
echo Asia/Shanghai > /etc/timezone

修改启动之后的容器环境

先关docker后修改

cd到宿主机/var/lib/docker/containers/[容器id]/config.v2.json

然后大刀阔斧

修改容器配置

只支持部分,–help自己看

限制容器使用内存docker container update -m 512m --memory-swap -1 nacos

swap设置负一表不限制swap,swap默认值很离谱,得手动设置,内存512swap512表不使用swap,小于报错,不设置为小于

阿里镜像

1
2
3
4
5
6
7
8
9
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://nze2xh55.mirror.aliyuncs.com"]
}
EOF
# 重启
sudo systemctl daemon-reload
sudo systemctl restart docker

好多镜像

1
2
3
4
5
6
7
8
9
10
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn","https://mirror.ccs.tencentyun.com","https://ung2thfc.mirror.aliyuncs.com","https://reg-mirror.qiniu.com","https://nze2xh55.mirror.aliyuncs.com","https://dockerproxy.com","https://mirror.baidubce.com","https://ccr.ccs.tencentyun.com"]
}
EOF
# 重启
sudo systemctl daemon-reload
sudo systemctl restart docker

部署到服务器

创建

1
npm init quasar

打包

1
2
quasar build
# 打包后的文件在dist/spa

运行

1
quasar serve -p 9000 -H 85.230.0.7

去掉路由标志,井号

1
quasar.config.js -----> vueRouterMode: 'history'

他妈的分页不干活怎么办

新建config/MybatisPlusConfig.java文件,并添加代码

1
2
3
4
5
6
7
8
9
@Configuration
public class mybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}

他妈的字段名是关键字怎么办

1
2
@TableField("`order`")
private Integer order;

在复制的html中引入vue的script写法

1
2
3
4
5
6
7
<script type="module">
import {api} from "../../src/boot/axios";

api.get('https://sdadgz.cn/springboot/8000/blog/sdadgz/blogs?currentPage=2&pageSize=6').then(res=>{
console.log(res.data.data.total);
})
</script>

动态设置对象名

简写

1
2
3
4
5
let name = "111";
let obj1 = {
[name]:"222"
}
console.log(obj1) //{111: "222"}

全拼+多个去重

1
2
3
4
5
6
let a = 'abc';
let b = {
[`${a}-1`]: true,
[`${a}-2`]: true
}
console.log(b) // {abc-1: true, abc-2: true}

这个asnyc没玩明白

1
2
3
4
5
6
7
8
9
10
11
12
13
14
await api.get("/blog/" + username1 + "/blogs", {
params: {
currentPage: currentPage.value,
pageSize: pageSize.value
}
}).then(res => {
if (res.code === "200") {
data = res.data.lists;
if (data.length < 1) {
disable.value = true;
}
}
})
await setBlogs(data); // 别把asnyc函数放then里面

如何优雅的便利对象所有属性值

1
2
3
for (let [key, value] of Object.entries(todayIpList.value)) {
console.log(key);
}

他妈的数组的fill函数

不能仍对象进去,会指向同一个对象

js的问题,并不是我的问题的问题

class方法丢失 * is not a function

js的class就离谱,反正和java不一样,特殊情况下方法调用会出现方法不存在,就是编译器ctrl+左键 能找到那个函数但是实际那个函数js找不到

原因

我不知道,我知道了,因为this关键字

少用class,能不用就不用吧

解决方法一

最简单的方法咯,直接class外面放个函数

解决方法二

去掉方法里的this,自己想怎么去

解决方法三

1
2
3
constructor() {
this.[一个函数] = this.[一个函数].bind(this);
}

离谱的解决方法

1
2
3
4
// 对象多了,浪费内存
fun = () => {
[代码]
}

jwt入门

导入maven依赖

jdk8以上需要额外依赖

1
2
3
4
5
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>

签发

获得builder

Jwts.builder()

塞东西

  • setheaderParam([key], [value]) 设置头
  • claim([kay], [value]) 设置载荷
  • setSubject([sub]) 设置sub

**保留字 **

  • ISSUER = “iss”; // 哪个人签的
  • SUBJECT = “sub”; // 主题
  • AUDIENCE = “aud”; // 签给谁
  • EXPIRATION = “exp”; // 过期时间
  • NOT_BEFORE = “nbf”; // 生效时间
  • ISSUED_AT = “iat”; // 签发时间
  • ID = “jti”; // 唯一标识

签名

signWith方法

整合

compact方法

解密

获取对应key的value

1
Jwts.parser().setSigningKey("密钥").parseClaimsJws("token").getBody().get("key");