2020.7.1总结

    技术2022-07-11  125

    前端知识:

    API: 判断是否为空: $.common.isEmpty()

    modal框: $.common.alertError()

    弹层组件:layer layer.open({ title:false, type:1, closeBth:true, shadeClose:true,//阴影区域关闭 area:[‘auto’,‘atuo’]//宽,高 })

    以下是一些参数截图:

    layer组件:web弹层组件,详情可见:layer组件

    后端知识:

    StringAPI:

    ***substring()*** substring(a,b) 表示截取从第a个开始,截取到b-1个字符串,包头不包尾 substring(a) 表示返回第a个字符串之后的所有字符串。 **lastIndexOf()** 从右到左查询一串字符串中指定字符串的最后一个的位置 **indexOf()** 从左到右查询一串字符串中指定字符串的第一个出现的位置

    注:1.以上两个函数不管从左还是从右,索引都是从左开始为0… 2.以上两个函数通常都是和substring搭配使用

    例如: xxx.substring(xxx.lastIndexOf("/") + 1,xxx.Index.of("."))

    以下是写代码时需要注意的一些小点:

    字符串和对象比较常用的写法,这样写的好处是可以避免当对象为null时,报空指针异常。

    这里飘黄报:pngPath在这个位置只能是null 因为双与,两者都要满足true,前面为null,后面等式中的pngPath必然是null,应该改为或:||

    以下是tif图转png图代码:

    // tif转换png RenderedOp ro = JAI.create("fileload", tifPath); try { outputStream = new FileOutputStream(pngFilePath); PNGEncodeParam param = new PNGEncodeParam.RGB(); imageEncoder = ImageCodec.createImageEncoder("PNG", outputStream, param); imageEncoder.encode(ro); outputStream.flush(); outputStream.close(); } catch (Exception e) { e.printStackTrace(); }finally { if(outputStream != null) { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } }

    遇到的异常: java.lang.IllegalStateException: Optional int parameter ‘ids’ is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type. 参数异常:ids不存在 原因: 前台传递的参数是ids,后台接受的是id,改成ids即可。

    Processed: 0.018, SQL: 9