@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cutejava-front",
|
"name": "cutejava-front",
|
||||||
"version": "1.4.1",
|
"version": "1.5.0",
|
||||||
"description": "CuteJava 前端源码",
|
"description": "CuteJava 前端源码",
|
||||||
"author": "Odboy",
|
"author": "Odboy",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"@riophae/vue-treeselect": "^0.4.0",
|
"@riophae/vue-treeselect": "^0.4.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^1.0.2",
|
"@wangeditor/editor-for-vue": "^1.0.2",
|
||||||
"axios": "1.8.2",
|
"axios": "1.12.0",
|
||||||
"clipboard": "2.0.4",
|
"clipboard": "2.0.4",
|
||||||
"codemirror": "^5.49.2",
|
"codemirror": "^5.49.2",
|
||||||
"core-js": "^2.6.12",
|
"core-js": "^2.6.12",
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ export function login(username, password, code, uuid) {
|
|||||||
|
|
||||||
export function getInfo() {
|
export function getInfo() {
|
||||||
return request({
|
return request({
|
||||||
url: 'auth/info',
|
url: 'api/user/getCurrentUserInfo',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCodeImg() {
|
export function getCodeImg() {
|
||||||
return request({
|
return request({
|
||||||
url: 'auth/captcha/getImage',
|
url: 'captcha/getCode',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function sendResetEmailCaptcha(email) {
|
export function sendResetEmailCode(email) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/captcha/sendResetEmailCaptcha?email=' + email,
|
url: 'api/captcha/sendResetEmailCode?email=' + email,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendResetPasswordCaptcha(email) {
|
export function sendResetPasswordCode(email) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/captcha/sendResetPasswordCaptcha?email=' + email,
|
url: 'api/captcha/sendResetPasswordCode?email=' + email,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkEmailCaptcha(email, code, bizCode) {
|
export function verifyCode(email, code, bizCode) {
|
||||||
const params = {
|
const params = {
|
||||||
email: email,
|
email: email,
|
||||||
code: code,
|
code: code,
|
||||||
bizCode: bizCode
|
bizCode: bizCode
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: 'api/captcha/checkEmailCaptcha',
|
url: 'api/captcha/verifyCode',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function queryDeptSelectDataSource() {
|
export function listDeptSelectDataSource() {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/component/queryDeptSelectDataSource',
|
url: 'api/component/listDeptSelectDataSource',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryDeptSelectProDataSource() {
|
export function listDeptSelectProDataSource() {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/component/queryDeptSelectProDataSource',
|
url: 'api/component/listDeptSelectProDataSource',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,8 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function queryDeptList(params) {
|
/**
|
||||||
return request({
|
* 默认入口:add、del、edit、get
|
||||||
url: 'api/dept',
|
*/
|
||||||
method: 'post',
|
|
||||||
data: params
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function queryDeptSuperiorTree(ids, exclude) {
|
|
||||||
exclude = exclude !== undefined ? exclude : false
|
|
||||||
const data = Array.isArray(ids) ? ids : [ids]
|
|
||||||
return request({
|
|
||||||
url: 'api/dept/queryDeptSuperiorTree?exclude=' + exclude,
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dept/saveDept',
|
url: 'api/dept/saveDept',
|
||||||
@@ -28,7 +13,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dept/removeDeptByIds',
|
url: 'api/dept/deleteDeptByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -36,10 +21,28 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dept/modifyDept',
|
url: 'api/dept/updateDeptById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, queryDeptList, queryDeptSuperiorTree }
|
export function searchDept(params) {
|
||||||
|
return request({
|
||||||
|
url: 'api/dept/searchDept',
|
||||||
|
method: 'post',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function searchDeptTree(ids, exclude) {
|
||||||
|
exclude = exclude !== undefined ? exclude : false
|
||||||
|
const data = Array.isArray(ids) ? ids : [ids]
|
||||||
|
return request({
|
||||||
|
url: 'api/dept/searchDeptTree?exclude=' + exclude,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, searchDept, searchDeptTree }
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dict/saveDict',
|
url: 'api/dict/saveDict',
|
||||||
@@ -10,7 +12,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dict/removeDictByIds',
|
url: 'api/dict/deleteDictByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -18,18 +20,18 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dict/modifyDictById',
|
url: 'api/dict/updateDictById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryPageDict(data) {
|
export function searchDict(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dict',
|
url: 'api/dict/searchDict',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, queryPageDict }
|
export default { add, edit, del, searchDict }
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
export function get(dictName) {
|
export function get(dictName) {
|
||||||
const params = {
|
const params = {
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -9,7 +11,7 @@ export function get(dictName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail/queryDictDetailByArgs',
|
url: 'api/dictDetail/searchDictDetail',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
@@ -25,7 +27,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(id) {
|
export function del(id) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail/removeDictDetailById',
|
url: 'api/dictDetail/deleteDictDetailById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: { id: id }
|
data: { id: id }
|
||||||
})
|
})
|
||||||
@@ -33,7 +35,7 @@ export function del(id) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail/modifyDictDetailById',
|
url: 'api/dictDetail/updateDictDetailById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ export function getLastEmailConfig() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modifyEmailConfig(data) {
|
export function updateEmailConfigById(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/email/modifyEmailConfig',
|
url: 'api/email/updateEmailConfigById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendEmail(data) {
|
export function send(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/email/sendEmail',
|
url: 'api/email/send',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
export function queryAllEnableJob() {
|
* 默认入口:add、del、edit、get
|
||||||
const params = {
|
*/
|
||||||
page: 1,
|
|
||||||
size: 9999999,
|
|
||||||
args: {
|
|
||||||
enabled: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return request({
|
|
||||||
url: 'api/job/queryAllEnableJob',
|
|
||||||
method: 'post',
|
|
||||||
data: params
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/job/saveJob',
|
url: 'api/job/saveJob',
|
||||||
@@ -25,7 +12,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/job/removeJobByIds',
|
url: 'api/job/deleteJobByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -33,10 +20,24 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/job/modifyJobById',
|
url: 'api/job/updateJobById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function searchJob() {
|
||||||
|
const params = {
|
||||||
|
page: 1,
|
||||||
|
size: 9999999,
|
||||||
|
args: {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: 'api/job/searchJob',
|
||||||
|
method: 'post',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default { add, edit, del }
|
export default { add, edit, del }
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/localStorage/uploadFile',
|
url: 'api/localStorage/uploadFile',
|
||||||
@@ -10,7 +12,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/localStorage/removeFileByIds',
|
url: 'api/localStorage/deleteFileByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -18,7 +20,7 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/localStorage/modifyLocalStorageById',
|
url: 'api/localStorage/updateLocalStorageById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,42 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function queryMenuListByPid(pid) {
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/menu/queryMenuListByPid?pid=' + pid,
|
url: 'api/menu/saveMenu',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/menu/deleteMenuByIds',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/menu/updateMenuById',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listMenuByPid(pid) {
|
||||||
|
return request({
|
||||||
|
url: 'api/menu/listMenuByPid?pid=' + pid,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryMenuByArgs(params) {
|
export function searchMenu(params) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/menu/queryMenuByArgs',
|
url: 'api/menu/searchMenu',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
@@ -24,9 +51,9 @@ export function queryMenuSuperior(ids) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryChildMenuSet(id) {
|
export function listChildMenuSetByMenuId(id) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/menu/queryChildMenuSet?id=' + id,
|
url: 'api/menu/listChildMenuSetByMenuId?id=' + id,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -38,28 +65,4 @@ export function buildMenus() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function add(data) {
|
export default { add, edit, del, listMenuByPid, queryMenuSuperior, searchMenu, listChildMenuSetByMenuId }
|
||||||
return request({
|
|
||||||
url: 'api/menu/saveMenu',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function del(ids) {
|
|
||||||
return request({
|
|
||||||
url: 'api/menu/removeMenuByIds',
|
|
||||||
method: 'post',
|
|
||||||
data: ids
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function edit(data) {
|
|
||||||
return request({
|
|
||||||
url: 'api/menu/modifyMenuById',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default { add, edit, del, queryMenuListByPid, queryMenuSuperior, queryMenuByArgs, queryChildMenuSet }
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/ossStorage/uploadFile',
|
url: 'api/ossStorage/uploadFile',
|
||||||
@@ -10,7 +12,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/ossStorage/removeFileByIds',
|
url: 'api/ossStorage/deleteFileByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/quartzJob/createQuartzJob',
|
url: 'api/quartzJob/createQuartzJob',
|
||||||
@@ -10,7 +12,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/quartzJob/removeJobByIds',
|
url: 'api/quartzJob/deleteJobByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -18,8 +20,8 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/quartzJob',
|
url: 'api/quartzJob/updateQuartzJobResumeCron',
|
||||||
method: 'put',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
/**
|
||||||
// 获取所有的Role
|
* 默认入口:add、del、edit、get
|
||||||
export function queryRoleList() {
|
*/
|
||||||
return request({
|
|
||||||
url: 'api/role/queryRoleList',
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/role/saveRole',
|
url: 'api/role/saveRole',
|
||||||
@@ -18,22 +12,15 @@ export function add(data) {
|
|||||||
|
|
||||||
export function get(id) {
|
export function get(id) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/role/queryRoleById',
|
url: 'api/role/getRoleById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: { id: id }
|
data: { id: id }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLevel() {
|
|
||||||
return request({
|
|
||||||
url: 'api/role/queryRoleLevel',
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/role/removeRoleByIds',
|
url: 'api/role/deleteRoleByIds',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -41,18 +28,33 @@ export function del(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/role/modifyRoleById',
|
url: 'api/role/updateRoleById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取所有的Role
|
||||||
|
export function listAllRole() {
|
||||||
|
return request({
|
||||||
|
url: 'api/role/listAllRole',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCurrentUserRoleLevel() {
|
||||||
|
return request({
|
||||||
|
url: 'api/role/getCurrentUserRoleLevel',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function editMenu(data) {
|
export function editMenu(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/role/modifyBindMenuById',
|
url: 'api/role/updateBindMenuById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, editMenu, getLevel }
|
export default { add, edit, del, get, editMenu, getCurrentUserRoleLevel }
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import { encrypt } from '@/utils/CsRsaUtil'
|
import { encrypt } from '@/utils/CsRsaUtil'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认入口:add、del、edit、get
|
||||||
|
*/
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/user/saveUser',
|
url: 'api/user/saveUser',
|
||||||
@@ -11,15 +14,7 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(ids) {
|
export function del(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/user/removeUserByIds',
|
url: 'api/user/deleteUserByIds',
|
||||||
method: 'post',
|
|
||||||
data: ids
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function resetPwd(ids) {
|
|
||||||
return request({
|
|
||||||
url: 'api/user/resetUserPasswordByIds',
|
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
@@ -27,45 +22,53 @@ export function resetPwd(ids) {
|
|||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/user/modifyUserById',
|
url: 'api/user/updateUserById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function editUser(data) {
|
export function resetUserPasswordByIds(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/user/modifyUserCenterInfoById',
|
url: 'api/user/resetUserPasswordByIds',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateUserCenterInfoById(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/user/updateUserCenterInfoById',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updatePass(user) {
|
export function updateUserPasswordByUsername(user) {
|
||||||
const data = {
|
const data = {
|
||||||
oldPass: encrypt(user.oldPass),
|
oldPass: encrypt(user.oldPass),
|
||||||
newPass: encrypt(user.newPass)
|
newPass: encrypt(user.newPass)
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: 'api/user/modifyUserPasswordByUsername',
|
url: 'api/user/updateUserPasswordByUsername',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateEmail(form) {
|
export function updateUserEmailByUsername(form) {
|
||||||
const data = {
|
const data = {
|
||||||
password: encrypt(form.pass),
|
password: encrypt(form.pass),
|
||||||
email: form.email
|
email: form.email
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: 'api/user/modifyUserEmailByUsername/' + form.code,
|
url: 'api/user/updateUserEmailByUsername/' + form.code,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryUserMetaPage(query) {
|
export function queryUserMetadataOptions(query) {
|
||||||
const params = {
|
const params = {
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 50,
|
size: 50,
|
||||||
@@ -80,5 +83,5 @@ export function queryUserMetaPage(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, resetPwd, queryUserMetaPage }
|
export default { add, edit, del, resetUserPasswordByIds, queryUserMetadataOptions }
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ function CRUD(options) {
|
|||||||
idField: 'id',
|
idField: 'id',
|
||||||
// 标题
|
// 标题
|
||||||
title: '',
|
title: '',
|
||||||
// 请求数据的url
|
// 请求数据的url, @Controller注解的路径
|
||||||
url: '',
|
url: '',
|
||||||
|
// 分页查询路由,@PostMapping注解的路径
|
||||||
|
searchRouter: '',
|
||||||
// 表格数据
|
// 表格数据
|
||||||
data: [],
|
data: [],
|
||||||
// 选择项
|
// 选择项
|
||||||
@@ -134,7 +136,7 @@ function CRUD(options) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
crud.loading = true
|
crud.loading = true
|
||||||
// 请求数据
|
// 请求数据
|
||||||
initData(crud.url, crud.getQueryParams()).then(data => {
|
initData(crud.url + crud.searchRouter, crud.getQueryParams()).then(data => {
|
||||||
const table = crud.getTable()
|
const table = crud.getTable()
|
||||||
if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据
|
if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据
|
||||||
table.store.states.treeData = {}
|
table.store.states.treeData = {}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const api = {
|
|||||||
// 图片上传
|
// 图片上传
|
||||||
imagesUploadApi: baseUrl + '/api/localStorage/uploadPicture',
|
imagesUploadApi: baseUrl + '/api/localStorage/uploadPicture',
|
||||||
// 修改头像
|
// 修改头像
|
||||||
updateAvatarApi: baseUrl + '/api/user/modifyUserAvatar',
|
updateAvatarApi: baseUrl + '/api/user/updateUserAvatar',
|
||||||
// Sql 监控
|
// Sql 监控
|
||||||
druidSqlApi: baseUrl + '/druid/index.html',
|
druidSqlApi: baseUrl + '/druid/index.html',
|
||||||
// websocket
|
// websocket
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
|
|||||||
|
|
||||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||||
|
|
||||||
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
|
const publicKey = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAg975XAOL1zg5EOcSSGPIcxwx5DxcvPD2rBRQa0/o1HTF25cnsU9uSHfzP+qohkDG76kDk+1FA/cuQda4CDAmK2fWW' +
|
||||||
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
|
'q7KgglKd08hRkByjLuRsXu5WVApAAG15ItNM0CrXI7P47aOan+6YPU0Ni1+4WYQnwxfRYdUaKgY5G5gb3S+hx6VO1iN1KuRMBJ7y5FMh1WNJOM9bQb3X1pvaJ73drTpy1wJHAvfP80iG2+sSh0FfcOxCoRNEff' +
|
||||||
|
'CUsU2bYNH6dG6mXIDvo6XZStspwUfSitfgOER207uvBCCVyFlas+2Xs09yyAoJNjaWmeCPfA7uJvJrXUft/SMy8JNIXBY40vlwk4d4FE6OKOG9Wn0oRlofRKZ7NGvpUxEA5zOW6g2LsHKUUXpgOfu59M6ZHxviGM' +
|
||||||
|
't26WxJiq/ifVKJE3yVgx0MVIGEFTrG+spOCVsDYMSHnVsPEUdL6g5FV2YLyqNHljBqUqwyOEfUinp7hPRxrLJDMyX6GWy7y48Djg0wyh2hXro/ygVrZ6jcSd7MUAd2lYueUKK8Bey7OzIcOJ6GveHdLzGrspbbkn' +
|
||||||
|
'DuRsbcInR5bD6l7YA4vpnLsbiOH2wbKJWXNnxRwN5KuWSpwHDHhARB8f4wWrewUKIOxcFI/eJ6ke6D52JMOKhiGeZKn+2/giHwrPGkTREe47Ose6UvTMCAwEAAQ=='
|
||||||
|
|
||||||
// 加密
|
// 加密
|
||||||
export function encrypt(txt) {
|
export function encrypt(txt) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { queryDeptList } from '@/api/system/dept'
|
import { searchDept } from '@/api/system/dept'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CuteDeptTree',
|
name: 'CuteDeptTree',
|
||||||
@@ -61,7 +61,7 @@ export default {
|
|||||||
params['pid'] = node.data.id
|
params['pid'] = node.data.id
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
queryDeptList({
|
searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: params
|
args: params
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { queryDeptSelectDataSource } from '@/api/system/component'
|
import { listDeptSelectDataSource } from '@/api/system/component'
|
||||||
import CsMessage from '@/utils/elementui/CsMessage'
|
import CsMessage from '@/utils/elementui/CsMessage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -56,7 +56,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchDeptData() {
|
fetchDeptData() {
|
||||||
queryDeptSelectDataSource().then(data => {
|
listDeptSelectDataSource().then(data => {
|
||||||
this.deptOptions = data
|
this.deptOptions = data
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('获取部门数据失败:', error)
|
console.error('获取部门数据失败:', error)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { queryDeptSelectProDataSource } from '@/api/system/component'
|
import { listDeptSelectProDataSource } from '@/api/system/component'
|
||||||
import CsMessage from '@/utils/elementui/CsMessage'
|
import CsMessage from '@/utils/elementui/CsMessage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -62,7 +62,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchDeptData() {
|
fetchDeptData() {
|
||||||
queryDeptSelectProDataSource().then(data => {
|
listDeptSelectProDataSource().then(data => {
|
||||||
this.deptOptions = this.cleanEmptyChildren(data)
|
this.deptOptions = this.cleanEmptyChildren(data)
|
||||||
// console.error('deptOptions', this.deptOptions)
|
// console.error('deptOptions', this.deptOptions)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|||||||
@@ -57,15 +57,15 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.queryUserMetaPage(query)
|
this.queryUserMetadataOptions(query)
|
||||||
}, 200)
|
}, 200)
|
||||||
} else {
|
} else {
|
||||||
this.options = []
|
this.options = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
queryUserMetaPage(query, options) {
|
queryUserMetadataOptions(query, options) {
|
||||||
const that = this
|
const that = this
|
||||||
UserService.queryUserMetaPage(query).then(res => {
|
UserService.queryUserMetadataOptions(query).then(res => {
|
||||||
that.options = res
|
that.options = res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -67,15 +67,15 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.queryUserMetaPage(query)
|
this.queryUserMetadataOptions(query)
|
||||||
}, 200)
|
}, 200)
|
||||||
} else {
|
} else {
|
||||||
this.options = []
|
this.options = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
queryUserMetaPage(query, options) {
|
queryUserMetadataOptions(query, options) {
|
||||||
const that = this
|
const that = this
|
||||||
UserService.queryUserMetaPage(query).then(res => {
|
UserService.queryUserMetadataOptions(query).then(res => {
|
||||||
that.options = res
|
that.options = res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetch: async(queryParams) => {
|
fetch: async(queryParams) => {
|
||||||
return DictService.queryPageDict(queryParams)
|
return DictService.searchDict(queryParams)
|
||||||
},
|
},
|
||||||
pageProps: {
|
pageProps: {
|
||||||
current: 1,
|
current: 1,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetch: async(queryParams) => {
|
fetch: async(queryParams) => {
|
||||||
return DictService.queryPageDict(queryParams)
|
return DictService.searchDict(queryParams)
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ prop: 'name', label: '名称' },
|
{ prop: 'name', label: '名称' },
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export default {
|
|||||||
name: 'Dept',
|
name: 'Dept',
|
||||||
components: { Treeselect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
components: { Treeselect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '部门', url: 'api/dept', crudMethod: { ...crudDept }})
|
return CRUD({ title: '部门', url: 'api/dept', searchRouter: '/searchDept', crudMethod: { ...crudDept }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
// 设置数据字典
|
// 设置数据字典
|
||||||
@@ -175,7 +175,7 @@ export default {
|
|||||||
args: { pid: tree.id }
|
args: { pid: tree.id }
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
crudDept.queryDeptList(params).then(res => {
|
crudDept.searchDept(params).then(res => {
|
||||||
resolve(res.content)
|
resolve(res.content)
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -195,7 +195,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getSupDepts(id) {
|
getSupDepts(id) {
|
||||||
crudDept.queryDeptSuperiorTree(id, true).then(res => {
|
crudDept.searchDeptTree(id, true).then(res => {
|
||||||
const data = res.content
|
const data = res.content
|
||||||
this.buildDepts(data)
|
this.buildDepts(data)
|
||||||
this.depts = data
|
this.depts = data
|
||||||
@@ -212,7 +212,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDepts() {
|
getDepts() {
|
||||||
crudDept.queryDeptList({
|
crudDept.searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { enabled: true }
|
args: { enabled: true }
|
||||||
@@ -228,7 +228,7 @@ export default {
|
|||||||
// 获取弹窗内部门数据
|
// 获取弹窗内部门数据
|
||||||
loadDepts({ action, parentNode, callback }) {
|
loadDepts({ action, parentNode, callback }) {
|
||||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
crudDept.queryDeptList({
|
crudDept.searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { enabled: true, pid: parentNode.id }
|
args: { enabled: true, pid: parentNode.id }
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default {
|
|||||||
cruds() {
|
cruds() {
|
||||||
return [
|
return [
|
||||||
CRUD({
|
CRUD({
|
||||||
title: '字典详情', url: 'api/dictDetail', query: { dictName: '' },
|
title: '字典详情', url: 'api/dictDetail', searchRouter: '/searchDictDetail', query: { dictName: '' },
|
||||||
crudMethod: { ...crudDictDetail },
|
crudMethod: { ...crudDictDetail },
|
||||||
optShow: {
|
optShow: {
|
||||||
add: true,
|
add: true,
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export default {
|
|||||||
components: { crudOperation, pagination, rrOperation, udOperation, dictDetail },
|
components: { crudOperation, pagination, rrOperation, udOperation, dictDetail },
|
||||||
cruds() {
|
cruds() {
|
||||||
return [
|
return [
|
||||||
CRUD({ title: '字典', url: 'api/dict', crudMethod: { ...crudDict }})
|
CRUD({ title: '字典', url: 'api/dict', searchRouter: '/searchDict', crudMethod: { ...crudDict }})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm)],
|
mixins: [presenter(), header(), form(defaultForm)],
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getLastEmailConfig, modifyEmailConfig } from '@/api/system/email'
|
import { getLastEmailConfig, updateEmailConfigById } from '@/api/system/email'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Config',
|
name: 'Config',
|
||||||
@@ -67,7 +67,7 @@ export default {
|
|||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
modifyEmailConfig(this.form).then(res => {
|
updateEmailConfigById(this.form).then(res => {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '修改成功',
|
title: '修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { sendEmail } from '@/api/system/email'
|
import { send } from '@/api/system/email'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import E from 'wangeditor'
|
import E from 'wangeditor'
|
||||||
import { UploadFile } from '@/utils/CsDomUtil'
|
import { UploadFile } from '@/utils/CsDomUtil'
|
||||||
@@ -74,7 +74,7 @@ export default {
|
|||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
sendEmail(this.form).then(res => {
|
send(this.form).then(res => {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '发送成功',
|
title: '发送成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export default {
|
|||||||
return CRUD({
|
return CRUD({
|
||||||
title: '岗位',
|
title: '岗位',
|
||||||
url: 'api/job',
|
url: 'api/job',
|
||||||
|
searchRouter: '/searchJob',
|
||||||
crudMethod: { ...crudJob }
|
crudMethod: { ...crudJob }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
ref="table"
|
ref="table"
|
||||||
v-loading="crud.loading"
|
v-loading="crud.loading"
|
||||||
lazy
|
lazy
|
||||||
:load="queryMenuByArgs"
|
:load="searchMenu"
|
||||||
:data="crud.data"
|
:data="crud.data"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
@@ -239,7 +239,7 @@ export default {
|
|||||||
name: 'Menu',
|
name: 'Menu',
|
||||||
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '菜单', url: 'api/menu', crudMethod: { ...crudMenu }})
|
return CRUD({ title: '菜单', url: 'api/menu', searchRouter: '/searchMenu', crudMethod: { ...crudMenu }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
@@ -273,14 +273,14 @@ export default {
|
|||||||
this.menus.push({ id: 0, label: '顶级类目', children: null })
|
this.menus.push({ id: 0, label: '顶级类目', children: null })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
queryMenuByArgs(tree, treeNode, resolve) {
|
searchMenu(tree, treeNode, resolve) {
|
||||||
const params = {
|
const params = {
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { pid: tree.id }
|
args: { pid: tree.id }
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
crudMenu.queryMenuByArgs(params).then(res => {
|
crudMenu.searchMenu(params).then(res => {
|
||||||
resolve(res.content)
|
resolve(res.content)
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -298,7 +298,7 @@ export default {
|
|||||||
},
|
},
|
||||||
loadMenus({ action, parentNode, callback }) {
|
loadMenus({ action, parentNode, callback }) {
|
||||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
crudMenu.queryMenuListByPid(parentNode.id).then(res => {
|
crudMenu.listMenuByPid(parentNode.id).then(res => {
|
||||||
parentNode.children = res.map(function(obj) {
|
parentNode.children = res.map(function(obj) {
|
||||||
if (!obj.leaf) {
|
if (!obj.leaf) {
|
||||||
obj.children = null
|
obj.children = null
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export default {
|
|||||||
name: 'OnlineUser',
|
name: 'OnlineUser',
|
||||||
components: { pagination, crudOperation, rrOperation },
|
components: { pagination, crudOperation, rrOperation },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ url: 'api/user/online', title: '在线用户' })
|
return CRUD({ url: 'api/user/online', searchRouter: '/searchOnlineUser', title: '在线用户' })
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), crud()],
|
mixins: [presenter(), header(), crud()],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export default {
|
|||||||
name: 'QuartzJob',
|
name: 'QuartzJob',
|
||||||
components: { Log, pagination, crudOperation, rrOperation, DateRangePicker },
|
components: { Log, pagination, crudOperation, rrOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '定时任务', url: 'api/quartzJob', crudMethod: { ...crudJob }})
|
return CRUD({ title: '定时任务', url: 'api/quartzJob', searchRouter: '/searchQuartzJob', crudMethod: { ...crudJob }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取数据前设置好接口地址
|
// 获取数据前设置好接口地址
|
||||||
beforeInit() {
|
beforeInit() {
|
||||||
this.url = 'api/quartzJob/logs'
|
this.url = 'api/quartzJob/searchQuartzLog'
|
||||||
this.size = 6
|
this.size = 6
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -151,9 +151,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudRoles from '@/api/system/role'
|
import crudRoles, {getCurrentUserRoleLevel} from '@/api/system/role'
|
||||||
import { queryDeptList, queryDeptSuperiorTree } from '@/api/system/dept'
|
import { searchDept, searchDeptTree } from '@/api/system/dept'
|
||||||
import { queryChildMenuSet, queryMenuListByPid } from '@/api/system/menu'
|
import { listChildMenuSetByMenuId, listMenuByPid } from '@/api/system/menu'
|
||||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
@@ -168,7 +168,7 @@ export default {
|
|||||||
name: 'Role',
|
name: 'Role',
|
||||||
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
|
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '角色', url: 'api/role', crudMethod: { ...crudRoles }})
|
return CRUD({ title: '角色', url: 'api/role', searchRouter: '/searchRole', crudMethod: { ...crudRoles }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
@@ -190,14 +190,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
crudRoles.getLevel().then(data => {
|
crudRoles.getCurrentUserRoleLevel().then(data => {
|
||||||
this.level = data.level
|
this.level = data.level
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getMenuDatas(node, resolve) {
|
getMenuDatas(node, resolve) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
queryMenuListByPid(node.data.id ? node.data.id : 0).then(res => {
|
listMenuByPid(node.data.id ? node.data.id : 0).then(res => {
|
||||||
resolve(res)
|
resolve(res)
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -261,7 +261,7 @@ export default {
|
|||||||
},
|
},
|
||||||
menuChange(menu) {
|
menuChange(menu) {
|
||||||
// 获取该节点的所有子节点,id 包含自身
|
// 获取该节点的所有子节点,id 包含自身
|
||||||
queryChildMenuSet(menu.id).then(childIds => {
|
listChildMenuSetByMenuId(menu.id).then(childIds => {
|
||||||
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
// 判断是否在 menuIds 中,如果存在则删除,否则添加
|
||||||
if (this.menuIds.indexOf(menu.id) !== -1) {
|
if (this.menuIds.indexOf(menu.id) !== -1) {
|
||||||
for (let i = 0; i < childIds.length; i++) {
|
for (let i = 0; i < childIds.length; i++) {
|
||||||
@@ -313,7 +313,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取部门数据
|
// 获取部门数据
|
||||||
getDepts() {
|
getDepts() {
|
||||||
queryDeptList({
|
searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { enabled: true }
|
args: { enabled: true }
|
||||||
@@ -331,7 +331,7 @@ export default {
|
|||||||
depts.forEach(dept => {
|
depts.forEach(dept => {
|
||||||
ids.push(dept.id)
|
ids.push(dept.id)
|
||||||
})
|
})
|
||||||
queryDeptSuperiorTree(ids).then(res => {
|
searchDeptTree(ids).then(res => {
|
||||||
const date = res.content
|
const date = res.content
|
||||||
this.buildDepts(date)
|
this.buildDepts(date)
|
||||||
this.depts = date
|
this.depts = date
|
||||||
@@ -350,7 +350,7 @@ export default {
|
|||||||
// 获取弹窗内部门数据
|
// 获取弹窗内部门数据
|
||||||
loadDepts({ action, parentNode, callback }) {
|
loadDepts({ action, parentNode, callback }) {
|
||||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
queryDeptList({
|
searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { enabled: true, pid: parentNode.id }
|
args: { enabled: true, pid: parentNode.id }
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
show: false,
|
show: false,
|
||||||
monitor: null,
|
monitor: null,
|
||||||
url: 'api/monitor/queryServerMonitorInfo',
|
url: 'api/monitor/getServerMonitorInfo',
|
||||||
data: {},
|
data: {},
|
||||||
cpuInfo: {
|
cpuInfo: {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ const defaultForm = { id: null, name: '' }
|
|||||||
export default {
|
export default {
|
||||||
components: { pagination, crudOperation, rrOperation, DateRangePicker },
|
components: { pagination, crudOperation, rrOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '文件', url: 'api/localStorage', crudMethod: { ...crudFile }})
|
return CRUD({ title: '文件', url: 'api/localStorage', searchRouter: '/searchLocalStorage', crudMethod: { ...crudFile }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ const defaultForm = { id: null }
|
|||||||
export default {
|
export default {
|
||||||
components: { pagination, crudOperation, rrOperation, DateRangePicker },
|
components: { pagination, crudOperation, rrOperation, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '文件', url: 'api/ossStorage', crudMethod: { ...crudFile }})
|
return CRUD({ title: '文件', url: 'api/ossStorage', searchRouter: '/searchOssStorage', crudMethod: { ...crudFile }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -98,15 +98,15 @@
|
|||||||
<!-- 操作日志 -->
|
<!-- 操作日志 -->
|
||||||
<el-tab-pane label="操作日志" name="second">
|
<el-tab-pane label="操作日志" name="second">
|
||||||
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
||||||
<el-table-column prop="description" label="行为" />
|
<el-table-column prop="bizName" label="业务名称" />
|
||||||
<el-table-column prop="requestIp" label="IP" />
|
<el-table-column prop="requestIp" label="IP" />
|
||||||
<el-table-column :show-overflow-tooltip="true" prop="address" label="IP来源" />
|
<el-table-column :show-overflow-tooltip="true" prop="address" label="IP来源" />
|
||||||
<el-table-column prop="browser" label="浏览器" />
|
<el-table-column prop="browserInfo" label="浏览器" />
|
||||||
<el-table-column prop="time" label="请求耗时" align="center">
|
<el-table-column prop="executeTime" label="请求耗时" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.time <= 300">{{ scope.row.time }}ms</el-tag>
|
<el-tag v-if="scope.row.executeTime <= 300">{{ scope.row.time }}ms</el-tag>
|
||||||
<el-tag v-else-if="scope.row.time <= 1000" type="warning">{{ scope.row.time }}ms</el-tag>
|
<el-tag v-else-if="scope.row.executeTime <= 1000" type="warning">{{ scope.row.executeTime }}ms</el-tag>
|
||||||
<el-tag v-else type="danger">{{ scope.row.time }}ms</el-tag>
|
<el-tag v-else type="danger">{{ scope.row.executeTime }}ms</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -151,7 +151,7 @@ import { getToken } from '@/utils/auth'
|
|||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { IsValidPhone } from '@/utils/CsValidateUtil'
|
import { IsValidPhone } from '@/utils/CsValidateUtil'
|
||||||
import crud from '@/mixins/crud'
|
import crud from '@/mixins/crud'
|
||||||
import { editUser } from '@/api/system/user'
|
import { updateUserCenterInfoById } from '@/api/system/user'
|
||||||
import Avatar from '@/assets/images/avatar.png'
|
import Avatar from '@/assets/images/avatar.png'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -211,7 +211,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeInit() {
|
beforeInit() {
|
||||||
this.url = 'api/logs/user'
|
this.url = 'api/logs/searchUserLog'
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
cropUploadSuccess(jsonData, field) {
|
cropUploadSuccess(jsonData, field) {
|
||||||
@@ -223,7 +223,7 @@ export default {
|
|||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.saveLoading = true
|
this.saveLoading = true
|
||||||
editUser(this.form).then(() => {
|
updateUserCenterInfoById(this.form).then(() => {
|
||||||
this.editSuccessNotify()
|
this.editSuccessNotify()
|
||||||
store.dispatch('GetInfo').then(() => {
|
store.dispatch('GetInfo').then(() => {
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { validEmail } from '@/utils/CsValidateUtil'
|
import { IsValidEmail } from '@/utils/CsValidateUtil'
|
||||||
import { updateEmail } from '@/api/system/user'
|
import { updateUserEmailByUsername } from '@/api/system/user'
|
||||||
import { sendResetEmailCaptcha } from '@/api/system/code'
|
import { sendResetEmailCode } from '@/api/system/code'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -51,7 +51,7 @@ export default {
|
|||||||
callback(new Error('新邮箱不能为空'))
|
callback(new Error('新邮箱不能为空'))
|
||||||
} else if (value === this.email) {
|
} else if (value === this.email) {
|
||||||
callback(new Error('新邮箱不能与旧邮箱相同'))
|
callback(new Error('新邮箱不能与旧邮箱相同'))
|
||||||
} else if (validEmail(value)) {
|
} else if (IsValidEmail(value)) {
|
||||||
callback()
|
callback()
|
||||||
} else {
|
} else {
|
||||||
callback(new Error('邮箱格式错误'))
|
callback(new Error('邮箱格式错误'))
|
||||||
@@ -83,7 +83,7 @@ export default {
|
|||||||
this.codeLoading = true
|
this.codeLoading = true
|
||||||
this.buttonName = '验证码发送中'
|
this.buttonName = '验证码发送中'
|
||||||
const _this = this
|
const _this = this
|
||||||
sendResetEmailCaptcha(this.form.email).then(res => {
|
sendResetEmailCode(this.form.email).then(res => {
|
||||||
this.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
message: '发送成功,验证码有效期5分钟',
|
message: '发送成功,验证码有效期5分钟',
|
||||||
@@ -113,7 +113,7 @@ export default {
|
|||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
updateEmail(this.form).then(res => {
|
updateUserEmailByUsername(this.form).then(res => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.resetForm()
|
this.resetForm()
|
||||||
this.$notify({
|
this.$notify({
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { updatePass } from '@/api/system/user'
|
import { updateUserPasswordByUsername } from '@/api/system/user'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -69,7 +69,7 @@ export default {
|
|||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
updatePass(this.form).then(res => {
|
updateUserPasswordByUsername(this.form).then(res => {
|
||||||
this.resetForm()
|
this.resetForm()
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '密码修改成功,请重新登录',
|
title: '密码修改成功,请重新登录',
|
||||||
|
|||||||
@@ -196,9 +196,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import crudUser from '@/api/system/user'
|
import crudUser from '@/api/system/user'
|
||||||
import { IsValidPhone } from '@/utils/CsValidateUtil'
|
import { IsValidPhone } from '@/utils/CsValidateUtil'
|
||||||
import { queryDeptList, queryDeptSuperiorTree } from '@/api/system/dept'
|
import { searchDept, searchDeptTree } from '@/api/system/dept'
|
||||||
import { getLevel, queryRoleList } from '@/api/system/role'
|
import { getCurrentUserRoleLevel, listAllRole } from '@/api/system/role'
|
||||||
import { queryAllEnableJob } from '@/api/system/job'
|
import { searchJob } from '@/api/system/job'
|
||||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
@@ -228,7 +228,7 @@ export default {
|
|||||||
name: 'User',
|
name: 'User',
|
||||||
components: { CuteDeptTree, Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
components: { CuteDeptTree, Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '用户', url: 'api/user', crudMethod: { ...crudUser }})
|
return CRUD({ title: '用户', url: 'api/user', searchRouter: '/aggregationSearchUser', crudMethod: { ...crudUser }})
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
// 数据字典
|
// 数据字典
|
||||||
@@ -401,7 +401,7 @@ export default {
|
|||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
},
|
},
|
||||||
getDepts() {
|
getDepts() {
|
||||||
queryDeptList({
|
searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { enabled: true }
|
args: { enabled: true }
|
||||||
@@ -415,7 +415,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getSupDepts(deptId) {
|
getSupDepts(deptId) {
|
||||||
queryDeptSuperiorTree(deptId).then(res => {
|
searchDeptTree(deptId).then(res => {
|
||||||
const date = res.content
|
const date = res.content
|
||||||
this.buildDepts(date)
|
this.buildDepts(date)
|
||||||
this.depts = date
|
this.depts = date
|
||||||
@@ -434,7 +434,7 @@ export default {
|
|||||||
// 获取弹窗内部门数据
|
// 获取弹窗内部门数据
|
||||||
loadDepts({ action, parentNode, callback }) {
|
loadDepts({ action, parentNode, callback }) {
|
||||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
queryDeptList({
|
searchDept({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 9999999,
|
size: 9999999,
|
||||||
args: { enabled: true, pid: parentNode.id }
|
args: { enabled: true, pid: parentNode.id }
|
||||||
@@ -469,21 +469,21 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取弹窗内角色数据
|
// 获取弹窗内角色数据
|
||||||
getRoles() {
|
getRoles() {
|
||||||
queryRoleList().then(res => {
|
listAllRole().then(res => {
|
||||||
this.roles = res
|
this.roles = res
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取弹窗内岗位数据
|
// 获取弹窗内岗位数据
|
||||||
getJobs() {
|
getJobs() {
|
||||||
queryAllEnableJob().then(res => {
|
searchJob().then(res => {
|
||||||
this.jobs = res.content
|
this.jobs = res.content
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取权限级别
|
// 获取权限级别
|
||||||
getRoleLevel() {
|
getRoleLevel() {
|
||||||
getLevel().then(res => {
|
getCurrentUserRoleLevel().then(res => {
|
||||||
this.level = res.level
|
this.level = res.level
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
})
|
})
|
||||||
@@ -502,7 +502,7 @@ export default {
|
|||||||
ids.push(val.id)
|
ids.push(val.id)
|
||||||
})
|
})
|
||||||
console.log(ids)
|
console.log(ids)
|
||||||
crudUser.resetPwd(ids).then(() => {
|
crudUser.resetUserPasswordByIds(ids).then(() => {
|
||||||
this.crud.notify('重置成功, 用户新密码:123456', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.notify('重置成功, 用户新密码:123456', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ module.exports = {
|
|||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/auth': 'auth'
|
'^/auth': 'auth'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'/captcha': {
|
||||||
|
target: process.env.VUE_APP_BASE_API,
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: {
|
||||||
|
'^/captcha': 'captcha'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>cutejava</artifactId>
|
<artifactId>cutejava</artifactId>
|
||||||
<groupId>cn.odboy</groupId>
|
<groupId>cn.odboy</groupId>
|
||||||
<version>1.4.1</version>
|
<version>1.5.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>cutejava-framework</artifactId>
|
<artifactId>cutejava-framework</artifactId>
|
||||||
|
|||||||
+3
-4
@@ -13,12 +13,12 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.context;
|
package cn.odboy.framework.context;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
@@ -28,7 +28,6 @@ import org.springframework.core.env.Environment;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SuppressWarnings({"unchecked", "all"})
|
|
||||||
public class KitSpringBeanHolder implements ApplicationContextAware, DisposableBean {
|
public class KitSpringBeanHolder implements ApplicationContextAware, DisposableBean {
|
||||||
|
|
||||||
private static final List<CallBack> CALL_BACKS = new ArrayList<>();
|
private static final List<CallBack> CALL_BACKS = new ArrayList<>();
|
||||||
@@ -136,7 +135,7 @@ public class KitSpringBeanHolder implements ApplicationContextAware, DisposableB
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException {
|
||||||
if (KitSpringBeanHolder.applicationContext != null) {
|
if (KitSpringBeanHolder.applicationContext != null) {
|
||||||
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" +
|
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" +
|
||||||
KitSpringBeanHolder.applicationContext);
|
KitSpringBeanHolder.applicationContext);
|
||||||
@@ -151,7 +150,7 @@ public class KitSpringBeanHolder implements ApplicationContextAware, DisposableB
|
|||||||
KitSpringBeanHolder.addCallback = false;
|
KitSpringBeanHolder.addCallback = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CallBack {
|
public interface CallBack {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回调执行方法
|
* 回调执行方法
|
||||||
|
|||||||
+1
-2
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.logging;
|
package cn.odboy.framework.logging;
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
@@ -24,7 +23,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计执行时长
|
* 统计执行时长(仅对代理方法有效)
|
||||||
*
|
*
|
||||||
* @author odboy
|
* @author odboy
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
-43
@@ -13,17 +13,14 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.config;
|
package cn.odboy.framework.mybatisplus.config;
|
||||||
|
|
||||||
import cn.odboy.framework.exception.BadRequestException;
|
import cn.odboy.framework.exception.BadRequestException;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
@Getter
|
||||||
* @author /
|
|
||||||
*/
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SuppressWarnings({"unchecked", "all"})
|
|
||||||
public enum DataTypeEnum {
|
public enum DataTypeEnum {
|
||||||
/**
|
/**
|
||||||
* mysql
|
* mysql
|
||||||
@@ -86,13 +83,13 @@ public enum DataTypeEnum {
|
|||||||
*/
|
*/
|
||||||
IMPALA("impala", "impala", "com.cloudera.impala.jdbc41.Driver", "", "", "'", "'");
|
IMPALA("impala", "impala", "com.cloudera.impala.jdbc41.Driver", "", "", "'", "'");
|
||||||
private static final String JDBC_URL_PREFIX = "jdbc:";
|
private static final String JDBC_URL_PREFIX = "jdbc:";
|
||||||
private String feature;
|
private final String feature;
|
||||||
private String desc;
|
private final String desc;
|
||||||
private String driver;
|
private final String driver;
|
||||||
private String keywordPrefix;
|
private final String keywordPrefix;
|
||||||
private String keywordSuffix;
|
private final String keywordSuffix;
|
||||||
private String aliasPrefix;
|
private final String aliasPrefix;
|
||||||
private String aliasSuffix;
|
private final String aliasSuffix;
|
||||||
|
|
||||||
DataTypeEnum(String feature, String desc, String driver, String keywordPrefix, String keywordSuffix,
|
DataTypeEnum(String feature, String desc, String driver, String keywordPrefix, String keywordSuffix,
|
||||||
String aliasPrefix, String aliasSuffix) {
|
String aliasPrefix, String aliasSuffix) {
|
||||||
@@ -110,10 +107,7 @@ public enum DataTypeEnum {
|
|||||||
for (DataTypeEnum dataTypeEnum : values()) {
|
for (DataTypeEnum dataTypeEnum : values()) {
|
||||||
if (url.startsWith(JDBC_URL_PREFIX + dataTypeEnum.feature)) {
|
if (url.startsWith(JDBC_URL_PREFIX + dataTypeEnum.feature)) {
|
||||||
try {
|
try {
|
||||||
Class<?> aClass = Class.forName(dataTypeEnum.getDriver());
|
Class.forName(dataTypeEnum.getDriver());
|
||||||
if (null == aClass) {
|
|
||||||
throw new BadRequestException("Unable to get driver instance for jdbcUrl: " + jdbcUrl);
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new BadRequestException("Unable to get driver instance: " + jdbcUrl);
|
throw new BadRequestException("Unable to get driver instance: " + jdbcUrl);
|
||||||
}
|
}
|
||||||
@@ -123,31 +117,4 @@ public enum DataTypeEnum {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFeature() {
|
|
||||||
return feature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDriver() {
|
|
||||||
return driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeywordPrefix() {
|
|
||||||
return keywordPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeywordSuffix() {
|
|
||||||
return keywordSuffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAliasPrefix() {
|
|
||||||
return aliasPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAliasSuffix() {
|
|
||||||
return aliasSuffix;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -36,7 +36,6 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@SuppressWarnings({"unchecked", "all"})
|
|
||||||
@ConditionalOnWebApplication
|
@ConditionalOnWebApplication
|
||||||
@AutoConfigureAfter(DruidDataSourceAutoConfigure.class)
|
@AutoConfigureAfter(DruidDataSourceAutoConfigure.class)
|
||||||
@ConditionalOnProperty(name = "spring.datasource.druid.stat-view-servlet.enabled", havingValue = "true",
|
@ConditionalOnProperty(name = "spring.datasource.druid.stat-view-servlet.enabled", havingValue = "true",
|
||||||
@@ -50,7 +49,7 @@ public class RemoveDruidAdConfig {
|
|||||||
* @return org.springframework.boot.web.servlet.FilterRegistrationBean
|
* @return org.springframework.boot.web.servlet.FilterRegistrationBean
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public FilterRegistrationBean removeDruidAdFilterRegistrationBean(DruidStatProperties properties) {
|
public FilterRegistrationBean<Filter> removeDruidAdFilterRegistrationBean(DruidStatProperties properties) {
|
||||||
|
|
||||||
// 获取web监控页面的参数
|
// 获取web监控页面的参数
|
||||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||||
@@ -89,7 +88,7 @@ public class RemoveDruidAdConfig {
|
|||||||
public void destroy() {
|
public void destroy() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean();
|
||||||
registrationBean.setFilter(filter);
|
registrationBean.setFilter(filter);
|
||||||
registrationBean.addUrlPatterns(commonJsPattern);
|
registrationBean.addUrlPatterns(commonJsPattern);
|
||||||
return registrationBean;
|
return registrationBean;
|
||||||
|
|||||||
+4
-5
@@ -13,10 +13,9 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.core;
|
package cn.odboy.framework.mybatisplus.core;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.odboy.util.KitBeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -42,7 +41,7 @@ public class KitMpAnyQUtil {
|
|||||||
if (mapperTarget == null) {
|
if (mapperTarget == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanUtil.copyProperties(mapperTarget, mapperClazz);
|
return KitBeanUtil.copyToClass(mapperTarget, mapperClazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> selectList(BaseMapper<T> baseMapper, Object queryParams) {
|
public static <T> List<T> selectList(BaseMapper<T> baseMapper, Object queryParams) {
|
||||||
@@ -56,7 +55,7 @@ public class KitMpAnyQUtil {
|
|||||||
if (mapperTarget == null) {
|
if (mapperTarget == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return BeanUtil.copyToList(mapperTarget, mapperClazz);
|
return KitBeanUtil.copyToList(mapperTarget, mapperClazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Long selectCount(BaseMapper<T> baseMapper, Object queryParams) {
|
public static <T> Long selectCount(BaseMapper<T> baseMapper, Object queryParams) {
|
||||||
@@ -74,7 +73,7 @@ public class KitMpAnyQUtil {
|
|||||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||||
Page<T> tPage = baseMapper.selectPage(page, queryWrapper);
|
Page<T> tPage = baseMapper.selectPage(page, queryWrapper);
|
||||||
Page<M> mapperTarget = new Page<>();
|
Page<M> mapperTarget = new Page<>();
|
||||||
mapperTarget.setRecords(BeanUtil.copyToList(tPage.getRecords(), mapperClazz));
|
mapperTarget.setRecords(KitBeanUtil.copyToList(tPage.getRecords(), mapperClazz));
|
||||||
mapperTarget.setTotal(tPage.getTotal());
|
mapperTarget.setTotal(tPage.getTotal());
|
||||||
mapperTarget.setSize(tPage.getSize());
|
mapperTarget.setSize(tPage.getSize());
|
||||||
mapperTarget.setCurrent(tPage.getCurrent());
|
mapperTarget.setCurrent(tPage.getCurrent());
|
||||||
|
|||||||
-1
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.core;
|
package cn.odboy.framework.mybatisplus.core;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|||||||
+47
-20
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.core;
|
package cn.odboy.framework.mybatisplus.core;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
@@ -27,14 +26,15 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,21 +84,47 @@ public class KitMpQUtil {
|
|||||||
private static <R> void handleWrapper(KitMpQuery q, QueryWrapper<R> queryWrapper, String attributeName,
|
private static <R> void handleWrapper(KitMpQuery q, QueryWrapper<R> queryWrapper, String attributeName,
|
||||||
Object fieldVal) {
|
Object fieldVal) {
|
||||||
switch (q.type()) {
|
switch (q.type()) {
|
||||||
case EQUAL -> queryWrapper.eq(attributeName, fieldVal);
|
case EQUAL:
|
||||||
case GREATER_THAN -> queryWrapper.ge(attributeName, fieldVal);
|
queryWrapper.eq(attributeName, fieldVal);
|
||||||
case LESS_THAN -> queryWrapper.le(attributeName, fieldVal);
|
break;
|
||||||
case LESS_THAN_NQ -> queryWrapper.lt(attributeName, fieldVal);
|
case GREATER_THAN:
|
||||||
case INNER_LIKE -> queryWrapper.like(attributeName, fieldVal);
|
queryWrapper.ge(attributeName, fieldVal);
|
||||||
case LEFT_LIKE -> queryWrapper.likeLeft(attributeName, fieldVal);
|
break;
|
||||||
case RIGHT_LIKE -> queryWrapper.likeRight(attributeName, fieldVal);
|
case LESS_THAN:
|
||||||
case IN -> handleInOrNotQuery(true, queryWrapper, attributeName, fieldVal);
|
queryWrapper.le(attributeName, fieldVal);
|
||||||
case NOT_IN -> handleInOrNotQuery(false, queryWrapper, attributeName, fieldVal);
|
break;
|
||||||
case NOT_EQUAL -> queryWrapper.ne(attributeName, fieldVal);
|
case LESS_THAN_NQ:
|
||||||
case NOT_NULL -> queryWrapper.isNotNull(attributeName);
|
queryWrapper.lt(attributeName, fieldVal);
|
||||||
case IS_NULL -> queryWrapper.isNull(attributeName);
|
break;
|
||||||
case BETWEEN -> handleBetweenQuery(queryWrapper, fieldVal, attributeName);
|
case INNER_LIKE:
|
||||||
default -> {
|
queryWrapper.like(attributeName, fieldVal);
|
||||||
}
|
break;
|
||||||
|
case LEFT_LIKE:
|
||||||
|
queryWrapper.likeLeft(attributeName, fieldVal);
|
||||||
|
break;
|
||||||
|
case RIGHT_LIKE:
|
||||||
|
queryWrapper.likeRight(attributeName, fieldVal);
|
||||||
|
break;
|
||||||
|
case IN:
|
||||||
|
handleInOrNotQuery(true, queryWrapper, attributeName, fieldVal);
|
||||||
|
break;
|
||||||
|
case NOT_IN:
|
||||||
|
handleInOrNotQuery(false, queryWrapper, attributeName, fieldVal);
|
||||||
|
break;
|
||||||
|
case NOT_EQUAL:
|
||||||
|
queryWrapper.ne(attributeName, fieldVal);
|
||||||
|
break;
|
||||||
|
case NOT_NULL:
|
||||||
|
queryWrapper.isNotNull(attributeName);
|
||||||
|
break;
|
||||||
|
case IS_NULL:
|
||||||
|
queryWrapper.isNull(attributeName);
|
||||||
|
break;
|
||||||
|
case BETWEEN:
|
||||||
|
handleBetweenQuery(queryWrapper, fieldVal, attributeName);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +178,8 @@ public class KitMpQUtil {
|
|||||||
* @param <R> /
|
* @param <R> /
|
||||||
*/
|
*/
|
||||||
private static <R> void handleBlurryQuery(QueryWrapper<R> queryWrapper, String blurry, Object fieldVal) {
|
private static <R> void handleBlurryQuery(QueryWrapper<R> queryWrapper, String blurry, Object fieldVal) {
|
||||||
List<String> blurryList = Arrays.stream(blurry.split(",")).filter(StrUtil::isNotBlank).distinct().toList();
|
List<String> blurryList =
|
||||||
|
Arrays.stream(blurry.split(",")).filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||||
queryWrapper.and(wrapper -> {
|
queryWrapper.and(wrapper -> {
|
||||||
for (String blurryItem : blurryList) {
|
for (String blurryItem : blurryList) {
|
||||||
String column = StrUtil.toUnderlineCase(blurryItem);
|
String column = StrUtil.toUnderlineCase(blurryItem);
|
||||||
@@ -171,7 +198,7 @@ public class KitMpQUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
QueryWrapper<TestDomain> query = new QueryWrapper<>();
|
QueryWrapper<TestDomain> query = new QueryWrapper<TestDomain>();
|
||||||
query.or(wrapper -> wrapper.eq("username", 1).or().eq("nickname", 2));
|
query.or(wrapper -> wrapper.eq("username", 1).or().eq("nickname", 2));
|
||||||
query.eq("id", 1);
|
query.eq("id", 1);
|
||||||
query.orderByDesc("id");
|
query.orderByDesc("id");
|
||||||
|
|||||||
+7
-8
@@ -13,13 +13,12 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
|
import cn.odboy.util.KitBeanUtil;
|
||||||
import cn.odboy.util.KitPageUtil;
|
import cn.odboy.util.KitPageUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
@@ -111,7 +110,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
|||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return BeanUtil.copyToList(list, clazz);
|
return KitBeanUtil.copyToList(list, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,7 +125,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
|||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return BeanUtil.copyToList(list, clazz);
|
return KitBeanUtil.copyToList(list, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +146,7 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
|||||||
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
||||||
return new KitPageResult<>(new ArrayList<>(), pageInfo.getTotal());
|
return new KitPageResult<>(new ArrayList<>(), pageInfo.getTotal());
|
||||||
}
|
}
|
||||||
return new KitPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
return new KitPageResult<>(KitBeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,9 +165,9 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
|||||||
pageSize = pageSize <= 0 ? 10 : pageSize;
|
pageSize = pageSize <= 0 ? 10 : pageSize;
|
||||||
IPage<E> pageInfo = wrapper.page(new Page<>(pageNumber, pageSize));
|
IPage<E> pageInfo = wrapper.page(new Page<>(pageNumber, pageSize));
|
||||||
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
||||||
return KitPageUtil.emptyListData();
|
return KitPageUtil.emptyData();
|
||||||
}
|
}
|
||||||
return new KitPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
return new KitPageResult<>(KitBeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,6 +182,6 @@ public interface KitMpMapper<E> extends BaseMapper<E> {
|
|||||||
if (e == null) {
|
if (e == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanUtil.copyProperties(e, clazz);
|
return KitBeanUtil.copyToClass(e, clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||||
|
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
@@ -49,11 +48,11 @@ public interface KitMpService<T> extends IService<T> {
|
|||||||
|
|
||||||
<G> List<G> queryFeatureClazzListByIds(List<Serializable> ids, Class<G> targetClazz);
|
<G> List<G> queryFeatureClazzListByIds(List<Serializable> ids, Class<G> targetClazz);
|
||||||
|
|
||||||
<Q> List<T> queryClazzListByArgs(Q criteria);
|
<Q> List<T> queryClazzListByArgs(Q args);
|
||||||
|
|
||||||
List<T> queryClazzListByArgs(LambdaQueryWrapper<T> wrapper);
|
List<T> queryClazzListByArgs(LambdaQueryWrapper<T> wrapper);
|
||||||
|
|
||||||
<G, Q> List<G> queryFeatureClazzListByArgs(Q criteria, Class<G> targetClazz);
|
<G, Q> List<G> queryFeatureClazzListByArgs(Q args, Class<G> targetClazz);
|
||||||
|
|
||||||
<G> List<G> queryFeatureClazzListByArgs(LambdaQueryWrapper<T> wrapper, Class<G> targetClazz);
|
<G> List<G> queryFeatureClazzListByArgs(LambdaQueryWrapper<T> wrapper, Class<G> targetClazz);
|
||||||
|
|
||||||
@@ -62,9 +61,9 @@ public interface KitMpService<T> extends IService<T> {
|
|||||||
<G> KitPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable,
|
<G> KitPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable,
|
||||||
Class<G> targetClazz);
|
Class<G> targetClazz);
|
||||||
|
|
||||||
<G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz);
|
<G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q args, IPage<T> pageable, Class<G> targetClazz);
|
||||||
|
|
||||||
<Q> KitPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable);
|
<Q> KitPageResult<T> queryClazzPageByArgs(Q args, IPage<T> pageable);
|
||||||
|
|
||||||
int modifyClazzByArgs(LambdaQueryWrapper<T> wrapper, T entity);
|
int modifyClazzByArgs(LambdaQueryWrapper<T> wrapper, T entity);
|
||||||
|
|
||||||
|
|||||||
+22
-24
@@ -13,14 +13,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.framework.exception.BadRequestException;
|
import cn.odboy.framework.exception.BadRequestException;
|
||||||
import cn.odboy.framework.mybatisplus.core.KitMpQUtil;
|
import cn.odboy.framework.mybatisplus.core.KitMpQUtil;
|
||||||
|
import cn.odboy.util.KitBeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||||
@@ -46,7 +45,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
public <G> int saveFeatureClazz(G resources) {
|
public <G> int saveFeatureClazz(G resources) {
|
||||||
return getBaseMapper().insert(BeanUtil.copyProperties(resources, this.getEntityClass()));
|
return getBaseMapper().insert(KitBeanUtil.copyToClass(resources, this.getEntityClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +54,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
public <G> int saveFeatureClazzList(List<G> resources) {
|
public <G> int saveFeatureClazzList(List<G> resources) {
|
||||||
return getBaseMapper().insertBatchSomeColumn(BeanUtil.copyToList(resources, this.getEntityClass()));
|
return getBaseMapper().insertBatchSomeColumn(KitBeanUtil.copyToList(resources, this.getEntityClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +63,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
public <G> int modifyFeatureClazzById(G resources) {
|
public <G> int modifyFeatureClazzById(G resources) {
|
||||||
return getBaseMapper().updateById(BeanUtil.copyProperties(resources, this.getEntityClass()));
|
return getBaseMapper().updateById(KitBeanUtil.copyToClass(resources, this.getEntityClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +76,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
String sqlStatement = this.getSqlStatement(SqlMethod.UPDATE_BY_ID);
|
String sqlStatement = this.getSqlStatement(SqlMethod.UPDATE_BY_ID);
|
||||||
return this.executeBatch(resources, batchSize, (sqlSession, entity) -> {
|
return this.executeBatch(resources, batchSize, (sqlSession, entity) -> {
|
||||||
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
|
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
|
||||||
param.put("et", BeanUtil.copyProperties(entity, this.getEntityClass()));
|
param.put("et", KitBeanUtil.copyToClass(entity, this.getEntityClass()));
|
||||||
sqlSession.update(sqlStatement, param);
|
sqlSession.update(sqlStatement, param);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -90,7 +89,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
*/
|
*/
|
||||||
public <G> G queryFeatureClazzById(Serializable id, Class<G> targetClazz) {
|
public <G> G queryFeatureClazzById(Serializable id, Class<G> targetClazz) {
|
||||||
T entity = this.getById(id);
|
T entity = this.getById(id);
|
||||||
return entity == null ? null : BeanUtil.copyProperties(entity, targetClazz);
|
return entity == null ? null : KitBeanUtil.copyToClass(entity, targetClazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,7 +126,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
if (ts.isEmpty()) {
|
if (ts.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return BeanUtil.copyProperties(ts.stream().findFirst().get(), clazz);
|
return KitBeanUtil.copyToClass(ts.stream().findFirst().get(), clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,17 +137,16 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
*/
|
*/
|
||||||
public <G> List<G> queryFeatureClazzListByIds(List<Serializable> ids, Class<G> targetClazz) {
|
public <G> List<G> queryFeatureClazzListByIds(List<Serializable> ids, Class<G> targetClazz) {
|
||||||
List<T> entitys = this.listByIds(ids);
|
List<T> entitys = this.listByIds(ids);
|
||||||
return entitys == null || entitys.isEmpty() ? CollUtil.newArrayList()
|
return entitys == null || entitys.isEmpty() ? CollUtil.newArrayList() : KitBeanUtil.copyToList(entitys, targetClazz);
|
||||||
: BeanUtil.copyToList(entitys, targetClazz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查有关的数据
|
* 查有关的数据
|
||||||
*
|
*
|
||||||
* @param criteria 动态条件
|
* @param args 动态条件
|
||||||
*/
|
*/
|
||||||
public <Q> List<T> queryClazzListByArgs(Q criteria) {
|
public <Q> List<T> queryClazzListByArgs(Q args) {
|
||||||
QueryWrapper<T> predicate = KitMpQUtil.build(criteria);
|
QueryWrapper<T> predicate = KitMpQUtil.build(args);
|
||||||
return baseMapper.selectList(predicate);
|
return baseMapper.selectList(predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,13 +165,13 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
/**
|
/**
|
||||||
* 查有关的数据并转成目标类型的数据
|
* 查有关的数据并转成目标类型的数据
|
||||||
*
|
*
|
||||||
* @param criteria 动态条件
|
* @param args 动态条件
|
||||||
* @param targetClazz 目标类型
|
* @param targetClazz 目标类型
|
||||||
*/
|
*/
|
||||||
public <G, Q> List<G> queryFeatureClazzListByArgs(Q criteria, Class<G> targetClazz) {
|
public <G, Q> List<G> queryFeatureClazzListByArgs(Q args, Class<G> targetClazz) {
|
||||||
QueryWrapper<T> predicate = KitMpQUtil.build(criteria);
|
QueryWrapper<T> predicate = KitMpQUtil.build(args);
|
||||||
List<T> data = baseMapper.selectList(predicate);
|
List<T> data = baseMapper.selectList(predicate);
|
||||||
return BeanUtil.copyToList(data, targetClazz);
|
return KitBeanUtil.copyToList(data, targetClazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +184,7 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
if (wrapper == null) {
|
if (wrapper == null) {
|
||||||
wrapper = new LambdaQueryWrapper<>();
|
wrapper = new LambdaQueryWrapper<>();
|
||||||
}
|
}
|
||||||
return BeanUtil.copyToList(baseMapper.selectList(wrapper), targetClazz);
|
return KitBeanUtil.copyToList(baseMapper.selectList(wrapper), targetClazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,19 +214,19 @@ public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M
|
|||||||
wrapper = new LambdaQueryWrapper<>();
|
wrapper = new LambdaQueryWrapper<>();
|
||||||
}
|
}
|
||||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||||
return new KitPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
return new KitPageResult<>(KitBeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
||||||
originPageData.getTotal());
|
originPageData.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public <G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz) {
|
public <G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q args, IPage<T> pageable, Class<G> targetClazz) {
|
||||||
QueryWrapper<T> wrapper = KitMpQUtil.build(criteria);
|
QueryWrapper<T> wrapper = KitMpQUtil.build(args);
|
||||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||||
return new KitPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
return new KitPageResult<>(KitBeanUtil.copyToList(originPageData.getRecords(), targetClazz),
|
||||||
originPageData.getTotal());
|
originPageData.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public <Q> KitPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable) {
|
public <Q> KitPageResult<T> queryClazzPageByArgs(Q args, IPage<T> pageable) {
|
||||||
QueryWrapper<T> wrapper = KitMpQUtil.build(criteria);
|
QueryWrapper<T> wrapper = KitMpQUtil.build(args);
|
||||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||||
return new KitPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
return new KitPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.quartz.core;
|
package cn.odboy.framework.quartz.core;
|
||||||
|
|
||||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||||
@@ -45,13 +44,12 @@ public class QuartzRunnable implements Callable<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "all"})
|
|
||||||
public Object call() throws Exception {
|
public Object call() throws Exception {
|
||||||
ReflectionUtils.makeAccessible(method);
|
ReflectionUtils.makeAccessible(method);
|
||||||
if (StringUtils.isNotBlank(params)) {
|
if (StringUtils.isNotBlank(params)) {
|
||||||
return method.invoke(target, params);
|
return method.invoke(target, params);
|
||||||
} else {
|
} else {
|
||||||
return method.invoke(target);
|
return method.invoke(target, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-45
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.framework.redis;
|
package cn.odboy.framework.redis;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
@@ -29,13 +28,13 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.redis.connection.RedisConnection;
|
import org.springframework.data.redis.connection.RedisConnection;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.ConvertingCursor;
|
import org.springframework.data.redis.core.ConvertingCursor;
|
||||||
import org.springframework.data.redis.core.Cursor;
|
import org.springframework.data.redis.core.Cursor;
|
||||||
import org.springframework.data.redis.core.RedisCallback;
|
|
||||||
import org.springframework.data.redis.core.RedisConnectionUtils;
|
import org.springframework.data.redis.core.RedisConnectionUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.core.ScanOptions;
|
import org.springframework.data.redis.core.ScanOptions;
|
||||||
@@ -43,12 +42,10 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@SuppressWarnings({"unchecked", "all"})
|
|
||||||
public class KitRedisHelper {
|
public class KitRedisHelper {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(KitRedisHelper.class);
|
private static final Logger log = LoggerFactory.getLogger(KitRedisHelper.class);
|
||||||
|
private final RedisTemplate<Object, Object> redisTemplate;
|
||||||
private RedisTemplate<Object, Object> redisTemplate;
|
|
||||||
|
|
||||||
public KitRedisHelper(RedisTemplate<Object, Object> redisTemplate) {
|
public KitRedisHelper(RedisTemplate<Object, Object> redisTemplate) {
|
||||||
this.redisTemplate = redisTemplate;
|
this.redisTemplate = redisTemplate;
|
||||||
@@ -99,7 +96,7 @@ public class KitRedisHelper {
|
|||||||
* @param key 键 不能为null
|
* @param key 键 不能为null
|
||||||
* @return 时间(秒) 返回0代表为永久有效
|
* @return 时间(秒) 返回0代表为永久有效
|
||||||
*/
|
*/
|
||||||
public long getExpire(Object key) {
|
public Long getExpire(Object key) {
|
||||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,10 +110,12 @@ public class KitRedisHelper {
|
|||||||
ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
|
ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
|
||||||
RedisConnectionFactory factory = redisTemplate.getConnectionFactory();
|
RedisConnectionFactory factory = redisTemplate.getConnectionFactory();
|
||||||
RedisConnection rc = Objects.requireNonNull(factory).getConnection();
|
RedisConnection rc = Objects.requireNonNull(factory).getConnection();
|
||||||
Cursor<byte[]> cursor = rc.scan(options);
|
List<String> result;
|
||||||
List<String> result = new ArrayList<>();
|
try (Cursor<byte[]> cursor = rc.scan(options)) {
|
||||||
while (cursor.hasNext()) {
|
result = new ArrayList<>();
|
||||||
result.add(new String(cursor.next()));
|
while (cursor.hasNext()) {
|
||||||
|
result.add(new String(cursor.next()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
RedisConnectionUtils.releaseConnection(rc, factory);
|
RedisConnectionUtils.releaseConnection(rc, factory);
|
||||||
@@ -172,7 +171,7 @@ public class KitRedisHelper {
|
|||||||
*/
|
*/
|
||||||
public boolean hasKey(String key) {
|
public boolean hasKey(String key) {
|
||||||
try {
|
try {
|
||||||
return redisTemplate.hasKey(key);
|
return Boolean.TRUE.equals(redisTemplate.hasKey(key));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
@@ -182,27 +181,23 @@ public class KitRedisHelper {
|
|||||||
/**
|
/**
|
||||||
* 删除缓存
|
* 删除缓存
|
||||||
*
|
*
|
||||||
* @param key 可以传一个值 或多个
|
* @param keys 可以传一个值 或多个
|
||||||
*/
|
*/
|
||||||
public void del(String... keys) {
|
public void del(String... keys) {
|
||||||
if (keys != null && keys.length > 0) {
|
if (keys != null && keys.length > 0) {
|
||||||
if (keys.length == 1) {
|
if (keys.length == 1) {
|
||||||
boolean result = redisTemplate.delete(keys[0]);
|
boolean result = Boolean.TRUE.equals(redisTemplate.delete(keys[0]));
|
||||||
log.debug("--------------------------------------------");
|
log.debug("删除缓存:{}, 结果:{}", keys[0], result);
|
||||||
log.debug(new StringBuilder("删除缓存:").append(keys[0]).append(", 结果:").append(result).toString());
|
|
||||||
log.debug("--------------------------------------------");
|
|
||||||
} else {
|
} else {
|
||||||
Set<Object> keySet = new HashSet<>();
|
Set<Object> keySet = new HashSet<>();
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
if (redisTemplate.hasKey(key)) {
|
if (Boolean.TRUE.equals(redisTemplate.hasKey(key))) {
|
||||||
keySet.add(key);
|
keySet.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long count = redisTemplate.delete(keySet);
|
Long count = redisTemplate.delete(keySet);
|
||||||
log.debug("--------------------------------------------");
|
log.debug("成功删除缓存:{}", keySet);
|
||||||
log.debug("成功删除缓存:" + keySet.toString());
|
log.debug("缓存删除数量:{}个", count);
|
||||||
log.debug("缓存删除数量:" + count + "个");
|
|
||||||
log.debug("--------------------------------------------");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,19 +205,36 @@ public class KitRedisHelper {
|
|||||||
/**
|
/**
|
||||||
* 批量模糊删除key
|
* 批量模糊删除key
|
||||||
*
|
*
|
||||||
* @param pattern
|
* @param pattern /
|
||||||
*/
|
*/
|
||||||
public void scanDel(String pattern) {
|
public void scanDel(String pattern) {
|
||||||
ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
|
ScanOptions options = ScanOptions.scanOptions().match(pattern).count(100).build();
|
||||||
try (Cursor<byte[]> cursor = redisTemplate.executeWithStickyConnection(
|
try (Cursor<byte[]> cursor = redisTemplate.executeWithStickyConnection(connection -> {
|
||||||
(RedisCallback<Cursor<byte[]>>) connection -> (Cursor<byte[]>) new ConvertingCursor<>(
|
try {
|
||||||
connection.scan(options), redisTemplate.getKeySerializer()::deserialize))) {
|
return (Cursor<byte[]>) new ConvertingCursor<>(
|
||||||
while (cursor.hasNext()) {
|
connection.scan(options), redisTemplate.getKeySerializer()::deserialize);
|
||||||
redisTemplate.delete(cursor.next());
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Redis scan operation failed", e);
|
||||||
}
|
}
|
||||||
|
})) {
|
||||||
|
List<Object> keysToDelete = new ArrayList<>();
|
||||||
|
while (cursor.hasNext()) {
|
||||||
|
Object key = cursor.next();
|
||||||
|
keysToDelete.add(key);
|
||||||
|
// 批量删除,避免一次性删除过多key
|
||||||
|
if (keysToDelete.size() >= 100) {
|
||||||
|
redisTemplate.delete(keysToDelete);
|
||||||
|
keysToDelete.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 删除剩余的key
|
||||||
|
if (!keysToDelete.isEmpty()) {
|
||||||
|
redisTemplate.delete(keysToDelete);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Error during scan and delete operation", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================String=============================
|
// ============================String=============================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -246,7 +258,7 @@ public class KitRedisHelper {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 如果 value 不是目标类型, 则尝试将其反序列化为 clazz 类型 by
|
// 如果 value 不是目标类型, 则尝试将其反序列化为 clazz 类型
|
||||||
if (!clazz.isInstance(value)) {
|
if (!clazz.isInstance(value)) {
|
||||||
return JSON.parseObject(value.toString(), clazz);
|
return JSON.parseObject(value.toString(), clazz);
|
||||||
} else if (clazz.isInstance(value)) {
|
} else if (clazz.isInstance(value)) {
|
||||||
@@ -268,10 +280,11 @@ public class KitRedisHelper {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (value instanceof List<?> list) {
|
if (value instanceof List<?>) {
|
||||||
|
List<?> list = (List<?>) value;
|
||||||
// 检查每个元素是否为指定类型
|
// 检查每个元素是否为指定类型
|
||||||
if (list.stream().allMatch(clazz::isInstance)) {
|
if (list.stream().allMatch(clazz::isInstance)) {
|
||||||
return list.stream().map(clazz::cast).toList();
|
return list.stream().map(clazz::cast).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -302,8 +315,8 @@ public class KitRedisHelper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Object> multiGet(List<String> keys) {
|
public List<Object> multiGet(List<String> keys) {
|
||||||
List list = redisTemplate.opsForValue().multiGet(Sets.newHashSet(keys));
|
List<Object> list = redisTemplate.opsForValue().multiGet(Sets.newHashSet(keys));
|
||||||
List resultList = Lists.newArrayList();
|
List<Object> resultList = Lists.newArrayList();
|
||||||
Optional.ofNullable(list)
|
Optional.ofNullable(list)
|
||||||
.ifPresent(e -> list.forEach(ele -> Optional.ofNullable(ele).ifPresent(resultList::add)));
|
.ifPresent(e -> list.forEach(ele -> Optional.ofNullable(ele).ifPresent(resultList::add)));
|
||||||
return resultList;
|
return resultList;
|
||||||
@@ -374,7 +387,6 @@ public class KitRedisHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================Map=================================
|
// ================================Map=================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -520,7 +532,6 @@ public class KitRedisHelper {
|
|||||||
public double hdecr(String key, String item, double by) {
|
public double hdecr(String key, String item, double by) {
|
||||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================set=============================
|
// ============================set=============================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -547,7 +558,7 @@ public class KitRedisHelper {
|
|||||||
*/
|
*/
|
||||||
public boolean sHasKey(String key, Object value) {
|
public boolean sHasKey(String key, Object value) {
|
||||||
try {
|
try {
|
||||||
return redisTemplate.opsForSet().isMember(key, value);
|
return Boolean.TRUE.equals(redisTemplate.opsForSet().isMember(key, value));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
@@ -563,10 +574,11 @@ public class KitRedisHelper {
|
|||||||
*/
|
*/
|
||||||
public long sSet(String key, Object... values) {
|
public long sSet(String key, Object... values) {
|
||||||
try {
|
try {
|
||||||
return redisTemplate.opsForSet().add(key, values);
|
Long add = redisTemplate.opsForSet().add(key, values);
|
||||||
|
return add == null ? 0L : add;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
return 0;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +596,7 @@ public class KitRedisHelper {
|
|||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
expire(key, time);
|
expire(key, time);
|
||||||
}
|
}
|
||||||
return count;
|
return count == null ? 0 : count;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -599,7 +611,8 @@ public class KitRedisHelper {
|
|||||||
*/
|
*/
|
||||||
public long sGetSetSize(String key) {
|
public long sGetSetSize(String key) {
|
||||||
try {
|
try {
|
||||||
return redisTemplate.opsForSet().size(key);
|
Long size = redisTemplate.opsForSet().size(key);
|
||||||
|
return size == null ? 0 : size;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -622,7 +635,6 @@ public class KitRedisHelper {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===============================list=================================
|
// ===============================list=================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -795,7 +807,6 @@ public class KitRedisHelper {
|
|||||||
}
|
}
|
||||||
long count = redisTemplate.delete(keys);
|
long count = redisTemplate.delete(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================incr=============================
|
// ============================incr=============================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -838,7 +849,7 @@ public class KitRedisHelper {
|
|||||||
* @param unit 时间单位
|
* @param unit 时间单位
|
||||||
* @return 如果设置成功返回true,否则返回false
|
* @return 如果设置成功返回true,否则返回false
|
||||||
*/
|
*/
|
||||||
public Boolean setIfAbsent(String key, Object value, long timeout, TimeUnit unit) {
|
public boolean setIfAbsent(String key, Object value, long timeout, TimeUnit unit) {
|
||||||
try {
|
try {
|
||||||
String stringValue = ObjUtil.toString(value);
|
String stringValue = ObjUtil.toString(value);
|
||||||
// 使用Redis的SETNX命令实现原子性操作
|
// 使用Redis的SETNX命令实现原子性操作
|
||||||
|
|||||||
+5
-4
@@ -23,6 +23,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.digest.MurmurHash3;
|
import org.apache.commons.codec.digest.MurmurHash3;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
@@ -130,25 +131,25 @@ public class RedisConfiguration {
|
|||||||
public CacheErrorHandler errorHandler() {
|
public CacheErrorHandler errorHandler() {
|
||||||
return new SimpleCacheErrorHandler() {
|
return new SimpleCacheErrorHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleCacheGetError(RuntimeException exception, Cache cache, Object key) {
|
public void handleCacheGetError(@NonNull RuntimeException exception, @NonNull Cache cache, @NonNull Object key) {
|
||||||
// 处理缓存读取错误
|
// 处理缓存读取错误
|
||||||
log.error("Cache Get Error: {}", exception.getMessage());
|
log.error("Cache Get Error: {}", exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCachePutError(RuntimeException exception, Cache cache, Object key, Object value) {
|
public void handleCachePutError(@NonNull RuntimeException exception, @NonNull Cache cache, @NonNull Object key, @NonNull Object value) {
|
||||||
// 处理缓存写入错误
|
// 处理缓存写入错误
|
||||||
log.error("Cache Put Error: {}", exception.getMessage());
|
log.error("Cache Put Error: {}", exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCacheEvictError(RuntimeException exception, Cache cache, Object key) {
|
public void handleCacheEvictError(@NonNull RuntimeException exception, @NonNull Cache cache, @NonNull Object key) {
|
||||||
// 处理缓存删除错误
|
// 处理缓存删除错误
|
||||||
log.error("Cache Evict Error: {}", exception.getMessage());
|
log.error("Cache Evict Error: {}", exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCacheClearError(RuntimeException exception, Cache cache) {
|
public void handleCacheClearError(@NonNull RuntimeException exception, @NonNull Cache cache) {
|
||||||
// 处理缓存清除错误
|
// 处理缓存清除错误
|
||||||
log.error("Cache Clear Error: {}", exception.getMessage());
|
log.error("Cache Clear Error: {}", exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-13
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.odboy.annotation.AnonymousAccess;
|
import cn.odboy.annotation.AnonymousAccess;
|
||||||
@@ -30,7 +28,7 @@ import lombok.experimental.UtilityClass;
|
|||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition;
|
import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
|
||||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
|
|
||||||
@@ -48,9 +46,9 @@ public class KitAnonTagUtil {
|
|||||||
*/
|
*/
|
||||||
public static Map<String, Set<String>> getAnonymousUrl(final ApplicationContext applicationContext) {
|
public static Map<String, Set<String>> getAnonymousUrl(final ApplicationContext applicationContext) {
|
||||||
RequestMappingHandlerMapping requestMappingHandlerMapping =
|
RequestMappingHandlerMapping requestMappingHandlerMapping =
|
||||||
applicationContext.getBean(RequestMappingHandlerMapping.class);
|
(RequestMappingHandlerMapping) applicationContext.getBean("requestMappingHandlerMapping");
|
||||||
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods();
|
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods();
|
||||||
Map<String, java.util.Set<String>> anonymousUrls = new HashMap<>(8);
|
Map<String, Set<String>> anonymousUrls = new HashMap<>(8);
|
||||||
// 获取匿名标记
|
// 获取匿名标记
|
||||||
Set<String> get = new HashSet<>();
|
Set<String> get = new HashSet<>();
|
||||||
Set<String> post = new HashSet<>();
|
Set<String> post = new HashSet<>();
|
||||||
@@ -66,15 +64,27 @@ public class KitAnonTagUtil {
|
|||||||
new ArrayList<>(infoEntry.getKey().getMethodsCondition().getMethods());
|
new ArrayList<>(infoEntry.getKey().getMethodsCondition().getMethods());
|
||||||
RequestMethodEnum request = RequestMethodEnum.find(
|
RequestMethodEnum request = RequestMethodEnum.find(
|
||||||
requestMethods.isEmpty() ? RequestMethodEnum.ALL.getType() : requestMethods.get(0).name());
|
requestMethods.isEmpty() ? RequestMethodEnum.ALL.getType() : requestMethods.get(0).name());
|
||||||
PathPatternsRequestCondition pathPatternsCondition = infoEntry.getKey().getPathPatternsCondition();
|
PatternsRequestCondition patternsCondition = infoEntry.getKey().getPatternsCondition();
|
||||||
if (pathPatternsCondition != null) {
|
if (patternsCondition != null) {
|
||||||
switch (Objects.requireNonNull(request)) {
|
switch (Objects.requireNonNull(request)) {
|
||||||
case GET -> get.addAll(pathPatternsCondition.getPatternValues());
|
case GET:
|
||||||
case POST -> post.addAll(pathPatternsCondition.getPatternValues());
|
get.addAll(patternsCondition.getPatterns());
|
||||||
case PUT -> put.addAll(pathPatternsCondition.getPatternValues());
|
break;
|
||||||
case PATCH -> patch.addAll(pathPatternsCondition.getPatternValues());
|
case POST:
|
||||||
case DELETE -> delete.addAll(pathPatternsCondition.getPatternValues());
|
post.addAll(patternsCondition.getPatterns());
|
||||||
default -> all.addAll(pathPatternsCondition.getPatternValues());
|
break;
|
||||||
|
case PUT:
|
||||||
|
put.addAll(patternsCondition.getPatterns());
|
||||||
|
break;
|
||||||
|
case PATCH:
|
||||||
|
patch.addAll(patternsCondition.getPatterns());
|
||||||
|
break;
|
||||||
|
case DELETE:
|
||||||
|
delete.addAll(patternsCondition.getPatterns());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
all.addAll(patternsCondition.getPatterns());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.hutool.core.codec.Base64Encoder;
|
import cn.hutool.core.codec.Base64Encoder;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package cn.odboy.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bean拷贝相关
|
||||||
|
*
|
||||||
|
* @author odboy
|
||||||
|
* @date 2026-01-06
|
||||||
|
*/
|
||||||
|
@UtilityClass
|
||||||
|
public class KitBeanUtil {
|
||||||
|
|
||||||
|
public static <T> T copyToClass(Object source, Class<T> tClass) {
|
||||||
|
return BeanUtil.copyProperties(source, tClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void copyToTarget(Object source, Object target) {
|
||||||
|
BeanUtil.copyProperties(source, target, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> copyToList(Collection<?> collection, Class<T> targetType) {
|
||||||
|
List<T> ts = BeanUtil.copyToList(collection, targetType);
|
||||||
|
if (ts == null) {
|
||||||
|
return new ArrayList<>(0);
|
||||||
|
}
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-16
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -34,14 +32,14 @@ public final class KitBigDecimalUtil {
|
|||||||
* @return 转换后的 BigDecimal
|
* @return 转换后的 BigDecimal
|
||||||
*/
|
*/
|
||||||
private static BigDecimal toBigDecimal(Object obj) {
|
private static BigDecimal toBigDecimal(Object obj) {
|
||||||
if (obj instanceof BigDecimal b) {
|
if (obj instanceof BigDecimal) {
|
||||||
return b;
|
return (BigDecimal) obj;
|
||||||
} else if (obj instanceof Long l) {
|
} else if (obj instanceof Long) {
|
||||||
return BigDecimal.valueOf(l);
|
return BigDecimal.valueOf((Long) obj);
|
||||||
} else if (obj instanceof Integer i) {
|
} else if (obj instanceof Integer) {
|
||||||
return BigDecimal.valueOf(i);
|
return BigDecimal.valueOf((Integer) obj);
|
||||||
} else if (obj instanceof Double d) {
|
} else if (obj instanceof Double) {
|
||||||
return new BigDecimal(d);
|
return new BigDecimal(String.valueOf(obj));
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unsupported type");
|
throw new IllegalArgumentException("Unsupported type");
|
||||||
}
|
}
|
||||||
@@ -78,12 +76,12 @@ public final class KitBigDecimalUtil {
|
|||||||
*
|
*
|
||||||
* @param a 乘数
|
* @param a 乘数
|
||||||
* @param b 乘数
|
* @param b 乘数
|
||||||
* @return 两个乘数的积, 保留两位小数
|
* @return 两个乘数的积, 保留6位小数
|
||||||
*/
|
*/
|
||||||
public static BigDecimal multiply(Object a, Object b) {
|
public static BigDecimal multiply(Object a, Object b) {
|
||||||
BigDecimal bdA = toBigDecimal(a);
|
BigDecimal bdA = toBigDecimal(a);
|
||||||
BigDecimal bdB = toBigDecimal(b);
|
BigDecimal bdB = toBigDecimal(b);
|
||||||
return bdA.multiply(bdB).setScale(2, RoundingMode.HALF_UP);
|
return bdA.multiply(bdB).setScale(6, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +94,7 @@ public final class KitBigDecimalUtil {
|
|||||||
public static BigDecimal divide(Object a, Object b) {
|
public static BigDecimal divide(Object a, Object b) {
|
||||||
BigDecimal bdA = toBigDecimal(a);
|
BigDecimal bdA = toBigDecimal(a);
|
||||||
BigDecimal bdB = toBigDecimal(b);
|
BigDecimal bdB = toBigDecimal(b);
|
||||||
return bdA.divide(bdB, 2, RoundingMode.HALF_UP);
|
return bdA.divide(bdB, 6, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,15 +136,12 @@ public final class KitBigDecimalUtil {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
BigDecimal num1 = new BigDecimal("10.123");
|
BigDecimal num1 = new BigDecimal("10.123");
|
||||||
BigDecimal num2 = new BigDecimal("2.456");
|
BigDecimal num2 = new BigDecimal("2.456");
|
||||||
|
|
||||||
System.out.println("加法结果: " + add(num1, num2));
|
System.out.println("加法结果: " + add(num1, num2));
|
||||||
System.out.println("减法结果: " + subtract(num1, num2));
|
System.out.println("减法结果: " + subtract(num1, num2));
|
||||||
System.out.println("乘法结果: " + multiply(num1, num2));
|
System.out.println("乘法结果: " + multiply(num1, num2));
|
||||||
System.out.println("除法结果: " + divide(num1, num2));
|
System.out.println("除法结果: " + divide(num1, num2));
|
||||||
|
|
||||||
Long cents = 12345L;
|
Long cents = 12345L;
|
||||||
System.out.println("分转元结果: " + centsToYuan(cents));
|
System.out.println("分转元结果: " + centsToYuan(cents));
|
||||||
|
|
||||||
BigDecimal yuan = new BigDecimal("123.45");
|
BigDecimal yuan = new BigDecimal("123.45");
|
||||||
System.out.println("元转分结果: " + yuanToCents(yuan));
|
System.out.println("元转分结果: " + yuanToCents(yuan));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -13,14 +13,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.hutool.http.useragent.UserAgent;
|
import cn.hutool.http.useragent.UserAgent;
|
||||||
import cn.hutool.http.useragent.UserAgentUtil;
|
import cn.hutool.http.useragent.UserAgentUtil;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -28,8 +26,7 @@ import lombok.experimental.UtilityClass;
|
|||||||
@UtilityClass
|
@UtilityClass
|
||||||
public final class KitClassUtil {
|
public final class KitClassUtil {
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked", "all"})
|
public static List<Field> getAllFields(Class<?> clazz, List<Field> fields) {
|
||||||
public static List<Field> getAllFields(Class clazz, List<Field> fields) {
|
|
||||||
if (clazz != null) {
|
if (clazz != null) {
|
||||||
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||||
getAllFields(clazz.getSuperclass(), fields);
|
getAllFields(clazz.getSuperclass(), fields);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|||||||
+6
-5
@@ -13,9 +13,9 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.odboy.base.KitSelectOptionVo;
|
import cn.odboy.base.KitSelectOptionVo;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -39,7 +39,7 @@ import lombok.experimental.UtilityClass;
|
|||||||
* @date 2022-11-09
|
* @date 2022-11-09
|
||||||
*/
|
*/
|
||||||
@UtilityClass
|
@UtilityClass
|
||||||
public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
public final class KitCollUtil extends CollUtil {
|
||||||
|
|
||||||
private static <T, K> Predicate<T> distinctPredicate(Function<? super T, ? extends K> keyMapper) {
|
private static <T, K> Predicate<T> distinctPredicate(Function<? super T, ? extends K> keyMapper) {
|
||||||
Map<Object, Boolean> map = new HashMap<>(3);
|
Map<Object, Boolean> map = new HashMap<>(3);
|
||||||
@@ -52,7 +52,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
|||||||
* 使用方式: list = CollUtil.streamDistinct(list, Object::getXXX)
|
* 使用方式: list = CollUtil.streamDistinct(list, Object::getXXX)
|
||||||
*/
|
*/
|
||||||
public static <T, K> List<T> streamDistinct(List<T> data, Function<? super T, ? extends K> keyMapper) {
|
public static <T, K> List<T> streamDistinct(List<T> data, Function<? super T, ? extends K> keyMapper) {
|
||||||
return data.stream().filter(distinctPredicate(keyMapper)).toList();
|
return data.stream().filter(distinctPredicate(keyMapper)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +68,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
|||||||
*/
|
*/
|
||||||
public static <T, U extends Comparable<? super U>> List<T> streamAscSort(List<T> data,
|
public static <T, U extends Comparable<? super U>> List<T> streamAscSort(List<T> data,
|
||||||
Function<? super T, ? extends U> keyExtractor) {
|
Function<? super T, ? extends U> keyExtractor) {
|
||||||
return data.stream().sorted(Comparator.comparing(keyExtractor)).toList();
|
return data.stream().sorted(Comparator.comparing(keyExtractor)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +84,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
|||||||
*/
|
*/
|
||||||
public static <T, U extends Comparable<? super U>> List<T> streamDescSort(List<T> data,
|
public static <T, U extends Comparable<? super U>> List<T> streamDescSort(List<T> data,
|
||||||
Function<? super T, ? extends U> keyExtractor) {
|
Function<? super T, ? extends U> keyExtractor) {
|
||||||
return data.stream().sorted(Comparator.comparing(keyExtractor).reversed()).toList();
|
return data.stream().sorted(Comparator.comparing(keyExtractor).reversed()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,6 +193,7 @@ public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
public static BigDecimal streamBigDecimalAvg(List<BigDecimal> data) {
|
public static BigDecimal streamBigDecimalAvg(List<BigDecimal> data) {
|
||||||
|
KitValidUtil.notEmpty(data, "data");
|
||||||
return data.stream().filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)
|
return data.stream().filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||||
.divide(BigDecimal.valueOf(data.size()), 6, RoundingMode.FLOOR);
|
.divide(BigDecimal.valueOf(data.size()), 6, RoundingMode.FLOOR);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-24
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
@@ -31,7 +30,7 @@ import lombok.experimental.UtilityClass;
|
|||||||
public class KitDateUtil {
|
public class KitDateUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前时间毫秒数
|
* 获取当前时间毫秒数 yyyyMMddHHmmssSSS
|
||||||
*
|
*
|
||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
@@ -40,7 +39,7 @@ public class KitDateUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前时间,但不包括毫秒数
|
* 获取当前时间,但不包括毫秒数 yyyyMMddHHmmss
|
||||||
*
|
*
|
||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
@@ -49,7 +48,7 @@ public class KitDateUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前时间,但不包括毫秒数
|
* 获取当前时间,但不包括毫秒数 yyyyMMdd
|
||||||
*
|
*
|
||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
@@ -62,39 +61,31 @@ public class KitDateUtil {
|
|||||||
*
|
*
|
||||||
* @param startTime 开始时间
|
* @param startTime 开始时间
|
||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
* @return 格式化后的时间,X天X时X分X秒X毫秒
|
* @return 格式化后的时间,X天X时X分X秒
|
||||||
*/
|
*/
|
||||||
public static String formatMillsDuration(Date startTime, Date endTime) {
|
public static String formatMillsDuration(Date startTime, Date endTime) {
|
||||||
if (startTime == null || endTime == null) {
|
if (startTime == null || endTime == null) {
|
||||||
// 什么都不返回
|
// 什么都不返回
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
long betweenSeconds = DateUtil.between(startTime, endTime, cn.hutool.core.date.DateUnit.SECOND);
|
long betweenSeconds = DateUtil.between(startTime, endTime, cn.hutool.core.date.DateUnit.SECOND);
|
||||||
|
|
||||||
long days = betweenSeconds / (24 * 60 * 60);
|
long days = betweenSeconds / (24 * 60 * 60);
|
||||||
long hours = (betweenSeconds % (24 * 60 * 60)) / (60 * 60);
|
long hours = (betweenSeconds % (24 * 60 * 60)) / (60 * 60);
|
||||||
long minutes = (betweenSeconds % (60 * 60)) / 60;
|
long minutes = (betweenSeconds % (60 * 60)) / 60;
|
||||||
long seconds = betweenSeconds % 60;
|
long seconds = betweenSeconds % 60;
|
||||||
|
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
if (days > 0) {
|
if (days > 0) {
|
||||||
result.append(days).append("天");
|
result.append(days).append("天");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hours > 0) {
|
if (hours > 0) {
|
||||||
result.append(hours).append("时");
|
result.append(hours).append("时");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minutes > 0) {
|
if (minutes > 0) {
|
||||||
result.append(minutes).append("分");
|
result.append(minutes).append("分");
|
||||||
}
|
}
|
||||||
|
if (seconds > 0 || result.length() == 0) {
|
||||||
if (seconds > 0 || result.isEmpty()) {
|
|
||||||
result.append(seconds).append("秒");
|
result.append(seconds).append("秒");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,41 +101,32 @@ public class KitDateUtil {
|
|||||||
// 什么都不返回
|
// 什么都不返回
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
long betweenMs = DateUtil.betweenMs(startTime, endTime);
|
long betweenMs = DateUtil.betweenMs(startTime, endTime);
|
||||||
long days = betweenMs / (24 * 60 * 60 * 1000);
|
long days = betweenMs / (24 * 60 * 60 * 1000);
|
||||||
long hours = (betweenMs % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000);
|
long hours = (betweenMs % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000);
|
||||||
long minutes = (betweenMs % (60 * 60 * 1000)) / (60 * 1000);
|
long minutes = (betweenMs % (60 * 60 * 1000)) / (60 * 1000);
|
||||||
long seconds = (betweenMs % (60 * 1000)) / 1000;
|
long seconds = (betweenMs % (60 * 1000)) / 1000;
|
||||||
long milliseconds = betweenMs % 1000;
|
long milliseconds = betweenMs % 1000;
|
||||||
|
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
if (days > 0) {
|
if (days > 0) {
|
||||||
result.append(days).append("天");
|
result.append(days).append("天");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hours > 0) {
|
if (hours > 0) {
|
||||||
result.append(hours).append("时");
|
result.append(hours).append("时");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minutes > 0) {
|
if (minutes > 0) {
|
||||||
result.append(minutes).append("分");
|
result.append(minutes).append("分");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seconds > 0) {
|
if (seconds > 0) {
|
||||||
result.append(seconds).append("秒");
|
result.append(seconds).append("秒");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (milliseconds > 0) {
|
if (milliseconds > 0) {
|
||||||
result.append(milliseconds).append("毫秒");
|
result.append(milliseconds).append("毫秒");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果所有单位都是0,则显示0毫秒
|
// 如果所有单位都是0,则显示0毫秒
|
||||||
if (result.isEmpty()) {
|
if (result.length() == 0) {
|
||||||
result.append("0毫秒");
|
result.append("0毫秒");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -93,4 +92,3 @@ public final class KitDesEncryptUtil {
|
|||||||
return b2;
|
return b2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-9
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.odboy.framework.exception.BadRequestException;
|
import cn.odboy.framework.exception.BadRequestException;
|
||||||
@@ -25,6 +24,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
* @author odboy
|
* @author odboy
|
||||||
* @date 2025-04-05
|
* @date 2025-04-05
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public final class KitDistributedIdUtil {
|
public final class KitDistributedIdUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +43,6 @@ public final class KitDistributedIdUtil {
|
|||||||
* 序列号所占位数
|
* 序列号所占位数
|
||||||
*/
|
*/
|
||||||
private final long sequenceBits;
|
private final long sequenceBits;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据中心 ID 最大值
|
* 数据中心 ID 最大值
|
||||||
*/
|
*/
|
||||||
@@ -56,7 +55,6 @@ public final class KitDistributedIdUtil {
|
|||||||
* 序列号最大值
|
* 序列号最大值
|
||||||
*/
|
*/
|
||||||
private final long sequenceMask;
|
private final long sequenceMask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器 ID 向左移位数
|
* 机器 ID 向左移位数
|
||||||
*/
|
*/
|
||||||
@@ -69,7 +67,6 @@ public final class KitDistributedIdUtil {
|
|||||||
* 时间戳向左移位数
|
* 时间戳向左移位数
|
||||||
*/
|
*/
|
||||||
private final long timestampLeftShift;
|
private final long timestampLeftShift;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据中心 ID
|
* 数据中心 ID
|
||||||
*/
|
*/
|
||||||
@@ -101,15 +98,12 @@ public final class KitDistributedIdUtil {
|
|||||||
this.dataCenterIdBits = dataCenterIdBits;
|
this.dataCenterIdBits = dataCenterIdBits;
|
||||||
this.workerIdBits = workerIdBits;
|
this.workerIdBits = workerIdBits;
|
||||||
this.sequenceBits = sequenceBits;
|
this.sequenceBits = sequenceBits;
|
||||||
|
|
||||||
this.maxDataCenterId = ~(-1L << dataCenterIdBits);
|
this.maxDataCenterId = ~(-1L << dataCenterIdBits);
|
||||||
this.maxWorkerId = ~(-1L << workerIdBits);
|
this.maxWorkerId = ~(-1L << workerIdBits);
|
||||||
this.sequenceMask = ~(-1L << sequenceBits);
|
this.sequenceMask = ~(-1L << sequenceBits);
|
||||||
|
|
||||||
this.workerIdShift = sequenceBits;
|
this.workerIdShift = sequenceBits;
|
||||||
this.dataCenterIdShift = sequenceBits + workerIdBits;
|
this.dataCenterIdShift = sequenceBits + workerIdBits;
|
||||||
this.timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
|
this.timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
|
||||||
|
|
||||||
if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
|
if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Data center ID can't be greater than " + maxDataCenterId + " or less than 0");
|
"Data center ID can't be greater than " + maxDataCenterId + " or less than 0");
|
||||||
@@ -153,14 +147,12 @@ public final class KitDistributedIdUtil {
|
|||||||
*/
|
*/
|
||||||
public long nextId() {
|
public long nextId() {
|
||||||
long currentTimestamp = System.currentTimeMillis();
|
long currentTimestamp = System.currentTimeMillis();
|
||||||
|
|
||||||
// 如果当前时间戳小于上一次生成 ID 的时间戳, 说明时钟回拨,抛出异常
|
// 如果当前时间戳小于上一次生成 ID 的时间戳, 说明时钟回拨,抛出异常
|
||||||
if (currentTimestamp < lastTimestamp.get()) {
|
if (currentTimestamp < lastTimestamp.get()) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
"Clock moved backwards. Refusing to generate id for " + (lastTimestamp.get() - currentTimestamp) +
|
"Clock moved backwards. Refusing to generate id for " + (lastTimestamp.get() - currentTimestamp) +
|
||||||
" milliseconds");
|
" milliseconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
long lastTimestampValue = lastTimestamp.get();
|
long lastTimestampValue = lastTimestamp.get();
|
||||||
if (currentTimestamp == lastTimestampValue) {
|
if (currentTimestamp == lastTimestampValue) {
|
||||||
// 同一毫秒内,序列号自增
|
// 同一毫秒内,序列号自增
|
||||||
|
|||||||
+5
-8
@@ -20,6 +20,7 @@ import static cn.odboy.constant.SystemConst.SYMBOL_AT;
|
|||||||
import static cn.odboy.constant.SystemConst.SYMBOL_EQUAL;
|
import static cn.odboy.constant.SystemConst.SYMBOL_EQUAL;
|
||||||
import static cn.odboy.constant.SystemConst.SYMBOL_SUBTRACT;
|
import static cn.odboy.constant.SystemConst.SYMBOL_SUBTRACT;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.poi.excel.BigExcelWriter;
|
import cn.hutool.poi.excel.BigExcelWriter;
|
||||||
@@ -55,7 +56,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@UtilityClass
|
@UtilityClass
|
||||||
public final class KitFileUtil extends cn.hutool.core.io.FileUtil {
|
public final class KitFileUtil extends FileUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统临时目录
|
* 系统临时目录
|
||||||
@@ -80,10 +81,6 @@ public final class KitFileUtil extends cn.hutool.core.io.FileUtil {
|
|||||||
* 定义KB的计算常量
|
* 定义KB的计算常量
|
||||||
*/
|
*/
|
||||||
private static final int KB = 1024;
|
private static final int KB = 1024;
|
||||||
/**
|
|
||||||
* 格式化小数
|
|
||||||
*/
|
|
||||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MultipartFile转File
|
* MultipartFile转File
|
||||||
@@ -112,13 +109,13 @@ public final class KitFileUtil extends cn.hutool.core.io.FileUtil {
|
|||||||
String resultSize;
|
String resultSize;
|
||||||
if (size / GB >= 1) {
|
if (size / GB >= 1) {
|
||||||
//如果当前Byte的值大于等于1GB
|
//如果当前Byte的值大于等于1GB
|
||||||
resultSize = DF.format(size / (float) GB) + " GB";
|
resultSize = new DecimalFormat("0.00").format(size / (float) GB) + " GB";
|
||||||
} else if (size / MB >= 1) {
|
} else if (size / MB >= 1) {
|
||||||
//如果当前Byte的值大于等于1MB
|
//如果当前Byte的值大于等于1MB
|
||||||
resultSize = DF.format(size / (float) MB) + " MB";
|
resultSize = new DecimalFormat("0.00").format(size / (float) MB) + " MB";
|
||||||
} else if (size / KB >= 1) {
|
} else if (size / KB >= 1) {
|
||||||
//如果当前Byte的值大于等于1KB
|
//如果当前Byte的值大于等于1KB
|
||||||
resultSize = DF.format(size / (float) KB) + " KB";
|
resultSize = new DecimalFormat("0.00").format(size / (float) KB) + " KB";
|
||||||
} else {
|
} else {
|
||||||
resultSize = size + " B";
|
resultSize = size + " B";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||||
|
|||||||
+2
-3
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
@@ -32,12 +31,12 @@ import lombok.experimental.UtilityClass;
|
|||||||
public final class KitJsonUtil {
|
public final class KitJsonUtil {
|
||||||
|
|
||||||
public static <K, V> Map<K, V> toMap(String jsonStr, Class<K> kClass, Class<V> vClass) {
|
public static <K, V> Map<K, V> toMap(String jsonStr, Class<K> kClass, Class<V> vClass) {
|
||||||
return JSON.parseObject(jsonStr, new TypeReference<>() {
|
return JSON.parseObject(jsonStr, new TypeReference<Map<K, V>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <V> List<V> toList(String jsonStr, Class<V> vClass) {
|
public static <V> List<V> toList(String jsonStr, Class<V> vClass) {
|
||||||
return JSON.parseObject(jsonStr, new TypeReference<>() {
|
return JSON.parseObject(jsonStr, new TypeReference<List<V>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
@@ -41,7 +40,7 @@ public final class KitListUtil {
|
|||||||
*/
|
*/
|
||||||
public static <T, K> List<T> distinctByArgs(List<T> items, Function<? super T, ? extends K> classifier) {
|
public static <T, K> List<T> distinctByArgs(List<T> items, Function<? super T, ? extends K> classifier) {
|
||||||
return items.stream().collect(Collectors.groupingBy(classifier)).values().stream()
|
return items.stream().collect(Collectors.groupingBy(classifier)).values().stream()
|
||||||
.map(monitorItem -> monitorItem.iterator().next()).toList();
|
.map(monitorItem -> monitorItem.iterator().next()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
|||||||
@@ -13,14 +13,10 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@@ -63,13 +59,6 @@ public final class KitPageUtil extends cn.hutool.core.util.PageUtil {
|
|||||||
return new KitPageResult<>(list, list.size());
|
return new KitPageResult<>(list, list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回空数据
|
|
||||||
*/
|
|
||||||
public static <T> KitPageResult<T> emptyListData() {
|
|
||||||
return new KitPageResult<>(new ArrayList<>(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回空数据
|
* 返回空数据
|
||||||
*/
|
*/
|
||||||
@@ -83,8 +72,4 @@ public final class KitPageUtil extends cn.hutool.core.util.PageUtil {
|
|||||||
public static <T> KitPageResult<T> toPage(List<T> list, long totalElements) {
|
public static <T> KitPageResult<T> toPage(List<T> list, long totalElements) {
|
||||||
return new KitPageResult<>(list, totalElements);
|
return new KitPageResult<>(list, totalElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Page<T> getCount(BaseMapper<T> baseMapper) {
|
|
||||||
return new Page<>(1, baseMapper.selectCount(null));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Dict;
|
import cn.hutool.core.lang.Dict;
|
||||||
|
|||||||
-2
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|||||||
+1
-2
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@@ -185,7 +184,7 @@ public final class KitRsaEncryptUtil {
|
|||||||
*/
|
*/
|
||||||
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException {
|
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException {
|
||||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
||||||
keyPairGenerator.initialize(1024);
|
keyPairGenerator.initialize(4096);
|
||||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||||
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
|
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
|
||||||
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
|
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||||
|
|||||||
-12
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -40,14 +38,11 @@ public final class KitStringUtil {
|
|||||||
if (s == null) {
|
if (s == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(s.length());
|
StringBuilder sb = new StringBuilder(s.length());
|
||||||
boolean upperCase = false;
|
boolean upperCase = false;
|
||||||
for (int i = 0; i < s.length(); i++) {
|
for (int i = 0; i < s.length(); i++) {
|
||||||
char c = s.charAt(i);
|
char c = s.charAt(i);
|
||||||
|
|
||||||
if (c == SEPARATOR) {
|
if (c == SEPARATOR) {
|
||||||
upperCase = true;
|
upperCase = true;
|
||||||
} else if (upperCase) {
|
} else if (upperCase) {
|
||||||
@@ -57,7 +52,6 @@ public final class KitStringUtil {
|
|||||||
sb.append(c);
|
sb.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,18 +77,14 @@ public final class KitStringUtil {
|
|||||||
if (s == null) {
|
if (s == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
boolean upperCase = false;
|
boolean upperCase = false;
|
||||||
for (int i = 0; i < s.length(); i++) {
|
for (int i = 0; i < s.length(); i++) {
|
||||||
char c = s.charAt(i);
|
char c = s.charAt(i);
|
||||||
|
|
||||||
boolean nextUpperCase = true;
|
boolean nextUpperCase = true;
|
||||||
|
|
||||||
if (i < (s.length() - 1)) {
|
if (i < (s.length() - 1)) {
|
||||||
nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
|
nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i > 0) && Character.isUpperCase(c)) {
|
if ((i > 0) && Character.isUpperCase(c)) {
|
||||||
if (!upperCase || !nextUpperCase) {
|
if (!upperCase || !nextUpperCase) {
|
||||||
sb.append(SEPARATOR);
|
sb.append(SEPARATOR);
|
||||||
@@ -103,10 +93,8 @@ public final class KitStringUtil {
|
|||||||
} else {
|
} else {
|
||||||
upperCase = false;
|
upperCase = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(Character.toLowerCase(c));
|
sb.append(Character.toLowerCase(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 Odboy
|
* Copyright 2021-2025 Odboy
|
||||||
*
|
*
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
|
|||||||
+42
-3
@@ -13,17 +13,20 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cn.odboy.util;
|
package cn.odboy.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.odboy.framework.exception.BadRequestException;
|
import cn.odboy.framework.exception.BadRequestException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import jakarta.validation.ConstraintViolation;
|
import jakarta.validation.ConstraintViolation;
|
||||||
import jakarta.validation.Validation;
|
import jakarta.validation.Validation;
|
||||||
import jakarta.validation.Validator;
|
import jakarta.validation.Validator;
|
||||||
import jakarta.validation.ValidatorFactory;
|
import jakarta.validation.ValidatorFactory;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.groups.Default;
|
import jakarta.validation.groups.Default;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,4 +53,40 @@ public final class KitValidUtil {
|
|||||||
violations.stream().map(ConstraintViolation::getMessage).collect(Collectors.joining(",")));
|
violations.stream().map(ConstraintViolation::getMessage).collect(Collectors.joining(",")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void notNull(Object value) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new BadRequestException("参数必填");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isNull(Object value) {
|
||||||
|
if (value != null) {
|
||||||
|
throw new BadRequestException("参数非必填");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void notNull(Object value, @NotNull String name, @NotNull String code) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new BadRequestException(String.format("参数 %s(%s) 必填", name, code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isBlank(CharSequence value, @NotNull String name, @NotNull String code) {
|
||||||
|
if (StrUtil.isNotBlank(value)) {
|
||||||
|
throw new BadRequestException(String.format("参数 %s(%s) 非必填", name, code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void notBlank(CharSequence value, @NotNull String name, @NotNull String code) {
|
||||||
|
if (StrUtil.isBlank(value)) {
|
||||||
|
throw new BadRequestException(String.format("参数 %s(%s) 必填", name, code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void notEmpty(List<?> data, @NotNull String code) {
|
||||||
|
if (CollUtil.isEmpty(data)) {
|
||||||
|
throw new BadRequestException(String.format("参数 %s 必填", code));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -3,12 +3,12 @@ package cn.odboy.util.xlsx;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.idev.excel.EasyExcel;
|
import cn.idev.excel.EasyExcel;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EasyExcel 导出增强工具类 (支持普通/分页模式)
|
* EasyExcel 导出增强工具类 (支持普通/分页模式)
|
||||||
|
|||||||
+1
-1
@@ -6,13 +6,13 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.idev.excel.FastExcel;
|
import cn.idev.excel.FastExcel;
|
||||||
import cn.odboy.framework.exception.BadRequestException;
|
import cn.odboy.framework.exception.BadRequestException;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>cutejava</artifactId>
|
<artifactId>cutejava</artifactId>
|
||||||
<groupId>cn.odboy</groupId>
|
<groupId>cn.odboy</groupId>
|
||||||
<version>1.4.1</version>
|
<version>1.5.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>cutejava-module-system</artifactId>
|
<artifactId>cutejava-module-system</artifactId>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.odboy</groupId>
|
<groupId>cn.odboy</groupId>
|
||||||
<artifactId>cutejava-framework</artifactId>
|
<artifactId>cutejava-framework</artifactId>
|
||||||
<version>1.4.1</version>
|
<version>1.5.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/io.minio/minio -->
|
<!-- https://mvnrepository.com/artifact/io.minio/minio -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
+1
-5
@@ -24,13 +24,9 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum SystemCaptchaBizEnum {
|
public enum SystemCaptchaBizEnum {
|
||||||
/* 通过手机号码重置邮箱 */
|
PHONE_RESET_EMAIL_CODE("10000", "phone_reset_email_code_", "SystemEmailCaptchaTemplate.ftl", "通过手机号码重置邮箱"),
|
||||||
PHONE_RESET_EMAIL_CODE("10000", "phone_reset_email_code_", "SystemEmailCaptchaTemplate.ftl",
|
|
||||||
"通过手机号码重置邮箱"), /* 通过旧邮箱重置邮箱 */
|
|
||||||
EMAIL_RESET_EMAIL_CODE("10001", "email_reset_email_code_", "SystemEmailCaptchaTemplate.ftl", "通过旧邮箱重置邮箱"),
|
EMAIL_RESET_EMAIL_CODE("10001", "email_reset_email_code_", "SystemEmailCaptchaTemplate.ftl", "通过旧邮箱重置邮箱"),
|
||||||
/* 通过手机号码重置密码 */
|
|
||||||
PHONE_RESET_PWD_CODE("10002", "phone_reset_pwd_code_", "SystemEmailCaptchaTemplate.ftl", "通过手机号码重置密码"),
|
PHONE_RESET_PWD_CODE("10002", "phone_reset_pwd_code_", "SystemEmailCaptchaTemplate.ftl", "通过手机号码重置密码"),
|
||||||
/* 通过邮箱重置密码 */
|
|
||||||
EMAIL_RESET_PWD_CODE("10003", "email_reset_pwd_code_", "SystemEmailCaptchaTemplate.ftl", "通过邮箱重置密码");
|
EMAIL_RESET_PWD_CODE("10003", "email_reset_pwd_code_", "SystemEmailCaptchaTemplate.ftl", "通过邮箱重置密码");
|
||||||
/**
|
/**
|
||||||
* 业务编码
|
* 业务编码
|
||||||
|
|||||||
+2
-3
@@ -24,9 +24,8 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum SystemDataScopeEnum {
|
public enum SystemDataScopeEnum {
|
||||||
/* 全部的数据权限 */
|
ALL("全部", "全部的数据权限"),
|
||||||
ALL("全部", "全部的数据权限"), /* 自己部门的数据权限 */
|
THIS_LEVEL("本级", "自己部门的数据权限"),
|
||||||
THIS_LEVEL("本级", "自己部门的数据权限"), /* 自定义的数据权限 */
|
|
||||||
CUSTOMIZE("自定义", "自定义的数据权限");
|
CUSTOMIZE("自定义", "自定义的数据权限");
|
||||||
private final String value;
|
private final String value;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package cn.odboy.system.constant;
|
package cn.odboy.system.constant;
|
||||||
|
|
||||||
public interface TransferProtocolConst {
|
public interface SystemTransferProtocolConst {
|
||||||
|
|
||||||
String PREFIX_HTTP = "http://";
|
String PREFIX_HTTP = "http://";
|
||||||
String PREFIX_HTTPS = "https://";
|
String PREFIX_HTTPS = "https://";
|
||||||
+1
@@ -1,6 +1,7 @@
|
|||||||
package cn.odboy.system.constant;
|
package cn.odboy.system.constant;
|
||||||
|
|
||||||
public interface SystemYesOrNoChConst {
|
public interface SystemYesOrNoChConst {
|
||||||
|
|
||||||
String YES_STR = "是";
|
String YES_STR = "是";
|
||||||
String NO_STR = "否";
|
String NO_STR = "否";
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-21
@@ -16,18 +16,16 @@
|
|||||||
package cn.odboy.system.controller;
|
package cn.odboy.system.controller;
|
||||||
|
|
||||||
import cn.odboy.annotation.AnonymousPostMapping;
|
import cn.odboy.annotation.AnonymousPostMapping;
|
||||||
import cn.odboy.system.dal.model.SystemUserInfoVo;
|
import cn.odboy.system.dal.model.request.SystemUserLoginArgs;
|
||||||
import cn.odboy.system.dal.model.SystemUserLoginArgs;
|
import cn.odboy.system.dal.model.response.SystemAuthVo;
|
||||||
import cn.odboy.system.service.SystemAuthService;
|
import cn.odboy.system.service.SystemAuthService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import java.util.Map;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -46,26 +44,11 @@ public class SystemAuthController {
|
|||||||
|
|
||||||
@ApiOperation("登录授权")
|
@ApiOperation("登录授权")
|
||||||
@AnonymousPostMapping(value = "/login")
|
@AnonymousPostMapping(value = "/login")
|
||||||
public ResponseEntity<Map<String, Object>> login(@Validated @RequestBody SystemUserLoginArgs loginRequest,
|
public ResponseEntity<SystemAuthVo> login(@Validated @RequestBody SystemUserLoginArgs loginRequest, HttpServletRequest request) throws Exception {
|
||||||
HttpServletRequest request) throws Exception {
|
SystemAuthVo loginInfo = systemAuthService.doLogin(loginRequest, request);
|
||||||
Map<String, Object> loginInfo = systemAuthService.doLogin(loginRequest, request);
|
|
||||||
return ResponseEntity.ok(loginInfo);
|
return ResponseEntity.ok(loginInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取用户信息")
|
|
||||||
@PostMapping(value = "/info")
|
|
||||||
public ResponseEntity<SystemUserInfoVo> getUserInfo() {
|
|
||||||
SystemUserInfoVo userInfoVo = systemAuthService.getCurrentUserInfoVo();
|
|
||||||
return ResponseEntity.ok(userInfoVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取验证码")
|
|
||||||
@AnonymousPostMapping(value = "/captcha/getImage")
|
|
||||||
public ResponseEntity<Map<String, Object>> getCode() {
|
|
||||||
Map<String, Object> imgResult = systemAuthService.getCaptchaInfo();
|
|
||||||
return ResponseEntity.ok(imgResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("退出登录")
|
@ApiOperation("退出登录")
|
||||||
@AnonymousPostMapping(value = "/logout")
|
@AnonymousPostMapping(value = "/logout")
|
||||||
public ResponseEntity<Void> logout(HttpServletRequest request) {
|
public ResponseEntity<Void> logout(HttpServletRequest request) {
|
||||||
|
|||||||
+10
-7
@@ -16,7 +16,8 @@
|
|||||||
package cn.odboy.system.controller;
|
package cn.odboy.system.controller;
|
||||||
|
|
||||||
import cn.odboy.system.constant.SystemCaptchaBizEnum;
|
import cn.odboy.system.constant.SystemCaptchaBizEnum;
|
||||||
import cn.odboy.system.dal.model.SystemCheckEmailCaptchaArgs;
|
import cn.odboy.system.dal.model.request.SystemCheckEmailCaptchaArgs;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemEmailService;
|
import cn.odboy.system.service.SystemEmailService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -37,23 +38,25 @@ public class SystemCaptchaController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemEmailService systemEmailService;
|
private SystemEmailService systemEmailService;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("重置邮箱, 发送验证码")
|
@ApiOperation("重置邮箱, 发送验证码")
|
||||||
@PostMapping(value = "/sendResetEmailCaptcha")
|
@PostMapping(value = "/sendResetEmailCode")
|
||||||
public ResponseEntity<Void> sendResetEmailCaptcha(@RequestParam String email) {
|
public ResponseEntity<Void> sendResetEmailCode(@RequestParam String email) {
|
||||||
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, email);
|
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, email);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("重置密码,发送验证码")
|
@ApiOperation("重置密码,发送验证码")
|
||||||
@PostMapping(value = "/sendResetPasswordCaptcha")
|
@PostMapping(value = "/sendResetPasswordCode")
|
||||||
public ResponseEntity<Void> sendResetPasswordCaptcha(@RequestParam String email) {
|
public ResponseEntity<Void> sendResetPasswordCode(@RequestParam String email) {
|
||||||
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_PWD_CODE, email);
|
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_PWD_CODE, email);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("验证码验证")
|
@ApiOperation("验证码验证")
|
||||||
@PostMapping(value = "/checkEmailCaptcha")
|
@PostMapping(value = "/verifyCode")
|
||||||
public ResponseEntity<Void> checkEmailCaptcha(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) {
|
public ResponseEntity<Void> verifyCode(@Validated @RequestBody SystemCheckEmailCaptchaArgs args) {
|
||||||
systemEmailService.checkEmailCaptcha(args);
|
systemEmailService.checkEmailCaptcha(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -34,16 +34,16 @@ public class SystemComponentController {
|
|||||||
private SystemDeptService systemDeptService;
|
private SystemDeptService systemDeptService;
|
||||||
|
|
||||||
@ApiOperation("查询部门下拉选择数据源")
|
@ApiOperation("查询部门下拉选择数据源")
|
||||||
@PostMapping(value = "/queryDeptSelectDataSource")
|
@PostMapping(value = "/listDeptSelectDataSource")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<?> queryDeptSelectDataSource() {
|
public ResponseEntity<?> listDeptSelectDataSource() {
|
||||||
return ResponseEntity.ok(systemDeptService.queryDeptSelectDataSource());
|
return ResponseEntity.ok(systemDeptService.listDeptSelectDataSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询部门下拉选择Pro数据源")
|
@ApiOperation("查询部门下拉选择Pro数据源")
|
||||||
@PostMapping(value = "/queryDeptSelectProDataSource")
|
@PostMapping(value = "/listDeptSelectProDataSource")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<?> queryDeptSelectProDataSource() {
|
public ResponseEntity<?> listDeptSelectProDataSource() {
|
||||||
return ResponseEntity.ok(systemDeptService.queryDeptSelectProDataSource());
|
return ResponseEntity.ok(systemDeptService.listDeptSelectProDataSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-13
@@ -18,8 +18,10 @@ package cn.odboy.system.controller;
|
|||||||
import cn.odboy.base.KitPageArgs;
|
import cn.odboy.base.KitPageArgs;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||||
import cn.odboy.system.dal.model.SystemCreateDeptArgs;
|
import cn.odboy.system.dal.model.request.SystemCreateDeptArgs;
|
||||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
import cn.odboy.system.dal.model.request.SystemQueryDeptArgs;
|
||||||
|
import cn.odboy.system.dal.model.response.SystemDeptVo;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemDeptService;
|
import cn.odboy.system.service.SystemDeptService;
|
||||||
import cn.odboy.util.KitPageUtil;
|
import cn.odboy.util.KitPageUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -46,6 +48,7 @@ public class SystemDeptController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemDeptService systemDeptService;
|
private SystemDeptService systemDeptService;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("导出部门数据")
|
@ApiOperation("导出部门数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check('dept:list')")
|
@PreAuthorize("@el.check('dept:list')")
|
||||||
@@ -54,22 +57,21 @@ public class SystemDeptController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询部门")
|
@ApiOperation("查询部门")
|
||||||
@PostMapping
|
@PostMapping(value = "/searchDept")
|
||||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||||
public ResponseEntity<KitPageResult<SystemDeptTb>> queryDept(
|
public ResponseEntity<KitPageResult<SystemDeptTb>> queryDept(@Validated @RequestBody KitPageArgs<SystemQueryDeptArgs> pageArgs) throws Exception {
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryDeptArgs> pageArgs) throws Exception {
|
|
||||||
List<SystemDeptTb> depts = systemDeptService.queryAllDeptByArgs(pageArgs.getArgs(), true);
|
List<SystemDeptTb> depts = systemDeptService.queryAllDeptByArgs(pageArgs.getArgs(), true);
|
||||||
return ResponseEntity.ok(KitPageUtil.toPage(depts));
|
return ResponseEntity.ok(KitPageUtil.toPage(depts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
||||||
@PostMapping("/queryDeptSuperiorTree")
|
@PostMapping("/searchDeptTree")
|
||||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||||
public ResponseEntity<KitPageResult<SystemDeptTb>> queryDeptSuperiorTree(@RequestBody List<Long> ids,
|
public ResponseEntity<KitPageResult<SystemDeptVo>> queryDeptSuperiorTree(@RequestBody List<Long> ids, @RequestParam(defaultValue = "false") Boolean exclude) {
|
||||||
@RequestParam(defaultValue = "false") Boolean exclude) {
|
|
||||||
return ResponseEntity.ok(systemDeptService.searchDeptTree(ids, exclude));
|
return ResponseEntity.ok(systemDeptService.searchDeptTree(ids, exclude));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("新增部门")
|
@ApiOperation("新增部门")
|
||||||
@PostMapping(value = "/saveDept")
|
@PostMapping(value = "/saveDept")
|
||||||
@PreAuthorize("@el.check('dept:add')")
|
@PreAuthorize("@el.check('dept:add')")
|
||||||
@@ -78,18 +80,20 @@ public class SystemDeptController {
|
|||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("修改部门")
|
@ApiOperation("修改部门")
|
||||||
@PostMapping(value = "/modifyDept")
|
@PostMapping(value = "/updateDeptById")
|
||||||
@PreAuthorize("@el.check('dept:edit')")
|
@PreAuthorize("@el.check('dept:edit')")
|
||||||
public ResponseEntity<Void> modifyDept(@Validated(SystemDeptTb.Update.class) @RequestBody SystemDeptTb args) {
|
public ResponseEntity<Void> updateDeptById(@Validated(SystemDeptTb.Update.class) @RequestBody SystemDeptTb args) {
|
||||||
systemDeptService.updateDept(args);
|
systemDeptService.updateDeptById(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("删除部门")
|
@ApiOperation("删除部门")
|
||||||
@PostMapping(value = "/removeDeptByIds")
|
@PostMapping(value = "/deleteDeptByIds")
|
||||||
@PreAuthorize("@el.check('dept:del')")
|
@PreAuthorize("@el.check('dept:del')")
|
||||||
public ResponseEntity<Void> removeDeptByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> deleteDeptByIds(@RequestBody Set<Long> ids) {
|
||||||
systemDeptService.deleteDeptByIds(ids);
|
systemDeptService.deleteDeptByIds(ids);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-16
@@ -18,14 +18,13 @@ package cn.odboy.system.controller;
|
|||||||
import cn.odboy.base.KitPageArgs;
|
import cn.odboy.base.KitPageArgs;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||||
import cn.odboy.system.dal.model.SystemCreateDictArgs;
|
import cn.odboy.system.dal.model.request.SystemCreateDictArgs;
|
||||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
import cn.odboy.system.dal.model.request.SystemQueryDictArgs;
|
||||||
import cn.odboy.system.service.SystemDictDetailService;
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemDictService;
|
import cn.odboy.system.service.SystemDictService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@@ -46,32 +45,32 @@ public class SystemDictController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemDictService systemDictService;
|
private SystemDictService systemDictService;
|
||||||
@Autowired
|
|
||||||
private SystemDictDetailService systemDictDetailService;
|
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("导出字典数据")
|
@ApiOperation("导出字典数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check('dict:list')")
|
@PreAuthorize("@el.check('dict:list')")
|
||||||
public void exportDict(HttpServletResponse response, SystemQueryDictArgs args) throws IOException {
|
public void exportDict(HttpServletResponse response, SystemQueryDictArgs args) {
|
||||||
systemDictService.exportDictXlsx(response, args);
|
systemDictService.exportDictXlsx(response, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询字典")
|
@Deprecated
|
||||||
|
@ApiOperation("查询所有字典")
|
||||||
@PostMapping(value = "/queryAllDict")
|
@PostMapping(value = "/queryAllDict")
|
||||||
@PreAuthorize("@el.check('dict:list')")
|
@PreAuthorize("@el.check('dict:list')")
|
||||||
public ResponseEntity<List<SystemDictTb>> queryAllDict() {
|
public ResponseEntity<List<SystemDictTb>> queryAllDict() {
|
||||||
return ResponseEntity.ok(systemDictService.queryDictByArgs(new SystemQueryDictArgs()));
|
return ResponseEntity.ok(systemDictService.queryDictByArgs(new SystemQueryDictArgs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询字典")
|
@ApiOperation("分页查询字典")
|
||||||
@PostMapping
|
@PostMapping(value = "/searchDict")
|
||||||
@PreAuthorize("@el.check('dict:list')")
|
@PreAuthorize("@el.check('dict:list')")
|
||||||
public ResponseEntity<KitPageResult<SystemDictTb>> queryDictByArgs(
|
public ResponseEntity<KitPageResult<SystemDictTb>> queryDictByArgs(@Validated @RequestBody KitPageArgs<SystemQueryDictArgs> pageArgs) {
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryDictArgs> pageArgs) {
|
|
||||||
Page<SystemDictTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
Page<SystemDictTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||||
return ResponseEntity.ok(systemDictService.searchDict(pageArgs.getArgs(), page));
|
return ResponseEntity.ok(systemDictService.searchDict(pageArgs.getArgs(), page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("新增字典")
|
@ApiOperation("新增字典")
|
||||||
@PostMapping(value = "/saveDict")
|
@PostMapping(value = "/saveDict")
|
||||||
@PreAuthorize("@el.check('dict:add')")
|
@PreAuthorize("@el.check('dict:add')")
|
||||||
@@ -80,18 +79,20 @@ public class SystemDictController {
|
|||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("修改字典")
|
@ApiOperation("修改字典")
|
||||||
@PostMapping(value = "/modifyDictById")
|
@PostMapping(value = "/updateDictById")
|
||||||
@PreAuthorize("@el.check('dict:edit')")
|
@PreAuthorize("@el.check('dict:edit')")
|
||||||
public ResponseEntity<Void> modifyDictById(@Validated(SystemDictTb.Update.class) @RequestBody SystemDictTb args) {
|
public ResponseEntity<Void> updateDictById(@Validated(SystemDictTb.Update.class) @RequestBody SystemDictTb args) {
|
||||||
systemDictService.updateDictById(args);
|
systemDictService.updateDictById(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("删除字典")
|
@ApiOperation("删除字典")
|
||||||
@PostMapping(value = "/removeDictByIds")
|
@PostMapping(value = "/deleteDictByIds")
|
||||||
@PreAuthorize("@el.check('dict:del')")
|
@PreAuthorize("@el.check('dict:del')")
|
||||||
public ResponseEntity<Void> removeDictByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> deleteDictByIds(@RequestBody Set<Long> ids) {
|
||||||
systemDictService.deleteDictByIds(ids);
|
systemDictService.deleteDictByIds(ids);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-18
@@ -18,9 +18,10 @@ package cn.odboy.system.controller;
|
|||||||
import cn.odboy.base.KitPageArgs;
|
import cn.odboy.base.KitPageArgs;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||||
import cn.odboy.system.dal.model.SystemCreateDictDetailArgs;
|
import cn.odboy.system.dal.model.request.SystemCreateDictDetailArgs;
|
||||||
import cn.odboy.system.dal.model.SystemDictDetailVo;
|
import cn.odboy.system.dal.model.request.SystemQueryDictDetailArgs;
|
||||||
import cn.odboy.system.dal.model.SystemQueryDictDetailArgs;
|
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemDictDetailService;
|
import cn.odboy.system.service.SystemDictDetailService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -47,16 +48,8 @@ public class SystemDictDetailController {
|
|||||||
private SystemDictDetailService systemDictDetailService;
|
private SystemDictDetailService systemDictDetailService;
|
||||||
|
|
||||||
@ApiOperation("查询字典详情")
|
@ApiOperation("查询字典详情")
|
||||||
@PostMapping
|
@PostMapping(value = "/searchDictDetail")
|
||||||
public ResponseEntity<KitPageResult<SystemDictDetailVo>> queryDictDetailByCrud(
|
public ResponseEntity<KitPageResult<SystemDictDetailVo>> queryDictDetailByArgs(@Validated @RequestBody KitPageArgs<SystemQueryDictDetailArgs> pageArgs) {
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryDictDetailArgs> args) {
|
|
||||||
return queryDictDetailByArgs(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询字典详情")
|
|
||||||
@PostMapping(value = "/queryDictDetailByArgs")
|
|
||||||
public ResponseEntity<KitPageResult<SystemDictDetailVo>> queryDictDetailByArgs(
|
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryDictDetailArgs> pageArgs) {
|
|
||||||
Page<SystemDictDetailTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
Page<SystemDictDetailTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||||
return ResponseEntity.ok(systemDictDetailService.searchDictDetail(pageArgs.getArgs(), page));
|
return ResponseEntity.ok(systemDictDetailService.searchDictDetail(pageArgs.getArgs(), page));
|
||||||
}
|
}
|
||||||
@@ -68,6 +61,7 @@ public class SystemDictDetailController {
|
|||||||
return ResponseEntity.ok(dictMap);
|
return ResponseEntity.ok(dictMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("新增字典详情")
|
@ApiOperation("新增字典详情")
|
||||||
@PostMapping(value = "/saveDictDetail")
|
@PostMapping(value = "/saveDictDetail")
|
||||||
@PreAuthorize("@el.check('dict:add')")
|
@PreAuthorize("@el.check('dict:add')")
|
||||||
@@ -76,19 +70,20 @@ public class SystemDictDetailController {
|
|||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("修改字典详情")
|
@ApiOperation("修改字典详情")
|
||||||
@PostMapping(value = "/modifyDictDetailById")
|
@PostMapping(value = "/updateDictDetailById")
|
||||||
@PreAuthorize("@el.check('dict:edit')")
|
@PreAuthorize("@el.check('dict:edit')")
|
||||||
public ResponseEntity<Void> modifyDictDetailById(
|
public ResponseEntity<Void> updateDictDetailById(@Validated(SystemDictDetailTb.Update.class) @RequestBody SystemDictDetailTb args) {
|
||||||
@Validated(SystemDictDetailTb.Update.class) @RequestBody SystemDictDetailTb args) {
|
|
||||||
systemDictDetailService.updateDictDetailById(args);
|
systemDictDetailService.updateDictDetailById(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("删除字典详情")
|
@ApiOperation("删除字典详情")
|
||||||
@PostMapping(value = "/removeDictDetailById")
|
@PostMapping(value = "/deleteDictDetailById")
|
||||||
@PreAuthorize("@el.check('dict:del')")
|
@PreAuthorize("@el.check('dict:del')")
|
||||||
public ResponseEntity<Void> removeDictDetailById(@RequestBody SystemDictDetailTb args) {
|
public ResponseEntity<Void> deleteDictDetailById(@RequestBody SystemDictDetailTb args) {
|
||||||
systemDictDetailService.deleteDictDetailById(args.getId());
|
systemDictDetailService.deleteDictDetailById(args.getId());
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-7
@@ -16,7 +16,8 @@
|
|||||||
package cn.odboy.system.controller;
|
package cn.odboy.system.controller;
|
||||||
|
|
||||||
import cn.odboy.system.dal.dataobject.SystemEmailConfigTb;
|
import cn.odboy.system.dal.dataobject.SystemEmailConfigTb;
|
||||||
import cn.odboy.system.dal.model.SystemSendEmailArgs;
|
import cn.odboy.system.dal.model.request.SystemSendEmailArgs;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemEmailService;
|
import cn.odboy.system.service.SystemEmailService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -45,17 +46,18 @@ public class SystemEmailController {
|
|||||||
return ResponseEntity.ok(systemEmailService.getLastEmailConfig());
|
return ResponseEntity.ok(systemEmailService.getLastEmailConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("配置邮件")
|
@OperationLog
|
||||||
@PostMapping(value = "/modifyEmailConfig")
|
@ApiOperation("修改邮箱配置")
|
||||||
public ResponseEntity<Void> modifyEmailConfig(@Validated @RequestBody SystemEmailConfigTb emailConfig)
|
@PostMapping(value = "/updateEmailConfigById")
|
||||||
throws Exception {
|
public ResponseEntity<Void> updateEmailConfigById(@Validated @RequestBody SystemEmailConfigTb emailConfig) throws Exception {
|
||||||
systemEmailService.updateEmailConfigById(emailConfig);
|
systemEmailService.updateEmailConfigById(emailConfig);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("发送邮件")
|
@ApiOperation("发送邮件")
|
||||||
@PostMapping(value = "/sendEmail")
|
@PostMapping(value = "/send")
|
||||||
public ResponseEntity<Void> sendEmail(@Validated @RequestBody SystemSendEmailArgs sendEmailRequest) {
|
public ResponseEntity<Void> send(@Validated @RequestBody SystemSendEmailArgs sendEmailRequest) {
|
||||||
systemEmailService.sendEmail(sendEmailRequest);
|
systemEmailService.sendEmail(sendEmailRequest);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-20
@@ -18,13 +18,13 @@ package cn.odboy.system.controller;
|
|||||||
import cn.odboy.base.KitPageArgs;
|
import cn.odboy.base.KitPageArgs;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||||
import cn.odboy.system.dal.model.SystemCreateJobArgs;
|
import cn.odboy.system.dal.model.request.SystemCreateJobArgs;
|
||||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
import cn.odboy.system.dal.model.request.SystemQueryJobArgs;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemJobService;
|
import cn.odboy.system.service.SystemJobService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -45,30 +45,23 @@ public class SystemJobController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemJobService systemJobService;
|
private SystemJobService systemJobService;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("导出岗位数据")
|
@ApiOperation("导出岗位数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check('job:list')")
|
@PreAuthorize("@el.check('job:list')")
|
||||||
public void exportJob(HttpServletResponse response, SystemQueryJobArgs args) throws IOException {
|
public void exportJob(HttpServletResponse response, SystemQueryJobArgs args) {
|
||||||
systemJobService.exportJobXlsx(response, args);
|
systemJobService.exportJobXlsx(response, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询岗位")
|
@ApiOperation("分页查询岗位")
|
||||||
@PostMapping(value = "/queryAllEnableJob")
|
@PostMapping(value = "/searchJob")
|
||||||
@PreAuthorize("@el.check('job:list','user:list')")
|
@PreAuthorize("@el.check('job:list','user:list')")
|
||||||
public ResponseEntity<KitPageResult<SystemJobTb>> queryJobByArgs(
|
public ResponseEntity<KitPageResult<SystemJobTb>> queryJobByArgs(@Validated @RequestBody KitPageArgs<SystemQueryJobArgs> pageArgs) {
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryJobArgs> pageArgs) {
|
|
||||||
Page<SystemJobTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
Page<SystemJobTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||||
return ResponseEntity.ok(systemJobService.searchJobByArgs(pageArgs.getArgs(), page));
|
return ResponseEntity.ok(systemJobService.searchJobByArgs(pageArgs.getArgs(), page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询岗位")
|
@OperationLog
|
||||||
@PostMapping
|
|
||||||
@PreAuthorize("@el.check('job:list','user:list')")
|
|
||||||
public ResponseEntity<KitPageResult<SystemJobTb>> queryJobByCrud(
|
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryJobArgs> args) {
|
|
||||||
return queryJobByArgs(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("新增岗位")
|
@ApiOperation("新增岗位")
|
||||||
@PostMapping(value = "/saveJob")
|
@PostMapping(value = "/saveJob")
|
||||||
@PreAuthorize("@el.check('job:add')")
|
@PreAuthorize("@el.check('job:add')")
|
||||||
@@ -77,18 +70,20 @@ public class SystemJobController {
|
|||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("修改岗位")
|
@ApiOperation("修改岗位")
|
||||||
@PostMapping(value = "/modifyJobById")
|
@PostMapping(value = "/updateJobById")
|
||||||
@PreAuthorize("@el.check('job:edit')")
|
@PreAuthorize("@el.check('job:edit')")
|
||||||
public ResponseEntity<Void> modifyJobById(@Validated(SystemJobTb.Update.class) @RequestBody SystemJobTb args) {
|
public ResponseEntity<Void> updateJobById(@Validated(SystemJobTb.Update.class) @RequestBody SystemJobTb args) {
|
||||||
systemJobService.updateJobById(args);
|
systemJobService.updateJobById(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("删除岗位")
|
@ApiOperation("删除岗位")
|
||||||
@PostMapping(value = "/removeJobByIds")
|
@PostMapping(value = "/deleteJobByIds")
|
||||||
@PreAuthorize("@el.check('job:del')")
|
@PreAuthorize("@el.check('job:del')")
|
||||||
public ResponseEntity<Void> removeJobByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> deleteJobByIds(@RequestBody Set<Long> ids) {
|
||||||
systemJobService.deleteJobByIds(ids);
|
systemJobService.deleteJobByIds(ids);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-11
@@ -18,12 +18,12 @@ package cn.odboy.system.controller;
|
|||||||
import cn.odboy.base.KitPageArgs;
|
import cn.odboy.base.KitPageArgs;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
import cn.odboy.system.dal.model.request.SystemQueryStorageArgs;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemLocalStorageService;
|
import cn.odboy.system.service.SystemLocalStorageService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import java.io.IOException;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -46,21 +46,22 @@ public class SystemLocalStorageController {
|
|||||||
private SystemLocalStorageService localStorageService;
|
private SystemLocalStorageService localStorageService;
|
||||||
|
|
||||||
@ApiOperation("查询文件")
|
@ApiOperation("查询文件")
|
||||||
@PostMapping
|
@PostMapping(value = "/searchLocalStorage")
|
||||||
@PreAuthorize("@el.check('storage:list')")
|
@PreAuthorize("@el.check('storage:list')")
|
||||||
public ResponseEntity<KitPageResult<SystemLocalStorageTb>> queryLocalStorage(
|
public ResponseEntity<KitPageResult<SystemLocalStorageTb>> queryLocalStorage(@Validated @RequestBody KitPageArgs<SystemQueryStorageArgs> pageArgs) {
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryStorageArgs> pageArgs) {
|
|
||||||
Page<SystemLocalStorageTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
Page<SystemLocalStorageTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||||
return ResponseEntity.ok(localStorageService.searchLocalStorage(pageArgs.getArgs(), page));
|
return ResponseEntity.ok(localStorageService.searchLocalStorage(pageArgs.getArgs(), page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
@OperationLog
|
||||||
|
@ApiOperation("导出本地存储记录数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check('storage:list')")
|
@PreAuthorize("@el.check('storage:list')")
|
||||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs args) throws IOException {
|
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||||
localStorageService.exportLocalStorageXlsx(response, args);
|
localStorageService.exportLocalStorageXlsx(response, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("上传文件")
|
@ApiOperation("上传文件")
|
||||||
@PostMapping(value = "/uploadFile")
|
@PostMapping(value = "/uploadFile")
|
||||||
@PreAuthorize("@el.check('storage:add')")
|
@PreAuthorize("@el.check('storage:add')")
|
||||||
@@ -69,6 +70,7 @@ public class SystemLocalStorageController {
|
|||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("上传图片")
|
@ApiOperation("上传图片")
|
||||||
@PostMapping("/uploadPicture")
|
@PostMapping("/uploadPicture")
|
||||||
public ResponseEntity<SystemLocalStorageTb> uploadPicture(@RequestParam MultipartFile file) {
|
public ResponseEntity<SystemLocalStorageTb> uploadPicture(@RequestParam MultipartFile file) {
|
||||||
@@ -76,16 +78,18 @@ public class SystemLocalStorageController {
|
|||||||
return ResponseEntity.ok(localStorage);
|
return ResponseEntity.ok(localStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("修改文件")
|
@ApiOperation("修改文件")
|
||||||
@PostMapping(value = "/modifyLocalStorageById")
|
@PostMapping(value = "/updateLocalStorageById")
|
||||||
@PreAuthorize("@el.check('storage:edit')")
|
@PreAuthorize("@el.check('storage:edit')")
|
||||||
public ResponseEntity<Void> modifyLocalStorageById(@Validated @RequestBody SystemLocalStorageTb args) {
|
public ResponseEntity<Void> updateLocalStorageById(@Validated @RequestBody SystemLocalStorageTb args) {
|
||||||
localStorageService.updateLocalStorageById(args);
|
localStorageService.updateLocalStorageById(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("多选删除")
|
@OperationLog
|
||||||
@PostMapping(value = "/removeFileByIds")
|
@ApiOperation("删除文件")
|
||||||
|
@PostMapping(value = "/deleteFileByIds")
|
||||||
public ResponseEntity<Void> deleteFileByIds(@RequestBody Long[] ids) {
|
public ResponseEntity<Void> deleteFileByIds(@RequestBody Long[] ids) {
|
||||||
localStorageService.deleteFileByIds(ids);
|
localStorageService.deleteFileByIds(ids);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
|
|||||||
+23
-25
@@ -19,8 +19,10 @@ import cn.odboy.base.KitPageArgs;
|
|||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.framework.exception.BadRequestException;
|
import cn.odboy.framework.exception.BadRequestException;
|
||||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
import cn.odboy.system.dal.model.request.SystemQueryMenuArgs;
|
||||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
import cn.odboy.system.dal.model.response.SystemMenuRouterVo;
|
||||||
|
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemMenuService;
|
import cn.odboy.system.service.SystemMenuService;
|
||||||
import cn.odboy.util.KitPageUtil;
|
import cn.odboy.util.KitPageUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -47,6 +49,7 @@ public class SystemMenuController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemMenuService systemMenuService;
|
private SystemMenuService systemMenuService;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("导出菜单数据")
|
@ApiOperation("导出菜单数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
@PreAuthorize("@el.check('menu:list')")
|
||||||
@@ -56,36 +59,28 @@ public class SystemMenuController {
|
|||||||
|
|
||||||
@PostMapping(value = "/buildMenus")
|
@PostMapping(value = "/buildMenus")
|
||||||
@ApiOperation("获取前端所需菜单")
|
@ApiOperation("获取前端所需菜单")
|
||||||
public ResponseEntity<List<SystemMenuVo>> buildMenus() {
|
public ResponseEntity<List<SystemMenuRouterVo>> buildMenus() {
|
||||||
List<SystemMenuVo> systemMenuVos = systemMenuService.buildFrontMenus();
|
List<SystemMenuRouterVo> systemMenuRouterVos = systemMenuService.buildFrontMenus();
|
||||||
return ResponseEntity.ok(systemMenuVos);
|
return ResponseEntity.ok(systemMenuRouterVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("返回全部的菜单")
|
@ApiOperation("返回全部的菜单")
|
||||||
@PostMapping(value = "/queryMenuListByPid")
|
@PostMapping(value = "/listMenuByPid")
|
||||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||||
public ResponseEntity<List<SystemMenuTb>> queryMenuListByPid(@RequestParam Long pid) {
|
public ResponseEntity<List<SystemMenuVo>> listMenuByPid(@RequestParam Long pid) {
|
||||||
List<SystemMenuTb> systemMenuTbs = systemMenuService.listMenuByPid(pid);
|
List<SystemMenuVo> systemMenuTbs = systemMenuService.listMenuByPid(pid);
|
||||||
return ResponseEntity.ok(systemMenuTbs);
|
return ResponseEntity.ok(systemMenuTbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
|
@ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
|
||||||
@PostMapping(value = "/queryChildMenuSet")
|
@PostMapping(value = "/listChildMenuSetByMenuId")
|
||||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||||
public ResponseEntity<Set<Long>> queryChildMenuSet(@RequestParam Long id) {
|
public ResponseEntity<Set<Long>> listChildMenuSetByMenuId(@RequestParam Long id) {
|
||||||
Set<Long> ids = systemMenuService.listChildMenuSetByMenuId(id);
|
Set<Long> ids = systemMenuService.listChildMenuSetByMenuId(id);
|
||||||
return ResponseEntity.ok(ids);
|
return ResponseEntity.ok(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping(value = "/searchMenu")
|
||||||
@ApiOperation("查询菜单")
|
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
|
||||||
public ResponseEntity<KitPageResult<SystemMenuTb>> queryAllMenuByCrud(
|
|
||||||
@Validated @RequestBody KitPageArgs<SystemQueryMenuArgs> args) throws Exception {
|
|
||||||
return queryAllMenu(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "/queryMenuByArgs")
|
|
||||||
@ApiOperation("查询菜单")
|
@ApiOperation("查询菜单")
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
@PreAuthorize("@el.check('menu:list')")
|
||||||
public ResponseEntity<KitPageResult<SystemMenuTb>> queryAllMenu(
|
public ResponseEntity<KitPageResult<SystemMenuTb>> queryAllMenu(
|
||||||
@@ -97,11 +92,12 @@ public class SystemMenuController {
|
|||||||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||||
@PostMapping("/queryMenuSuperior")
|
@PostMapping("/queryMenuSuperior")
|
||||||
@PreAuthorize("@el.check('menu:list')")
|
@PreAuthorize("@el.check('menu:list')")
|
||||||
public ResponseEntity<List<SystemMenuTb>> queryMenuSuperior(@RequestBody List<Long> ids) {
|
public ResponseEntity<List<SystemMenuVo>> queryMenuSuperior(@RequestBody List<Long> ids) {
|
||||||
List<SystemMenuTb> systemMenuTbs = systemMenuService.listMenuSuperior(ids);
|
List<SystemMenuVo> systemMenuTbs = systemMenuService.listMenuSuperior(ids);
|
||||||
return ResponseEntity.ok(systemMenuTbs);
|
return ResponseEntity.ok(systemMenuTbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("新增菜单")
|
@ApiOperation("新增菜单")
|
||||||
@PostMapping(value = "/saveMenu")
|
@PostMapping(value = "/saveMenu")
|
||||||
@PreAuthorize("@el.check('menu:add')")
|
@PreAuthorize("@el.check('menu:add')")
|
||||||
@@ -113,18 +109,20 @@ public class SystemMenuController {
|
|||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("修改菜单")
|
@ApiOperation("修改菜单")
|
||||||
@PostMapping(value = "/modifyMenuById")
|
@PostMapping(value = "/updateMenuById")
|
||||||
@PreAuthorize("@el.check('menu:edit')")
|
@PreAuthorize("@el.check('menu:edit')")
|
||||||
public ResponseEntity<Void> modifyMenuById(@Validated(SystemMenuTb.Update.class) @RequestBody SystemMenuTb args) {
|
public ResponseEntity<Void> updateMenuById(@Validated(SystemMenuTb.Update.class) @RequestBody SystemMenuTb args) {
|
||||||
systemMenuService.updateMenuById(args);
|
systemMenuService.updateMenuById(args);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("删除菜单")
|
@ApiOperation("删除菜单")
|
||||||
@PostMapping(value = "/removeMenuByIds")
|
@PostMapping(value = "/deleteMenuByIds")
|
||||||
@PreAuthorize("@el.check('menu:del')")
|
@PreAuthorize("@el.check('menu:del')")
|
||||||
public ResponseEntity<Void> removeMenuByIds(@RequestBody Set<Long> ids) {
|
public ResponseEntity<Void> deleteMenuByIds(@RequestBody Set<Long> ids) {
|
||||||
systemMenuService.deleteMenuByIds(ids);
|
systemMenuService.deleteMenuByIds(ids);
|
||||||
return ResponseEntity.ok(null);
|
return ResponseEntity.ok(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package cn.odboy.system.controller;
|
package cn.odboy.system.controller;
|
||||||
|
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import cn.odboy.system.service.SystemMonitorService;
|
import cn.odboy.system.service.SystemMonitorService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -34,10 +35,11 @@ public class SystemMonitorController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemMonitorService systemMonitorService;
|
private SystemMonitorService systemMonitorService;
|
||||||
|
|
||||||
@PostMapping(value = "/queryServerMonitorInfo")
|
@OperationLog
|
||||||
|
@PostMapping(value = "/getServerMonitorInfo")
|
||||||
@ApiOperation("查询服务监控")
|
@ApiOperation("查询服务监控")
|
||||||
@PreAuthorize("@el.check('monitor:list')")
|
@PreAuthorize("@el.check('monitor:list')")
|
||||||
public ResponseEntity<Map<String, Object>> queryServerMonitorInfo() {
|
public ResponseEntity<Map<String, Object>> getServerMonitorInfo() {
|
||||||
return ResponseEntity.ok(systemMonitorService.getServerMonitorInfo());
|
return ResponseEntity.ok(systemMonitorService.getServerMonitorInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-7
@@ -17,8 +17,9 @@ package cn.odboy.system.controller;
|
|||||||
|
|
||||||
import cn.odboy.base.KitPageArgs;
|
import cn.odboy.base.KitPageArgs;
|
||||||
import cn.odboy.base.KitPageResult;
|
import cn.odboy.base.KitPageResult;
|
||||||
import cn.odboy.system.dal.model.SystemUserOnlineVo;
|
import cn.odboy.system.dal.model.response.SystemUserOnlineVo;
|
||||||
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
||||||
|
import cn.odboy.system.framework.operalog.OperationLog;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -43,23 +44,25 @@ public class SystemOnlineController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO;
|
private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("查询在线用户")
|
@ApiOperation("查询在线用户")
|
||||||
@PostMapping
|
@PostMapping(value = "/searchOnlineUser")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<KitPageResult<SystemUserOnlineVo>> queryOnlineUser(
|
public ResponseEntity<KitPageResult<SystemUserOnlineVo>> queryOnlineUser(@Validated @RequestBody KitPageArgs<SystemUserOnlineVo> pageArgs) {
|
||||||
@Validated @RequestBody KitPageArgs<SystemUserOnlineVo> pageArgs) {
|
|
||||||
IPage<SystemUserOnlineVo> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
IPage<SystemUserOnlineVo> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||||
return ResponseEntity.ok(systemUserOnlineInfoDAO.queryUserOnlineModelPage(pageArgs.getArgs(), page));
|
return ResponseEntity.ok(systemUserOnlineInfoDAO.searchOnlineUser(pageArgs.getArgs(), page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
@OperationLog
|
||||||
|
@ApiOperation("导出在线用户数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public void exportOnlineUser(HttpServletResponse response, String username) {
|
public void exportOnlineUser(HttpServletResponse response, String username) {
|
||||||
systemUserOnlineInfoDAO.exportOnlineUserXlsx(response, username);
|
systemUserOnlineInfoDAO.exportOnlineUserXlsx(response, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("踢出用户")
|
@OperationLog
|
||||||
|
@ApiOperation("踢出在线用户")
|
||||||
@PostMapping(value = "/kickOutUser")
|
@PostMapping(value = "/kickOutUser")
|
||||||
@PreAuthorize("@el.check()")
|
@PreAuthorize("@el.check()")
|
||||||
public ResponseEntity<Void> kickOutUser(@RequestBody Set<String> keys) throws Exception {
|
public ResponseEntity<Void> kickOutUser(@RequestBody Set<String> keys) throws Exception {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user