SystemDao.dql 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. -- [login]
  2. SELECT
  3. id, loginName, userName,
  4. companyId, deptId, userType,
  5. email, phonenumber, sex,
  6. avatar, status, delFlag,
  7. remark, postIds
  8. FROM $table$
  9. WHERE loginName = #{loginName} AND password = #{password};
  10. -- [queryLoginUsers]
  11. select a.id, a.companyId, a.deptId, a.loginName,
  12. a.userName, a.userType, a.email, a.phoneNumber,
  13. a.sex, a.avatar, a.status, a.delFlag,
  14. a.createBy, a.createTime, a.updateBy,
  15. a.updateTime, a.remark, a.postIds, b.deptName
  16. from $table1$ a
  17. left join $table2$ b on a.deptId = b.id
  18. -- trim prefix=WHERE prefixOverrides=AND|OR
  19. -- if deptId > 0
  20. and a.deptId = #{deptId}
  21. -- end
  22. -- if status >= 0
  23. and a.status = #{status}
  24. -- end
  25. -- isNotEmpty keyWord
  26. and (a.loginName LIKE #{Like:keyWord} or a.userName LIKE #{Like:keyWord})
  27. -- end
  28. -- isNotEmpty loginName
  29. and a.loginName LIKE #{Like:loginName}
  30. -- end
  31. -- isNotEmpty phone
  32. and a.phoneNumber LIKE #{Like:phoneNumber}
  33. -- end
  34. -- isNotEmpty beginTime
  35. and a.createTime >= #{beginTime}
  36. -- end
  37. -- isNotEmpty endTime
  38. and a.createTime <= #{endTime}
  39. -- end
  40. -- end
  41. -- isEmpty orderBy
  42. order by createTime desc
  43. -- else
  44. order by #{orderBy}
  45. -- end
  46. ;
  47. -- [getUserInfo]
  48. SELECT
  49. id, loginName, userName,
  50. companyId, deptId, userType,
  51. email, phonenumber, sex,
  52. avatar, status, delFlag,
  53. remark, postIds
  54. FROM $table$
  55. WHERE id = #{id};
  56. -- [accountExists]
  57. SELECT count(id)
  58. FROM $table$
  59. WHERE loginName = #{loginName};
  60. -- [insertLoginUser]
  61. insert into $table$ (
  62. id, companyId, deptId,
  63. loginName, userName, userType,
  64. email, phonenumber, sex,
  65. avatar, password, salt,
  66. status, createBy,
  67. createTime, updateBy, updateTime,
  68. remark, postIds)
  69. values (
  70. #{id}, #{companyid}, #{deptid},
  71. #{loginname}, #{username}, #{usertype},
  72. #{email}, #{phonenumber}, #{sex},
  73. #{avatar}, #{password}, #{salt},
  74. #{status}, #{createby},
  75. #{createtime}, #{updateby}, #{updatetime},
  76. #{remark}, #{postids}
  77. );
  78. -- [insertUserRole]
  79. insert into $table$ (userId, roleId)
  80. VALUES (#{userid}, #{roleid});
  81. -- [clearUserRole]
  82. delete from $table$ where userId = #{userId};
  83. -- [updateLoginUser]
  84. update $table$ set
  85. deptId = #{deptid},
  86. userName = #{username},
  87. email = #{email},
  88. phonenumber = #{phonenumber},
  89. sex = #{sex},
  90. updateBy = #{updateby},
  91. updateTime = #{updatetime},
  92. remark = #{remark},
  93. postIds = #{postids}
  94. where id = #{id};
  95. -- [voidLoginUser]
  96. update $table$ set
  97. status = #{status}
  98. where id = #{id};
  99. -- [resetLoginUser]
  100. update $table$ set
  101. password = #{password}
  102. where id = #{id};
  103. -- [changeMyPassword]
  104. UPDATE $table$ SET
  105. password = #{password}
  106. WHERE id = #{id};
  107. -- [queryAllMenus]
  108. select *
  109. from $table$
  110. -- isEmpty orderBy
  111. order by parentId, sortNum
  112. -- else
  113. order by #{orderBy}
  114. -- end
  115. ;
  116. -- [queryAllRoles]
  117. select *
  118. from $table$
  119. -- trim prefix=WHERE prefixOverrides=AND|OR
  120. -- isNotEmpty roleName
  121. roleName LIKE #{Like:roleName}
  122. -- end
  123. -- if status >= 0
  124. and status = #{status}
  125. -- end
  126. -- end
  127. -- isEmpty orderBy
  128. order by sortNum
  129. -- else
  130. order by #{orderBy}
  131. -- end
  132. ;
  133. -- [insertRole]
  134. insert into $table$
  135. (id, roleName,
  136. sortNum, status, createBy,
  137. createTime, updateBy, updateTime,
  138. remark, systemFlag)
  139. VALUES (
  140. #{id}, #{rolename},
  141. #{sortnum}, #{status}, #{createby},
  142. #{createtime}, #{updateby}, #{updatetime},
  143. #{remark}, #{systemflag}
  144. );
  145. -- [updateRole]
  146. update $table$ set
  147. roleName = #{rolename},
  148. sortNum = #{sortnum},
  149. updateBy = #{updateby},
  150. updateTime = #{updatetime},
  151. remark = #{remark}
  152. where id = #{id};
  153. -- [voidRole]
  154. update $table$ set
  155. status = #{status}
  156. where id = #{id};
  157. -- [insertRoleMenu]
  158. insert into $table$ (roleId, menuId) VALUES (#{roleid}, #{menuid});
  159. -- [clearRoleMenu]
  160. delete from $table$ where roleId = #{roleId};
  161. -- [queryRoleMenus]
  162. select a.*, b.perms as menuperms, b.menuType, b.parentId from $table1$ a
  163. left join $table2$ b on a.menuId = b.id
  164. where a.roleId= #{roleId} and b.menuType in ('M', 'C');
  165. -- [queryRoleActions]
  166. select a.*, b.perms as menuperms, b.menuType, b.parentId from $table1$ a
  167. left join $table2$ b on a.menuId = b.id
  168. where a.roleId= #{roleId};
  169. -- [queryUserRoles]
  170. select userId,roleId from $table$ WHERE userId = #{userid};
  171. -- [queryMenuRoles]
  172. select b.id, b.roleName, b.roleKey, b.sortNum, b.remark
  173. from $table1$ a
  174. left join $table2$ b on a.roleId = b.id
  175. where a.menuId = #{menuId}
  176. order by b.sortNum;
  177. -- [queryRoleUsers]
  178. select b.id, b.companyId, b.deptId, b.loginName, b.userName, b.email, b.phonenumber, b.status
  179. from $table1$ a
  180. left join $table2$ b on a.userId = b.id
  181. where a.roleId = #{roleId}
  182. order by b.id;
  183. --[queryAllDepts]
  184. select * from $table$
  185. --[addDept]
  186. insert into $table$ (id, parentId, deptName, deptCode,
  187. sortNum, leader, phone,
  188. email, status, parentName,
  189. createBy, createTime, createTimeLong,
  190. updateBy, updateTime, updateTimeLong ) values ( #{id}, #{parentid}, #{deptname}, #{deptcode},
  191. #{sortnum}, #{leader}, #{phone},
  192. #{email}, #{status}, #{parentname},
  193. #{createby}, #{createtime},
  194. #{createtimelong}, #{updateby}, #{updatetime},
  195. #{updatetimelong} );
  196. -- [updateDept]
  197. update $table$ set parentId = #{parentid},deptName = #{deptname},deptCode = #{deptcode},sortNum = #{sortnum},
  198. leader = #{leader},phone = #{phone},email = #{email},status = #{status},
  199. parentName = #{parentname},
  200. updateBy = #{updateby},updateTime = #{updatetime},updateTimeLong = #{updatetimelong}
  201. where id = #{id};
  202. -- [voidDept]
  203. update $table$ set
  204. status = #{status},
  205. updateBy = #{updateby},
  206. updateTime = #{updatetime}
  207. where id=#{id};
  208. -- [insertMenu]
  209. insert into $table$
  210. (id, menuName, parentId,
  211. sortNum, url, menuType,
  212. visible, cacheFlag, perms, icon,
  213. createBy, createTime, updateBy,
  214. updateTime, remark,
  215. route, pathName,
  216. runKind, delphiPackage, delphiParams,
  217. delphiRunKind, delphiRunForm, delphiFormShow)
  218. values (
  219. #{id}, #{menuname}, #{parentid},
  220. #{sortnum}, #{url}, #{menutype},
  221. #{visible}, #{cacheflag}, #{perms}, #{icon},
  222. #{createby}, #{createtime}, #{updateby},
  223. #{updatetime}, #{remark},
  224. #{route}, #{pathname},
  225. #{runkind}, #{delphipackage}, #{delphiparams},
  226. #{delphirunkind}, #{delphirunform}, #{delphiformshow}
  227. );
  228. -- [updateMenu]
  229. update $table$ set
  230. menuName = #{menuname},
  231. parentId = #{parentid},
  232. sortNum = #{sortnum},
  233. url = #{url},
  234. menuType = #{menutype},
  235. perms = #{perms},
  236. icon = #{icon},
  237. updateBy = #{updateby},
  238. updateTime = #{updatetime},
  239. remark = #{remark},
  240. cacheFlag = #{cacheflag},
  241. route = #{route},
  242. pathName = #{pathname},
  243. runKind = #{runkind},
  244. delphiPackage = #{delphipackage},
  245. delphiParams = #{delphiparams},
  246. delphiRunKind = #{delphirunkind},
  247. delphiRunForm = #{delphirunform},
  248. delphiFormShow = #{delphiformshow}
  249. where id = #{id};
  250. -- [voidMenu]
  251. update $table$ set
  252. visible = #{visible},
  253. updateBy = #{updateby},
  254. updateTime = #{updatetime}
  255. where id = #{id};
  256. -- [insertERPFile]
  257. insert into $table$
  258. (idUser, userName, fileKind,
  259. srcFileName, fileDescription, downloadUrl,
  260. createBy, createTime, createTimeLong,
  261. updateBy, updateTime, updateTimeLong )
  262. values (#{iduser}, #{username}, #{filekind},
  263. #{srcfilename}, #{filedescription}, #{downloadurl},
  264. #{createby}, #{createtime}, #{createtimelong},
  265. #{updateby}, #{updatetime}, #{updatetimelong} );
  266. -- [queryAllConfig]
  267. select * from $table$;
  268. -- [queryConfig]
  269. select * from $table$
  270. where configKey = #{configKey};
  271. -- [insertConfigValue]
  272. insert into $table$
  273. (configKey, configName, configValue1,
  274. configValue2, configValue3, configType,
  275. remark)
  276. VALUES (
  277. #{configkey}, #{configname}, #{configvalue1},
  278. #{configvalue2}, #{configvalue3}, #{configtype},
  279. #{remark}
  280. );
  281. -- [updateConfigValue]
  282. update $table$ set
  283. configName = #{configname},
  284. configModule = #{configmodule},
  285. configValue1 = #{configvalue1},
  286. configValue2 = #{configvalue2},
  287. configValue3 = #{configvalue3},
  288. remark = #{remark}
  289. where configKey = #{configkey};
  290. -- [updateOnlyConfigValue]
  291. update $table$ set
  292. configValue1 = #{configvalue1}
  293. where configKey = #{configkey};
  294. -- [deleteConfigValue]
  295. delete from $table$
  296. where configKey = #{configkey};
  297. -- [queryDictTypes]
  298. select *
  299. from $table$
  300. -- trim prefix=WHERE prefixOverrides=AND|OR
  301. -- if voidFlag >= 0
  302. voidFlag = #{voidFlag}
  303. -- end
  304. -- isNotEmpty keyWord
  305. and (dictName LIKE #{Like:keyWord} or dictType LIKE #{Like:keyWord})
  306. -- end
  307. -- end
  308. -- isEmpty orderBy
  309. order by createTime desc
  310. -- else
  311. order by #{orderBy}
  312. -- end
  313. ;
  314. -- [addDictType]
  315. insert into $table$
  316. (id, dictName, dictType,
  317. voidFlag, remark, createBy,
  318. createTime, updateBy, updateTime)
  319. values (
  320. #{id}, #{dictname}, #{dicttype},
  321. #{voidflag}, #{remark}, #{createby},
  322. #{createtime}, #{updateby}, #{updatetime}
  323. );
  324. -- [updateDictType]
  325. update $table$ set
  326. dictName = #{dictname},
  327. dictType = #{dicttype},
  328. remark = #{remark},
  329. updateBy = #{updateby},
  330. updateTime = #{updatetime}
  331. where id = #{id};
  332. -- [voidDictType]
  333. update $table$ set
  334. voidFlag = #{voidflag},
  335. updateBy = #{updateby},
  336. updateTime = #{updatetime}
  337. where id = #{id};
  338. -- [queryDictDatas]
  339. select *
  340. from $table$
  341. -- trim prefix=WHERE prefixOverrides=AND|OR
  342. -- if idType >= 0
  343. idType = #{idType}
  344. -- end
  345. -- if voidFlag >= 0
  346. voidFlag = #{voidFlag}
  347. -- end
  348. -- isNotEmpty dictLabel
  349. and dictLabel LIKE #{Like:dictLabel}
  350. -- end
  351. -- end
  352. -- isEmpty orderBy
  353. order by sortNum desc
  354. -- else
  355. order by #{orderBy}
  356. -- end
  357. ;
  358. -- [addDictData]
  359. insert into $table$
  360. (id, idType, dictLabel,
  361. dictValue, sortNum, cssClass,
  362. listClass, voidFlag, remark,
  363. createBy, createTime, updateBy,
  364. updateTime)
  365. values (
  366. #{id}, #{idtype}, #{dictlabel},
  367. #{dictvalue}, #{sortnum}, #{cssclass},
  368. #{listclass}, #{voidflag}, #{remark},
  369. #{createby}, #{createtime}, #{updateby},
  370. #{updatetime}
  371. );
  372. -- [updateDictData]
  373. update $table$ set
  374. dictLabel = #{dictlabel},
  375. dictValue = #{dictvalue},
  376. sortNum = #{sortnum},
  377. cssClass = #{cssclass},
  378. listClass = #{listclass},
  379. remark = #{remark},
  380. updateBy = #{updateby},
  381. updateTime = #{updatetime}
  382. where id = #{id};
  383. -- [voidDictData]
  384. update $table$ set
  385. voidFlag = #{voidflag},
  386. updateBy = #{updateby},
  387. updateTime = #{updatetime}
  388. where id = #{id};
  389. -- [selectAllNoticeMessage]
  390. select * from $table$;
  391. -- [addNoticeMessage]
  392. insert into $table$ (
  393. id, messageCode, messageName, messageKind,
  394. voidFlag, createBy, createTime,
  395. createTimeLong, updateBy, updateTime,
  396. updateTimeLong )
  397. values (
  398. #{id}, #{messagecode}, #{messagename}, #{messagekind},
  399. #{voidflag}, #{createby}, #{createtime},
  400. #{createtimelong}, #{updateby}, #{updatetime},
  401. #{updatetimelong} );
  402. -- [updateNoticeMessage]
  403. update $table$ set
  404. messageName = #{messagename},
  405. messageKind = #{messagekind},
  406. updateBy = #{updateby},
  407. updateTime = #{updatetime},
  408. updateTimeLong = #{updatetimelong}
  409. where id = #{id};
  410. -- [voidNoticeMessage]
  411. update $table$ set
  412. voidFlag = #{voidflag},
  413. updateBy = #{updateby},
  414. updateTime = #{updatetime},
  415. updateTimeLong = #{updatetimelong}
  416. where id = #{id};
  417. -- [selectUserNoticeMessage]
  418. SELECT a.*, b.messageCode FROM $table1$ a
  419. LEFT JOIN $table2$ b ON a.idNoticeMessage = b.id;
  420. -- [addUserNoticeMessage]
  421. insert into $table$ (
  422. id, idUser,
  423. idNoticeMessage, createBy, createTime,
  424. createTimeLong, updateBy, updateTime,
  425. updateTimeLong )
  426. values (
  427. #{id}, #{iduser},
  428. #{idnoticemessage}, #{createby}, #{createtime},
  429. #{createtimelong}, #{updateby}, #{updatetime},
  430. #{updatetimelong} );
  431. -- [deleteNoticeMessage]
  432. delete from $table$ where idUser = #{iduser} and idNoticeMessage = #{idnoticemessage};
  433. -- [queryPersonConfigValue]
  434. select * from $table$;
  435. -- [addPersonConfigValue]
  436. insert into $table$ (
  437. idUser, configKey, configName,
  438. configValue1, configValue2, configValue3,
  439. createBy, createTime, createTimeLong,
  440. updateBy, updateTime, updateTimeLong )
  441. values (
  442. #{iduser}, #{configkey}, #{configname},
  443. #{configvalue1}, #{configvalue2}, #{configvalue3},
  444. #{createby}, #{createtime}, #{createtimelong},
  445. #{updateby}, #{updatetime}, #{updatetimelong} );
  446. -- [updatePersonConfigValue]
  447. update $table$ set
  448. configValue1 = #{configvalue1},
  449. configValue2 = #{configvalue2},
  450. configValue3 = #{configvalue3},
  451. updateBy = #{updateby},
  452. updateTime = #{updatetime},
  453. updateTimeLong = #{updatetimelong}
  454. where idUser = #{iduser} and configKey = #{configkey};
  455. -- [selectDataPurview]
  456. select * from $table$ order by idData, idUser, idCreateUser;
  457. -- [addDataPurview]
  458. insert into $table$ (
  459. idUser, userName, idCreateUser,
  460. createUserName, idData )
  461. values (
  462. #{iduser}, #{username}, #{idcreateuser},
  463. #{createusername}, #{iddata} );
  464. -- [deleteDataPurview]
  465. delete from $table$
  466. where idData = #{iddata} and idUser = #{iduser} and idCreateUser = #{idcreateuser};
  467. -- [insertTaskQueue]
  468. insert into $table$
  469. (userId, createTime, taskName,
  470. queryBeginDate, queryEndDate, queryContent,
  471. errorMsg, fileName, fileURL,
  472. webFileURL)
  473. values (
  474. #{userid}, #{createtime}, #{taskname},
  475. #{querybegindate}, #{queryenddate}, #{querycontent},
  476. #{errormsg}, #{filename}, #{fileurl},
  477. #{webfileurl}
  478. );
  479. -- [selectTaskQueue]
  480. select * from $table$
  481. where userId = #{userId}
  482. -- isNotEmpty beginTime
  483. and createTime >= #{beginTime}
  484. -- end
  485. -- isNotEmpty endTime
  486. and createTime <= #{endTime}
  487. -- end
  488. order by createTime desc;
  489. -- [insertPageTableColumn]
  490. insert into $table$ (
  491. idUser, pageName, columnName,
  492. columnTitle, columnWidth, columnIndex)
  493. values (
  494. #{iduser}, #{pagename}, #{columnname},
  495. #{columntitle}, #{columnwidth}, #{columnindex});
  496. -- [deletePageTableColumn]
  497. delete from $table$
  498. where idUser = #{idUser} and pageName = #{pageName};
  499. -- [selectPageTableColumn]
  500. select * from $table$
  501. where idUser = #{idUser} and pageName = #{pageName}
  502. order by columnindex;
  503. -- [insertAnnouncement]
  504. insert into $table$ (id, idAnnouncementType, announcementType, announcementTitle,
  505. announcementState, voidFlag, idReleaseMan,
  506. releaseMan, releaseDate,
  507. createMan, createBy,
  508. createTime, updateBy,
  509. updateTime ) values ( #{id}, #{idannouncementtype}, #{announcementtype}, #{announcementtitle},
  510. #{announcementstate}, #{voidflag}, #{idreleaseman},
  511. #{releaseman}, #{releasedate},
  512. #{createman}, #{createby},
  513. #{createtime}, #{updateby},
  514. #{updatetime} );
  515. -- [updateAnnouncement]
  516. update $table$ set idAnnouncementType = #{idannouncementtype},announcementType = #{announcementtype},announcementTitle = #{announcementtitle},announcementState = #{announcementstate},
  517. voidFlag = #{voidflag},idReleaseMan = #{idreleaseman},releaseMan = #{releaseman},releaseDate = #{releasedate},
  518. createMan = #{createman},createBy = #{createby},
  519. createTime = #{createtime},updateBy = #{updateby},updateTime = #{updatetime} where id = #{id};
  520. -- [voidAnnouncement]
  521. update $table$ set
  522. voidFlag = #{voidflag},
  523. updateBy = #{updateby},
  524. updateTime = #{updatetime}
  525. where id = #{id};
  526. -- [insertAnnouncementAttachment]
  527. insert into $table$ (id, idAnnouncement, idUser, userName,
  528. originName, srcFileName, fileDescription,
  529. attachmentUrl, downloadUrl, sortNum,
  530. createBy, createTime,
  531. updateBy, updateTime ) values ( #{id}, #{idannouncement}, #{iduser}, #{username},
  532. #{originname}, #{srcfilename}, #{filedescription},
  533. #{attachmenturl}, #{downloadurl}, #{sortnum},
  534. #{createby}, #{createtime},
  535. #{updateby}, #{updatetime} );
  536. -- [deleteAnnouncementAttachment]
  537. delete from $table$ where id = #{id};