• 猿创征文 第二季| #「笔耕不辍」--生命不息,写作不止#


    欢迎大家参与投稿,分享#新学期,新FLAG#,投稿模板参考:

    三表多表查询 左连接 太常见了 数据量如果过大导致查询速度不及预期(4、5秒之内)应当优化

    三表多表查询
    左连接
    太常见了
    数据量如果过大导致查询速度不及预期(4、5秒之内)应当优化

            select u.code,u.username, c.*
            from ad_call_record r
            left join lego_user.user u on r.user_id = u.id
            left join ad_callback_content c on r.ref_id = c.id
    
    
    • 1
    • 2
    • 3
    • 4
    • 5

    win10老是自动更新,彻底禁止自动更新

    http://tieba.baidu.com/p/5848532152

    Java两个数字字符串相加、两个数字字符串相乘(含%)

    Java两个数字字符串相加

            //两个数字字符串相加
            String a = "75.2";
            String b = "77.5504000";
            BigDecimal c  = new BigDecimal(a);
            BigDecimal add = c.add(new BigDecimal(b));
            System.out.println(add.toString());
            //如果要保留两位小数
            System.out.println("=====" + add.setScale(2, BigDecimal.ROUND_HALF_UP));
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    两个数字字符串相乘(含%)

            //两个数字字符串相乘
            String a = "75.233";
            String b = "50";//50%
            BigDecimal c  = new BigDecimal(a);
            BigDecimal multiply = c.multiply(new BigDecimal(b)).divide(new BigDecimal(100));
            System.out.println(multiply.toString());
            //如果要保留两位小数
            System.out.println("=====" + multiply.setScale(2, BigDecimal.ROUND_HALF_UP));
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    首单付费用户总数sql

    select DISTINCT lo.place_user_id AS '首单付费用户总数' from lego_order.order lo where DATE_FORMAT(lo.pay_time,'%Y-%m-%d') = '2021-12-01'
    and (lo.pay_environment is null or lo.pay_environment != 'Sandbox')
            and lo.status = 2 and lo.place_user_type = 1
            and lo.pay_amount > 0 and lo.pay_type not in ('SSCM')
              and lo.platform = 'sscm'
    
     and lo.place_user_id not in (
    select place_user_id from lego_order.order lo where DATE_FORMAT(lo.pay_time,'%Y-%m-%d') <'2021-12-01' and lo.platform = 'sscm'
    and (lo.pay_environment is null or lo.pay_environment != 'Sandbox')
            and lo.status = 2 and lo.place_user_type = 1
            and lo.pay_amount > 0 and lo.pay_type not in ('SSCM')
                and lo.platform = 'sscm'
    
    )#19
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    @GetMapping要使用@RequestParam(“userId“)/@PathVariable(name = “userCode“)

    在这里插入图片描述
    在这里插入图片描述
    @GetMapping要使用@RequestParam(“userId”)/@PathVariable(name = “userCode”)
    否则会报错

    @PostMaping---->@RequestBody(对象)

    常见数据库表后缀

    copy结尾的是备份
    flow结尾的是流水
    rel结尾的是中间关联表
    statistics结尾的是数据统计表
    log结尾的是日志表
    config结尾的是配置表

    for循环遍历数组、集合(含代码)

    1、泛型数组遍历出来,集合用ArrayList,遍历格式为(foreach):
    for(类(将所有类型带过来) 循环变量名称(自定义一个e): 要被遍历的对象){
    }2、for(元素的数据类型(int这些,包装类型integer也可) 变量自定义一个 : Collection集合or数组){

    }
    3、上代码:People.java

    package com.equals;public class People {	
    private Integer id;
    	private String name;
    		private String post;	
    public Integer getId() {		
    return id;	
    }	
    
    public void setId(Integer id) {	
    	this.id = id;
    		}	
    public String getName() {	
    	return name;	
    	}	
    public void setName(String name) {		
    this.name = name;	
    }	
    
    public String getPost() {		
    return post;	
    }	
    public void setPost(String post) {
    		this.post = post;	
    		}	
    		public People(String name,String post){//
    				this.id = id;		
    				this.name = name;		
    				this.post = post;	
    				}
    @Override	public String toString() {	
    	return "People{" +				"id=" + id +				", name='" + name + '\'' +				", post='" + post + '\'' +				'}';	
    }}
    
    • 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

    Test.java

    package com.equals;import java.util.ArrayList;import java.util.Collection;public class test{	public static void main(String[] args) {	
    	ArrayList people = new ArrayList<>();		
    people.add(new People("zhoonghau","php"));	
    people.add(new People("zhoonghauzhognhuada","java1000"));		people.add(new People("zhoonghau3","php1111"));	
    for (People e:people			 ) {	
    					System.out.println("People{" +					"id=" + e.getId() +					", name='" + e.getName() + '\'' +					", post='" + e.getPost() + '\'' +					'}');		}	
    						String[] arr = new String[]{"学生","职场人","管理员"};		Integer[] arr2 = new Integer[]{1,2,23};		
    for (Integer w:arr2			 ) {	
    	System.out.print(w+" ");	
    									}	
    System.out.println();	
    Collection collection = new ArrayList<>();		collection.add("jiyu "+"java");	
    collection.add("xiaaohuadonghe");	
    collection.add("zhongtongsida");		
    for (String z:collection){	
    		System.out.println(z);		
    		}	}}
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    4、结果

    People{id=null, name=‘zhoonghau’, post=‘php’}People{id=null, name=‘zhoonghauzhognhuada’, post=‘java1000’}People{id=null, name=‘zhoonghau3’, post=‘php1111’}1 2 23 jiyu javaxiaaohuadonghezhongtongsida

    访问字符串

    下面函数get_str2返回数组str的首地址,而从内存的堆区申请字符串的空间,可返回全部的
    
    • 1
    #include 
    	char *get_str2(){
    	char str2[] = {"testing local pointer"};
    	return str2;
    
    }
    char *get(){
    	char *str;
    	str = (char*)malloc(100);
    	if(!str)
    		return NULL;
    	strcpy(str,"testing local pointer");
    	return str;
    }
    int main(){
    	char *p;
    	int i;
    	char *m;
    	int j;
    	char a[] = {"testing local pointer"};
    
    printf("第一种方法输出的是:\n");
    p = get_str2();
    
    for(i=0;*(p+i);i++)
    	
    putchar(*(p+i));
    
    printf("\n");
    
    
    //return 0;
    
    
    m = get();
    	printf("第二种方法输出的是:\n");
    for(j=0;*(m+j);j++)
    	putchar(*(m+j));
    printf("\n");
    //return 0;
    }
    
    • 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
    • 37
    • 38
    • 39
    • 40
    • 41
  • 相关阅读:
    Java简介
    [NOIP2010 普及组] 三国游戏
    linux下达梦数据库远程连接操作
    真是性价比之王,腾讯云这款88元云服务器已经圈粉无数!
    git clone private repo remote: Repository not found. | git新电脑上clone私有库
    GoFrame+Vue+ElementUI极速开发框架
    实验二 帧中继协议配置
    完了!这 57 道面试题(美团、BAT、携程),我咋一个都不会?
    微信小程序获取微信用户步数
    Linux多线程
  • 原文地址:https://blog.csdn.net/weixin_43206161/article/details/126919993