package com.ruoyi.system.test;

import com.alibaba.fastjson2.JSON;
import org.apache.ibatis.jdbc.SQL;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author hanzihang
 * @date 2023/8/24 3:36 PM
 */
public class ljj {

    static String SQL_START = "CONCAT(";
    static final String SQL_MIDDLE = "IFNULL( #{VAL}, '' )";
    static final String SQLSERVER_MIDDLE = "COALESCE( #{VAL}, '' )";
    static final String SQL_END = "LIKE '%#{val}%'";


    public static void main(String[] args) {

        String a = "asdjkl";
        System.out.println(a.replaceAll("k","QQ"));


//        for (int i = 0; i < 10; i++) {
//
//            System.out.println(SQL_MIDDLE + "1");
//        }


//        String a = "\u200B冀J1T697";
//
//        System.out.println(a.length());
//        System.out.println("\u200B冀J1T697".equals("冀J1T697"));


//        if (true) {
//            test2(1);
//            return;
//        }
//
//        List<String> tests = new ArrayList<>();
//
//        tests.add("name");
//        tests.add("age");
//        tests.add("sex");
//        tests.add("rem");
//        tests.add("pass");
//        //  NAME || age LIKE '%18%'
//        //  CONCAT ( COALESCE ( name, '' ), COALESCE ( age, '' ) ) LIKE '%18%';
//        //  CONCAT(
//        //	IFNULL( `name`, '' ),
//        //	IFNULL( `age`, '' )
//        //	) LIKE '%#{val}%'
//
//        switch ("ORACLE") {
//            case "MYSQL":
//            case "DM":
//                for (int i = 0; tests.size() > i; i++) {
//                    SQL_START += SQL_MIDDLE.replace("#{VAL}", tests.get(i));
//                    SQL_START += tests.size() - 1 == i ? ")" : ",\n";
//                }
//                break;
//            case "SQLSERVER":
//                for (int i = 0; tests.size() > i; i++) {
//                    SQL_START += SQLSERVER_MIDDLE.replace("#{VAL}", tests.get(i));
//                    SQL_START += tests.size() - 1 == i ? ")" : ",\n";
//                }
//                break;
//            case "ORACLE":
//                SQL_START = "";
//                for (int i = 0; tests.size() > i; i++) {
//                    SQL_START += tests.get(i);
//                    SQL_START += tests.size() - 1 == i ? " " : "||";
//                }
//                break;
//        }
//
//        System.out.println(SQL_START + SQL_END);
    }


    public static void test1() {
        String ret = "{\"msg\":\"操作成功\",\"code\":200,\"data\":[{\"createBy\":\"hanzihang\",\"createTime\":\"2023-08-17 16:00:20\",\"updateBy\":null,\"updateTime\":null,\"remark\":\"数据库名\",\"dictCode\":226,\"dictSort\":1,\"dictLabel\":\"databaseName\",\"dictValue\":\"zkqy-call\",\"dictType\":\"mysql_connection_information\",\"cssClass\":null,\"listClass\":\"default\",\"isDefault\":\"N\",\"status\":\"0\",\"default\":false},{\"createBy\":\"hanzihang\",\"createTime\":\"2023-08-17 16:00:46\",\"updateBy\":null,\"updateTime\":null,\"remark\":\"数据库IP\",\"dictCode\":227,\"dictSort\":2,\"dictLabel\":\"databaseIp\",\"dictValue\":\"192.168.110.15\",\"dictType\":\"mysql_connection_information\",\"cssClass\":null,\"listClass\":\"default\",\"isDefault\":\"N\",\"status\":\"0\",\"default\":false},{\"createBy\":\"hanzihang\",\"createTime\":\"2023-08-17 16:01:41\",\"updateBy\":null,\"updateTime\":null,\"remark\":\"用户名\",\"dictCode\":228,\"dictSort\":3,\"dictLabel\":\"username\",\"dictValue\":\"root\",\"dictType\":\"mysql_connection_information\",\"cssClass\":null,\"listClass\":\"default\",\"isDefault\":\"N\",\"status\":\"0\",\"default\":false},{\"createBy\":\"hanzihang\",\"createTime\":\"2023-08-17 16:02:06\",\"updateBy\":null,\"updateTime\":null,\"remark\":\"密码\",\"dictCode\":229,\"dictSort\":4,\"dictLabel\":\"password\",\"dictValue\":\"zkqy8888\",\"dictType\":\"mysql_connection_information\",\"cssClass\":null,\"listClass\":\"default\",\"isDefault\":\"N\",\"status\":\"0\",\"default\":false},{\"createBy\":\"hanzihang\",\"createTime\":\"2023-08-17 16:02:38\",\"updateBy\":null,\"updateTime\":null,\"remark\":\"端口号\",\"dictCode\":230,\"dictSort\":5,\"dictLabel\":\"portNumber\",\"dictValue\":\"3306\",\"dictType\":\"mysql_connection_information\",\"cssClass\":null,\"listClass\":\"default\",\"isDefault\":\"N\",\"status\":\"0\",\"default\":false},{\"createBy\":\"hanzihang\",\"createTime\":\"2023-08-17 16:02:59\",\"updateBy\":null,\"updateTime\":null,\"remark\":\"数据库类型\",\"dictCode\":231,\"dictSort\":6,\"dictLabel\":\"databaseType\",\"dictValue\":\"mysql\",\"dictType\":\"mysql_connection_information\",\"cssClass\":null,\"listClass\":\"default\",\"isDefault\":\"N\",\"status\":\"0\",\"default\":false}]}";
        Map<String, List<Map<String, Object>>> asd = (Map<String, List<Map<String, Object>>>) JSON.parse(ret);


        List<String> asas = new ArrayList<>();

        asd.get("data").forEach(item -> {
            System.out.println(item);
        });

    }


    public static void test2(int i) {
        switch (i) {
            case 1:
            case 2:
                System.out.println("123");
                break;
            case 3:
                System.out.println("asdasd");
                break;
            default:
                System.out.println("xczxcz");
                break;
        }


    }


}
