美文网首页
四月三周技术复盘

四月三周技术复盘

作者: 剑道_7ffc | 来源:发表于2020-04-23 10:19 被阅读0次

sql的NULL和空字符串

类似于java的NULL和空字符串,NULL表示没有值,空字符串表示值为空字符串,完全不同的

SELECT NULL = NULL,NULL != NULL,NULL IS NULL,NULL IS NOT NULL FROM base_material LIMIT 1;
image.png

poi动态设置颜色

public class ExcelCellDynamicColor {
    private int col;//列数 从0开始
    private int startRow;//开始行数 从0开始
    //由内容来决定颜色 使用 HSSFColor 中的颜色
    private Map<String,Short> contentColorMap = new HashMap<>();
}
private static void setCellDynamicColor(HSSFWorkbook wb, ExcelCellDynamicColor cellDynamicColor){
    int sheetNum = wb.getNumberOfSheets();
    for (int i = 0; i < sheetNum; i++) {
        HSSFSheet sheet = wb.getSheetAt(i);
        int rows = sheet.getLastRowNum() + 1;
        for (int j = 0; j < rows; j++) {
            HSSFRow row = sheet.getRow(j);
            if (row == null)
                continue;

            HSSFCell cell = row.getCell(cellDynamicColor.getCol());
            //若单元格为空或行数小于开始行,则跳过
            if(cell == null || j < cellDynamicColor.getStartRow()){
                continue;
            }

            Short color = cellDynamicColor.getContentColorMap().get(cell.getStringCellValue());
            if(color != null){
                HSSFFont font = wb.createFont();
                HSSFCellStyle cellStyle = wb.createCellStyle();
                cellStyle.cloneStyleFrom(cell.getCellStyle());
                font.setColor(color);
                cellStyle.setFont(font);
                cell.setCellStyle(cellStyle);
            }
        }
    }
}

一次查询多种表现

可能的情况是多个服务提供者且每个服务提供者提供的服务是不一样的如类似于一下场景,测试有一台服务提供者,开发在本地启动下dubbo,从而有可能导致一次查询多种表现。

相关文章

网友评论

      本文标题:四月三周技术复盘

      本文链接:https://www.haomeiwen.com/subject/mqkoihtx.html