和lc聊天记录整理

聊天记录整理

企业微信

关于where1=1

在这里插入图片描述

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tlDSiX4j-1661235157119)(C:\Users\Shenjh01\AppData\Roaming\Typora\typora-user-images\image-20220628094511901.png)]

范例

https://zhuanlan.zhihu.com/p/126756692

where

有满足条件,添加where

没有满足条件,不添加where

第一个条件有and,自动取出and

分页查询联表

左连接:结果是,左边的所有+右边符合条件的。

结果会将左表所有的查询信息列出,而右表只列出ON后条件与左表满足的部分。

内链接:使用比较运算符根据每个表共有的列的值匹配两个表中的行

多文件knife4j上传

https://blog.csdn.net/liouwb/article/details/124491092

没有文件选择按钮,添加@ApiImplicitParam指定请求参数类型。

方案二 动态请求

hutoolUtils

https://www.hutool.cn/docs/#/db/SQL%E6%89%A7%E8%A1%8C%E5%99%A8-SqlExecutor

乐观锁实现

添加一个字段,加一个插件。

更新一条数据时候,查询版本,更新之后,对版本也做更新。

乐观锁是每次更新前都要查询一下当前版本吗

https://blog.csdn.net/Crezfikbd/article/details/123934380

springboot处理统一异常校验

https://bugpool.blog.csdn.net/article/details/105610962

状态码

public interface StatusCode{
    public int getCode();
    pulbic String getMsg();
}
@Getter
public enum ResultCode impletments StatusCode{
    
    SUCCESS(1000,"请求成功");
    
    private int code;
    private String msg;
    
    ResultCode(int code,String msg){
        this.code=code;
        this.msg=msg;
    }
}
统一校验
//vo中动手脚

@NotNull(message="商品名称不为空")
private String productName;

@Min(value=0,message="商品价格不允许为负数")
private BigDecimal productPrice;

//接口中加上校验注解  @Validated
@PostMapping("findByVo")
public ProductInfo findByVo(@Validated ProductInfoVo vo){
    ...
}
优化异常处理

@RestControllerAdvice注解增强所有@RestController,

然后@ExceptionHandler拦截对应的异常

如果开发只想返回一个实体

,需要aop拦截所有controller,在@After时候统一封装。

springboot直接从浏览器下载文件

https://blog.csdn.net/weixin_42408447/article/details/118521622
@GetMapping("file/download")
    public void downloadDevtool(HttpServletRequest request, HttpServletResponse response) throws IOException {

        String property = System.getProperty("user.dir");
        String path = property + "/src/main/resources/file/text.txt";
        
        File file = new File(path);
        String filename = path.substring(path.lastIndexOf("/")+1);
        response.setContentType("application/x-download");
        response.setHeader("content-Disposition", "attachment;filename=" + filename);
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            int len = 0;
            byte buffer[] = new byte[1024];
            OutputStream out = response.getOutputStream();
            while ((len = in.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }
    }

minio

http://www.minio.org.cn/

一堆Java的数(包括面试材料)

final用于修饰那些不能被继承的东西

md5盐值加密

https://blog.csdn.net/T_james/article/details/79528085

我自己需要弄明白集中加密/验签什么的

还有oauth2的原理 自己的东西才有底气。

插播
基本数据类型
byte int char  long
float
double  boolean  short
String 是final类型,不能修改这个类,使用StringBuffer类。
StringBuffer表示内容可以修改的字符串

StringBuffer sb=new StringBuffer();
for(int i=0;i<100;i++){
    sb.append(i);
}
//之创建了一个对象,效率很高


String str=new String();
for(int i=0;i<100;i++){
    str=str+i;
}

//StringBuffer没有覆盖equals()方法和hashCode方法,将对象写进java集合类会出问题。
final声明属性,方法,类,表示属性不可变,方法不可覆盖,类不可继承。
内部类要访问局部变量,局部变量必须定义成final类型。?

postman中传参方式

form-data

可以上传文件,需要指定类型。

x-www-form-urlencode

只能以键值对形式传参,不能传文件

binary

只能二进制文件

raw

任意形式文件

这位同事是学长,也是我编程的启蒙老师之一。
这些属于平时分享的东西,没有全部整理。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值