[jeeplus] 使用笔记 (gridSelect、datetimepicker etc.)
本贴最后更新于 1919 天前,其中的信息可能已经时过境迁
相关帖子
请输入回帖内容
...
-
PeterChu •作者
java 中 字符串的 slipt() 方法
- slipt() 方法会在分割完成后,对获取到的数组从末端开始验证是否为"",若 true 则,数组长度 -1 ,直到遇到一个不为"" 的元素。
- 此时,在这个不为 "" 的元素之前的所有其他 "" 元素依旧保留。(未验证数组起始端的 "" 是否验证排除)
- 不知道从 1.5 开始到现在最新版本,该方法是否发生变化。
public static void main(String[] args) { String s = ""; String[] ss = s.split(","); System.out.println(ss.length);//1 System.out.println(Arrays.toString(ss));//[] System.out.println(ss == null);//false System.out.println(ss[0] == null);//false String s1 = "123-123.2-1--"; String[] ss1 = s1.split("-"); System.out.println(ss1.length);//3 System.out.println(Arrays.toString(ss1));//[123, 123.2, 1] String s2 = "123--123.2-1--"; String[] ss2 = s2.split("-"); System.out.println(ss2.length);//4 System.out.println(Arrays.toString(ss2));//[123, , 123.2, 1] }
参考 :
https://blog.csdn.net/qq_27093465/article/details/549103231 操作PeterChu 在 2019-07-23 17:00:37 更新了该回帖 - 其他回帖
-
PeterChu •作者
MySql 中根据 判断某个字段(字符串)的长度后 按不同情况更新 同一个字段的值 的方法:
UPDATE m_levelformajor SET type = ( CASE WHEN 1 < LENGTH(number) AND LENGTH(number) < 3 THEN "2" WHEN 3 < LENGTH(number) AND LENGTH(number) < 5 THEN "3" WHEN 6 <= LENGTH(number) THEN "4" WHEN number IS NULL THEN "1" ELSE "1" END ) UPDATE m_levelformajor SET type = ( CASE WHEN number IS NULL THEN "1" ELSE "1" END ) SELECT id,name, number, type, parent_id,parent_ids , LENGTH(number) FROM m_levelformajor SELECT id,name, number, type, parent_id,parent_ids , LENGTH(number) FROM m_levelformajor WHERE LENGTH(number) <5 AND LENGTH(number) > 3 SELECT id,name, number, type, parent_id,parent_ids , LENGTH(number) FROM m_levelformajor WHERE 1 < LENGTH(number) AND LENGTH(number) <3 SELECT id,name, number, type, parent_id,parent_ids , LENGTH(number) FROM m_levelformajor WHERE LENGTH(number) <1```
-
PeterChu • • 1 评论作者
Mysql 中对一个表中的字段进行汇总计算后 赋值给 其中一个字段
如:招生计划表中,按照年份、省份、批次、文理科、学校 分组汇总后,将各专业招生计划数汇总后,赋值给该校该年度该批次该省份该文理科中的 招生计划总数。
查询语句:
SELECT COUNT(zhaoshengjihua) AS jihuazongshu, zhaoshengjihuazongshu, shengfen, nianfen, wenlike, pici, daxuedaima, daxuemingcheng FROM d_zhaoshengjihuabiao GROUP BY shengfen, nianfen, wenlike, pici, daxuedaima;
*zhaoshengjihuazongshu 字段中已经被赋值了,原来该字段中的值为空最开始写出的 sql 如下,但是完全不正确。
UPDATE d_zhaoshengjihuabiao a SET a.zhaoshengjihuazongshu = ( SELECT COUNT(b.zhaoshengjihua) AS b.cou, b.shengfen, b.nianfen, b.wenlike, b.pici, b.daxuedaima FROM d_zhaoshengjihuabiao b GROUP BY b.shengfen, b.nianfen, b.wenlike, b.pici, b.daxuedaima ) WHERE b.shengfen = a.shengfen AND b.nianfen = a.nianfen AND b.wenlike = a.wenlike AND b.pici = a.pici AND b.daxuedaima = a.daxuedaima
在网上搜索后,看到如下 2 条 sql 做为参考:
-- 1 UPDATE au_window_re_project aw SET aw.project_name = ( SELECT ap.SERVICENAME FROM apas_service ap WHERE ap.unid = aw.PROJECT_ID ) -- 2 UPDATE test_user_points AS a LEFT JOIN ( SELECT user_id, sum(point) AS point_count FROM test_point_log GROUP BY user_id ) AS b ON a.user_id = b.user_id SET a.point_count = b.point_count
最终参考第 2 条 SQL 写出如下语句,可以实现要求:
UPDATE d_zhaoshengjihuabiao AS a LEFT JOIN ( SELECT COUNT(zhaoshengjihua) AS cou, shengfen, nianfen, wenlike, pici, daxuedaima FROM d_zhaoshengjihuabiao GROUP BY shengfen, nianfen, wenlike, pici, daxuedaima ) AS b ON ( a.shengfen = b.shengfen AND a.wenlike = b.wenlike AND a.nianfen = b.nianfen AND a.pici = b.pici AND a.daxuedaima = b.daxuedaima ) SET a.zhaoshengjihuazongshu = b.cou ;
最开始的 SQL 还不知道错在了哪里,应该是用子查询实现的呀PeterChu • -
PeterChu •作者
为 jp 工具添加自定义方法,实现 js 的 unicode 编码
在 jeeplus.js 中的添加方法
(function(){ jp = { /** 实现 unicode 编码 */ toUnicode : function (s) { var str = ""; for (var i = 0; i < s.length; i++) { str +="\\u"+('0000' + s.charCodeAt(i).toString(16)).slice(-4)+""; } return str; }, } })(jQuery);
实现效果:
需要注意的是:
"\u0061\u0062\u0063"
中间需要转义字符:
"\\u0061\\u0062\\u0063"
- 查看全部回帖