改成如下计时
/**
* 更新角色
*
* @param data
* @return
*/
@Override
public int update(Role data) {
long temp = System.currentTimeMillis();
List<String> ids = new ArrayList<>();
if (data != null && data.getMenuIds() != null) {
if (Strings.isNotBlank(data.getMenuIds())) {
ids = Arrays.asList(data.getMenuIds().split(","));
}
//清除已有关系
Role tmpData = this.fetch(data.getId());
this.fetchLinks(tmpData, "menus");
System.out.println("查询关系耗时:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
dao().clearLinks(tmpData, "menus");
System.out.println("清除关系耗时:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
}
if (ids != null && ids.size() > 0) {
Criteria cri = Cnd.cri();
cri.where().andInStrList("id", ids);
List<Menu> menuList = menuService.query(cri);
data.setMenus(menuList);
}
int count = dao().update(data);
System.out.println("更新耗时:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
dao().insertRelation(data, "menus");
System.out.println("多对多插入耗时:" + (System.currentTimeMillis() - temp) / 1000.0 + "秒");
return count;
}
日志
[DEBUG] 23:10:29.430 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - SELECT * FROM sys_role WHERE id=?
| 1 |
|---|
| 1 |
For example:> "SELECT * FROM sys_role WHERE id='1'"
[DEBUG] 23:10:29.511 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - SELECT * FROM sys_menu WHERE id IN (SELECT menu_id FROM sys_role_menu WHERE role_id='1')
查询关系耗时:0.39秒
[DEBUG] 23:10:29.756 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - DELETE FROM sys_role_menu WHERE role_id=?
| 1 |
|---|
| 1 |
For example:> "DELETE FROM sys_role_menu WHERE role_id='1'"
清除关系耗时:0.558秒
[DEBUG] 23:10:29.924 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - SELECT * FROM sys_menu WHERE id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
| 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 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 |
|---|-----|------|------|------|------|------|------|------|-----|------|------|------|------|------|-----|------|------|------|------|-----|------|------|------|------|-----|------|------|------|------|------|-----|------|------|------|------|------|-----|------|------|------|------|------|-----|------|------|------|------|------|------|------|------|------|---|-----|------|------|------|-----|-----|-----|-----|------|------|------|------|-----|------|------|------|-----|------|------|------|------|------|------|------|---|-----|-----|------|------|----------------------------------|-----|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
| 1 | 100 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 101 | 1007 | 1008 | 1009 | 1010 | 1011 | 102 | 1012 | 1013 | 1014 | 1015 | 103 | 1016 | 1017 | 1018 | 1019 | 104 | 1020 | 1021 | 1022 | 1023 | 1024 | 105 | 1025 | 1026 | 1027 | 1028 | 1029 | 106 | 1030 | 1031 | 1032 | 1033 | 1034 | 107 | 1035 | 1036 | 1037 | 1038 | 1062 | 1058 | 1059 | 1060 | 1061 | 2 | 109 | 1046 | 1047 | 1048 | 111 | 112 | 108 | 500 | 1039 | 1040 | 1041 | 1042 | 501 | 1043 | 1044 | 1045 | 110 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 3 | 113 | 114 | 1056 | 1057 | f0f04abcf24c4dd7ac641e02b799ed26 | 115 | 9ac78f629dc74ac5877b42c73a6d4f26 | 6bma11idlign1rrh3ngann4acf | 5b7v0dvpjaj72rhd4qs2dbtdnk | o7b4o036ikhk0q379oud2slpnp | o9dfvt08mog8nrdkqssa3s4qf4 | v83ul82ckkhgeops80fr1jmhob | q6s0e7l6dcjfmpt23h9s865rqb | 1r820fevh4j08rmv45a7jn5qki | 4sjsbjul38g3nod9jtqlnig8mv | umkbsmd5dmgh9rb1008krur527 | 1c46vji8nqgrlqa7ul078eufjt | 3n1cgh99rkg1ronbe4kg6fukk4 | 6jjag243ocir0qkn0l3fn6npq6 | 64ab927r2uhjtrkqpdr7if07q9 | 5qnj96g24kj9uq49fq3ah8fn53 | 4pv1d855iaj9irer5i8no4n61k | 7bd0844c03214140a403dda2989d54f7 | 7d14fm1jkgijtovnkge18or2r6 | tleoggeth8jear08rs25amdtp1 | 3575kpm4gei4ipdh4mn4peg2ct | 12n0a34518g8urdjo6kp83h5uj | 2epqeqpe5qhp0qahik42q9djah | 0a87d161daac4a9888f8099fd76f1b3f | q61dd1i21oji0oe2891gbn37up | 3le6nsatrugpkos20g28ai8b69 | 7jb3d4916sg0frop9kv87mbpl7 | 7tfveg4u38inkpjdoo8v2iki4s | tos8ndvbpch8ar2v3dsc9i9vg9 | 1j89195vskigvq3rn8mbgkjh90 | 3gl7pjf07ein3prthkop8d750i | 5aseet8o8gib9qubvs89rrfj1h | 9330ba38665c4a159caac6d1486ab5db | 6ed0a1gq9kjgcosasoc9mssjjl | 5h7f9jij8ihj3or1ob998a3anv | qthuim6k4iitbofo7bt5g4qg18 | tvk7unn4kag6bq1rf934s4bdup | svlm09jl0uht3q5mbufqbll2e8 | pghhitpl6ggtlr41diks66p866 | 54lcuavlhsj6fr2g3l41pgo9bd | 2iv74vdr1agblpvb788jq8p7f1 | 2l0e6c7u7ujdtq8ur10h024r1u | 5p44arhgt2jnlqn223tgq2m52c | r2n92hqb0oggtr0341vv26vbgm | 492jd520kgjihq08ocudhlq9bv | 51jmfrvdlqgcgrl8oc4au4h0fv | rc2rrv9tschkirvgfqh69vvauc | qm54hhl7j4g1erj88g73mp2ppb | 60ersd6vpoidkp4gv40n2s7jjn | 0lbjdh88l8iikq1fgpklqni0l8 | 3e1f3ppbokignqto15v5r7ttsi | 4g8teujrv8grso1l5k88sns7s2 | u4lpo7g7ggiheqo4spi29ugnlr | 68v91uegdogb4ru5hm0r7s7qrj | rfk3bimknqi16otkkqs3tqmm1k | sgsom751oehdnpa7igg93g4sjt | ra5mf1r3riiscr03bvusphb40j | u5vjqqhjbug88ocgomerrbbm9v | 5600a78200f94f70b535435fb1b203b9 | va83bir9uug66o4k69jpa2vl95 | 7horolt59mirrqghb93q5ctlgn | okoub0ppnkhulrmuoqavf29d5b | 4st91blc26hrcqikhrq50u37nm | osnggmduaaghlocr041n3o09um | o7tojb8h5ghrnqqg4tbfna2741 | tal5v9m3euj1grb3eir4v5pvvc | r9s214ssf4jujp3th76iolbuj8 | s97a8rrm8kiu5pnd9cd7rhqoqe | 11o9i9vl4uj2eo8jh2d1tl3cce | ts241dai36ghor3ovhqlc3666p | tbfimh7s4miovqkibvkv1ek86f | pn7k60ic8ki8kolo6bl1tulkcs | vp6p4d1qogjnnr7cn37oo1spdp | oprmgrqna2htop2fqncubvgta9 | 3u29oqn2t0hehpk02kfot4pckn | 6gusof3bb8jtnqvab7tsu8c36l | 7sf6ghnj5ui7cpol0537g1dvdu | ttq3i28g58iplrdadlhepig5c4 | 61uc8oa2r6g2fobhkp7c55nl83 | vttben96c0j34phnphk0qrelur | o7j7bbsa5sg3fo00f7vsffc330 | 3h0knh6pk8gr7rqvq8sv7cmot9 | 5e2p0s8154graonljvvrs448kd | 1vpiuv1mp2h9sq82oqe2gd9rb2 | 4ac3124738cd4c4785b724565085c67f | 4ke8dbv8f4gn9pc41ca4i8lcvd | 72kf7rb8u6jpiod33sk3bba91p | tq7apgvlrsh9qqh1vk5io7l56g | 5rvg4jmueoibipa0r9a4fh3ssh | 6qva1mqdschefq0o0aptgtiuir | r3kpc2vjhmj1ro4umbo7drlt52 | o6gvjvqiachflrv3531sle5ldv | 54lfvhinfkga8o4l0c28v4qad9 | 03kfor3dvehdlq17hdfigknqph | ve684vr1gigbiqh47e9q4ij5c9 | 3rt1tho672i8ir5vc8qtnsiuf0 | t0g6gbsb94h91o1bve7fsnv32p | 2bqlc9olu0hpfo68o8tdtia1ig | 1ampbnarqkjpoq70hlbeclct4q | 61f87s86c8g0vrh8d828iss5mn | c3e3cf297da54e79bd39ac830e71cc9c | r7dn7vtt6ijnjoa1skrl92813s | 3rgilj80fij8doss33dia8lu9p | p40tchvtb2grspfk4qk8p8uq9e | 2gdna2sukmhbfp13hefq5m8g2u | vh19b4allih9robpum35nn6nrb | 1pjehh0ommircp16nha12sd3cn | 521umdt77ih49ooasds0j5pp0s | 1cq8o9bk80hhroredt81gt33ni | 36t5gvd2cahbpqju6l3cfesden | 51mohi030sh8po9ldaja8fc1i6 | 2ddcnjhs1eiibq6vl8qv032v7l | p429h48hpaj6or6teqppamphqv | pkst6ju6g4i2uooe708mvm7jg6 | 75io6mf954gjjq1777m3ugmdkj | 08ilmc4qcigo6rcd4dsvse6vrl |
For example:> "SELECT * FROM sys_menu WHERE id IN ('1','100','1000','1001','1002','1003','1004','1005','1006','101','1007','1008','1009','1010','1011','102','1012','1013','1014','1015','103','1016','1017','1018','1019','104','1020','1021','1022','1023','1024','105','1025','1026','1027','1028','1029','106','1030','1031','1032','1033','1034','107','1035','1036','1037','1038','1062','1058','1059','1060','1061','2','109','1046','1047','1048','111','112','108','500','1039','1040','1041','1042','501','1043','1044','1045','110','1049','1050','1051','1052','1053','1054','1055','3','113','114','1056','1057','f0f04abcf24c4dd7ac641e02b799ed26','115','9ac78f629dc74ac5877b42c73a6d4f26','6bma11idlign1rrh3ngann4acf','5b7v0dvpjaj72rhd4qs2dbtdnk','o7b4o036ikhk0q379oud2slpnp','o9dfvt08mog8nrdkqssa3s4qf4','v83ul82ckkhgeops80fr1jmhob','q6s0e7l6dcjfmpt23h9s865rqb','1r820fevh4j08rmv45a7jn5qki','4sjsbjul38g3nod9jtqlnig8mv','umkbsmd5dmgh9rb1008krur527','1c46vji8nqgrlqa7ul078eufjt','3n1cgh99rkg1ronbe4kg6fukk4','6jjag243ocir0qkn0l3fn6npq6','64ab927r2uhjtrkqpdr7if07q9','5qnj96g24kj9uq49fq3ah8fn53','4pv1d855iaj9irer5i8no4n61k','7bd0844c03214140a403dda2989d54f7','7d14fm1jkgijtovnkge18or2r6','tleoggeth8jear08rs25amdtp1','3575kpm4gei4ipdh4mn4peg2ct','12n0a34518g8urdjo6kp83h5uj','2epqeqpe5qhp0qahik42q9djah','0a87d161daac4a9888f8099fd76f1b3f','q61dd1i21oji0oe2891gbn37up','3le6nsatrugpkos20g28ai8b69','7jb3d4916sg0frop9kv87mbpl7','7tfveg4u38inkpjdoo8v2iki4s','tos8ndvbpch8ar2v3dsc9i9vg9','1j89195vskigvq3rn8mbgkjh90','3gl7pjf07ein3prthkop8d750i','5aseet8o8gib9qubvs89rrfj1h','9330ba38665c4a159caac6d1486ab5db','6ed0a1gq9kjgcosasoc9mssjjl','5h7f9jij8ihj3or1ob998a3anv','qthuim6k4iitbofo7bt5g4qg18','tvk7unn4kag6bq1rf934s4bdup','svlm09jl0uht3q5mbufqbll2e8','pghhitpl6ggtlr41diks66p866','54lcuavlhsj6fr2g3l41pgo9bd','2iv74vdr1agblpvb788jq8p7f1','2l0e6c7u7ujdtq8ur10h024r1u','5p44arhgt2jnlqn223tgq2m52c','r2n92hqb0oggtr0341vv26vbgm','492jd520kgjihq08ocudhlq9bv','51jmfrvdlqgcgrl8oc4au4h0fv','rc2rrv9tschkirvgfqh69vvauc','qm54hhl7j4g1erj88g73mp2ppb','60ersd6vpoidkp4gv40n2s7jjn','0lbjdh88l8iikq1fgpklqni0l8','3e1f3ppbokignqto15v5r7ttsi','4g8teujrv8grso1l5k88sns7s2','u4lpo7g7ggiheqo4spi29ugnlr','68v91uegdogb4ru5hm0r7s7qrj','rfk3bimknqi16otkkqs3tqmm1k','sgsom751oehdnpa7igg93g4sjt','ra5mf1r3riiscr03bvusphb40j','u5vjqqhjbug88ocgomerrbbm9v','5600a78200f94f70b535435fb1b203b9','va83bir9uug66o4k69jpa2vl95','7horolt59mirrqghb93q5ctlgn','okoub0ppnkhulrmuoqavf29d5b','4st91blc26hrcqikhrq50u37nm','osnggmduaaghlocr041n3o09um','o7tojb8h5ghrnqqg4tbfna2741','tal5v9m3euj1grb3eir4v5pvvc','r9s214ssf4jujp3th76iolbuj8','s97a8rrm8kiu5pnd9cd7rhqoqe','11o9i9vl4uj2eo8jh2d1tl3cce','ts241dai36ghor3ovhqlc3666p','tbfimh7s4miovqkibvkv1ek86f','pn7k60ic8ki8kolo6bl1tulkcs','vp6p4d1qogjnnr7cn37oo1spdp','oprmgrqna2htop2fqncubvgta9','3u29oqn2t0hehpk02kfot4pckn','6gusof3bb8jtnqvab7tsu8c36l','7sf6ghnj5ui7cpol0537g1dvdu','ttq3i28g58iplrdadlhepig5c4','61uc8oa2r6g2fobhkp7c55nl83','vttben96c0j34phnphk0qrelur','o7j7bbsa5sg3fo00f7vsffc330','3h0knh6pk8gr7rqvq8sv7cmot9','5e2p0s8154graonljvvrs448kd','1vpiuv1mp2h9sq82oqe2gd9rb2','4ac3124738cd4c4785b724565085c67f','4ke8dbv8f4gn9pc41ca4i8lcvd','72kf7rb8u6jpiod33sk3bba91p','tq7apgvlrsh9qqh1vk5io7l56g','5rvg4jmueoibipa0r9a4fh3ssh','6qva1mqdschefq0o0aptgtiuir','r3kpc2vjhmj1ro4umbo7drlt52','o6gvjvqiachflrv3531sle5ldv','54lfvhinfkga8o4l0c28v4qad9','03kfor3dvehdlq17hdfigknqph','ve684vr1gigbiqh47e9q4ij5c9','3rt1tho672i8ir5vc8qtnsiuf0','t0g6gbsb94h91o1bve7fsnv32p','2bqlc9olu0hpfo68o8tdtia1ig','1ampbnarqkjpoq70hlbeclct4q','61f87s86c8g0vrh8d828iss5mn','c3e3cf297da54e79bd39ac830e71cc9c','r7dn7vtt6ijnjoa1skrl92813s','3rgilj80fij8doss33dia8lu9p','p40tchvtb2grspfk4qk8p8uq9e','2gdna2sukmhbfp13hefq5m8g2u','vh19b4allih9robpum35nn6nrb','1pjehh0ommircp16nha12sd3cn','521umdt77ih49ooasds0j5pp0s','1cq8o9bk80hhroredt81gt33ni','36t5gvd2cahbpqju6l3cfesden','51mohi030sh8po9ldaja8fc1i6','2ddcnjhs1eiibq6vl8qv032v7l','p429h48hpaj6or6teqppamphqv','pkst6ju6g4i2uooe708mvm7jg6','75io6mf954gjjq1777m3ugmdkj','08ilmc4qcigo6rcd4dsvse6vrl')"
[DEBUG] 23:10:30.014 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - UPDATE sys_role SET role_name=?,role_key=?,role_sort=?,data_scope=?,status=?,del_flag=?,remark=?,create_by=?,create_time=?,update_by=?,update_time=? WHERE id=?
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|-----|-------|---|------|-------|-------|-----|------|------|---|---------------------|---|
| 管理员 | admin | 1 | NULL | false | false | 管理员 | NULL | NULL | 1 | 2020-03-19 23:10:29 | 1 |
For example:> "UPDATE sys_role SET role_name='管理员',role_key='admin',role_sort='1',data_scope=NULL,status=false,del_flag=false,remark='管理员',create_by=NULL,create_time=NULL,update_by='1',update_time='2020-03-19 23:10:29' WHERE id='1'"
更新耗时:0.815秒
[DEBUG] 23:10:30.185 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - INSERT INTO sys_role_menu(role_id,menu_id) VALUES(?,?)
| 1 | 2 |
|---|----------------------------------|
| 1 | 03kfor3dvehdlq17hdfigknqph |
| 1 | 08ilmc4qcigo6rcd4dsvse6vrl |
| 1 | 0a87d161daac4a9888f8099fd76f1b3f |
| 1 | 0lbjdh88l8iikq1fgpklqni0l8 |
| 1 | 1 |
| 1 | 100 |
| 1 | 1000 |
| 1 | 1001 |
| 1 | 1002 |
| 1 | 1003 |
-- Only display first 10 lines , don't show the remaining record(count=200)
For example:> "INSERT INTO sys_role_menu(role_id,menu_id) VALUES('1','03kfor3dvehdlq17hdfigknqph') "
多对多插入耗时:17.381秒
[DEBUG] 23:10:46.744 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'slogService'<class org.nutz.plugins.slog.service.SlogService>