add more detail info in system log response (#33)
* feat: add more detail info in log * feat: update frontend resources
This commit is contained in:
parent
e91f78541e
commit
842643ea4f
|
@ -4,6 +4,7 @@ import com.databasir.common.JsonData;
|
||||||
import com.databasir.core.domain.app.OpenAuthAppService;
|
import com.databasir.core.domain.app.OpenAuthAppService;
|
||||||
import com.databasir.core.domain.app.data.*;
|
import com.databasir.core.domain.app.data.*;
|
||||||
import com.databasir.core.domain.app.handler.OpenAuthHandlers;
|
import com.databasir.core.domain.app.handler.OpenAuthHandlers;
|
||||||
|
import com.databasir.core.domain.log.annotation.Operation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
@ -21,12 +22,21 @@ import static org.springframework.data.domain.Sort.Direction.DESC;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class OpenAuth2AppController {
|
public class LoginAppController {
|
||||||
|
|
||||||
private final OpenAuthAppService openAuthAppService;
|
private final OpenAuthAppService openAuthAppService;
|
||||||
|
|
||||||
private final OpenAuthHandlers openAuthHandlers;
|
private final OpenAuthHandlers openAuthHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无需授权
|
||||||
|
*/
|
||||||
|
@GetMapping("/oauth2/apps")
|
||||||
|
@ResponseBody
|
||||||
|
public JsonData<List<OAuthAppResponse>> listApps() {
|
||||||
|
return JsonData.ok(openAuthAppService.listAll());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无需授权
|
* 无需授权
|
||||||
*/
|
*/
|
||||||
|
@ -39,15 +49,6 @@ public class OpenAuth2AppController {
|
||||||
return JsonData.ok(authorization);
|
return JsonData.ok(authorization);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 无需授权
|
|
||||||
*/
|
|
||||||
@GetMapping("/oauth2/apps")
|
|
||||||
@ResponseBody
|
|
||||||
public JsonData<List<OAuthAppResponse>> listApps() {
|
|
||||||
return JsonData.ok(openAuthAppService.listAll());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(Routes.OAuth2App.LIST_PAGE)
|
@GetMapping(Routes.OAuth2App.LIST_PAGE)
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -68,6 +69,7 @@ public class OpenAuth2AppController {
|
||||||
@PostMapping(Routes.OAuth2App.CREATE)
|
@PostMapping(Routes.OAuth2App.CREATE)
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@Operation(module = Operation.Modules.LOGIN_APP, name = "创建登录应用")
|
||||||
public JsonData<Integer> create(@RequestBody @Valid OAuthAppCreateRequest request) {
|
public JsonData<Integer> create(@RequestBody @Valid OAuthAppCreateRequest request) {
|
||||||
Integer id = openAuthAppService.create(request);
|
Integer id = openAuthAppService.create(request);
|
||||||
return JsonData.ok(id);
|
return JsonData.ok(id);
|
||||||
|
@ -76,6 +78,7 @@ public class OpenAuth2AppController {
|
||||||
@PatchMapping(Routes.OAuth2App.UPDATE)
|
@PatchMapping(Routes.OAuth2App.UPDATE)
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@Operation(module = Operation.Modules.LOGIN_APP, name = "更新登录应用")
|
||||||
public JsonData<Void> updateById(@RequestBody @Valid OAuthAppUpdateRequest request) {
|
public JsonData<Void> updateById(@RequestBody @Valid OAuthAppUpdateRequest request) {
|
||||||
openAuthAppService.updateById(request);
|
openAuthAppService.updateById(request);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
|
@ -84,6 +87,7 @@ public class OpenAuth2AppController {
|
||||||
@DeleteMapping(Routes.OAuth2App.DELETE)
|
@DeleteMapping(Routes.OAuth2App.DELETE)
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@Operation(module = Operation.Modules.LOGIN_APP, name = "删除登录应用")
|
||||||
public JsonData<Void> deleteById(@PathVariable Integer id) {
|
public JsonData<Void> deleteById(@PathVariable Integer id) {
|
||||||
openAuthAppService.deleteById(id);
|
openAuthAppService.deleteById(id);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
|
@ -28,13 +28,14 @@ public class SettingController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping(Routes.Setting.DELETE_SYS_EMAIL)
|
@DeleteMapping(Routes.Setting.DELETE_SYS_EMAIL)
|
||||||
|
@Operation(module = Operation.Modules.SETTING, name = "重置系统邮箱")
|
||||||
public JsonData<Void> deleteSysEmail() {
|
public JsonData<Void> deleteSysEmail() {
|
||||||
systemService.deleteSystemEmail();
|
systemService.deleteSystemEmail();
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(Routes.Setting.UPDATE_SYS_EMAIL)
|
@PostMapping(Routes.Setting.UPDATE_SYS_EMAIL)
|
||||||
@Operation(module = Operation.Modules.PROJECT, name = "更新邮件配置")
|
@Operation(module = Operation.Modules.SETTING, name = "更新邮件配置")
|
||||||
public JsonData<Void> updateSystemEmailSetting(@RequestBody @Valid SystemEmailUpdateRequest request) {
|
public JsonData<Void> updateSystemEmailSetting(@RequestBody @Valid SystemEmailUpdateRequest request) {
|
||||||
systemService.updateEmailSetting(request);
|
systemService.updateEmailSetting(request);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
|
|
|
@ -5,7 +5,6 @@ spring.datasource.username=root
|
||||||
spring.datasource.password=123456
|
spring.datasource.password=123456
|
||||||
spring.datasource.url=jdbc:mysql://localhost:3306/databasir
|
spring.datasource.url=jdbc:mysql://localhost:3306/databasir
|
||||||
spring.jooq.sql-dialect=mysql
|
spring.jooq.sql-dialect=mysql
|
||||||
|
|
||||||
spring.flyway.enabled=true
|
spring.flyway.enabled=true
|
||||||
spring.flyway.baseline-on-migrate=true
|
spring.flyway.baseline-on-migrate=true
|
||||||
spring.flyway.locations=classpath:db/migration
|
spring.flyway.locations=classpath:db/migration
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir-frontend</title><script defer="defer" type="module" src="/js/chunk-vendors.a3ab3c52.js"></script><script defer="defer" type="module" src="/js/app.56c0e3ab.js"></script><link href="/css/chunk-vendors.8e1003a6.css" rel="stylesheet"><link href="/css/app.757c1ef3.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.4c3febeb.js" nomodule></script><script defer="defer" src="/js/app-legacy.e577c571.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir-frontend</title><script defer="defer" type="module" src="/js/chunk-vendors.a3ab3c52.js"></script><script defer="defer" type="module" src="/js/app.16e9daea.js"></script><link href="/css/chunk-vendors.8e1003a6.css" rel="stylesheet"><link href="/css/app.757c1ef3.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.4c3febeb.js" nomodule></script><script defer="defer" src="/js/app-legacy.30c52ca0.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[940],{5430:function(e,t,a){a.d(t,{v:function(){return r}});var n=a(3872),o="/api/v1.0/operation_logs",r=function(e){return n.Z.get(o,{params:e})}},3940:function(e,t,a){a.r(t),a.d(t,{default:function(){return P}});var n=a(6252),o=a(3577),r={key:0},u=(0,n.Uk)("成功"),l={key:1},p=(0,n.Uk)("失败"),i={key:0},c={key:1};function g(e,t,a,g,s,d){var f=(0,n.up)("el-table-column"),m=(0,n.up)("el-option"),P=(0,n.up)("el-select"),h=(0,n.up)("el-tag"),j=(0,n.up)("el-table"),b=(0,n.up)("el-main"),L=(0,n.up)("el-pagination"),O=(0,n.up)("el-footer"),w=(0,n.up)("el-container");return(0,n.wg)(),(0,n.j4)(w,null,{default:(0,n.w5)((function(){return[(0,n.Wm)(b,null,{default:(0,n.w5)((function(){return[(0,n.Wm)(j,{data:s.projectOperationLogPageData.data},{default:(0,n.w5)((function(){return[(0,n.Wm)(f,{prop:"id",label:""}),(0,n.Wm)(f,{prop:"operationModule",label:"系统模块"}),(0,n.Wm)(f,{prop:"operatorNickname",label:"操作人"}),(0,n.Wm)(f,{prop:"operationName",label:"操作"}),(0,n.Wm)(f,{label:"状态"},{header:(0,n.w5)((function(){return[(0,n.Wm)(P,{modelValue:s.projectOperationLogPageQuery.isSuccess,"onUpdate:modelValue":t[0]||(t[0]=function(e){return s.projectOperationLogPageQuery.isSuccess=e}),placeholder:"状态",onChange:d.onQuery,clearable:"",size:"small","tag-type":"success"},{default:(0,n.w5)((function(){return[((0,n.wg)(),(0,n.iD)(n.HY,null,(0,n.Ko)([!0,!1],(function(e){return(0,n.Wm)(m,{key:e,label:e?"成功":"失败",value:e},null,8,["label","value"])})),64))]})),_:1},8,["modelValue","onChange"])]})),default:(0,n.w5)((function(e){return[e.row.isSuccess?((0,n.wg)(),(0,n.iD)("span",r,[(0,n.Wm)(h,{type:"success"},{default:(0,n.w5)((function(){return[u]})),_:1})])):((0,n.wg)(),(0,n.iD)("span",l,[(0,n.Wm)(h,{type:"danger"},{default:(0,n.w5)((function(){return[p]})),_:1})]))]})),_:1}),(0,n.Wm)(f,{label:"错误信息"},{default:(0,n.w5)((function(e){return[e.row.isSuccess?((0,n.wg)(),(0,n.iD)("span",i)):((0,n.wg)(),(0,n.iD)("span",c,(0,o.zw)(e.row.operationResponse.errMessage),1))]})),_:1}),(0,n.Wm)(f,{prop:"involvedGroupId",label:"涉及分组"}),(0,n.Wm)(f,{prop:"involvedProjectId",label:"涉及项目"}),(0,n.Wm)(f,{prop:"involvedUserId",label:"涉及用户"}),(0,n.Wm)(f,{prop:"createAt",label:"记录时间"})]})),_:1},8,["data"])]})),_:1}),(0,n.Wm)(O,null,{default:(0,n.w5)((function(){return[(0,n.Wm)(L,{layout:"prev, pager, next","hide-on-single-page":!1,currentPage:s.projectOperationLogPageData.number,"page-size":s.projectOperationLogPageData.size,"page-count":s.projectOperationLogPageData.totalPages,onCurrentChange:d.onProjectOperationLogCurrentPageChange},null,8,["currentPage","page-size","page-count","onCurrentChange"])]})),_:1})]})),_:1})}var s=a(5430),d={data:function(){return{projectOperationLogPageData:{data:[],number:1,size:10,totalElements:0,totalPages:1},projectOperationLogPageQuery:{page:0,size:10,isSuccess:null,involveProjectId:null,module:null}}},created:function(){this.fetchProjectOperationLogs()},methods:{fetchProjectOperationLogs:function(e){var t=this;this.projectOperationLogPageQuery.page=e?e-1:null,(0,s.v)(this.projectOperationLogPageQuery).then((function(e){e.errCode||(t.projectOperationLogPageData.data=e.data.content,t.projectOperationLogPageData.number=e.data.number+1,t.projectOperationLogPageData.size=e.data.size,t.projectOperationLogPageData.totalPages=e.data.totalPages,t.projectOperationLogPageData.totalElements=e.data.totalElements)}))},onProjectOperationLogCurrentPageChange:function(e){e&&e-1!=this.projectOperationLogPageQuery.page&&(this.projectOperationLogPageQuery.page=e-1,this.fetchProjectOperationLogs(e))},onQuery:function(){this.fetchProjectOperationLogs()}}},f=a(3744);const m=(0,f.Z)(d,[["render",g]]);var P=m}}]);
|
|
||||||
//# sourceMappingURL=940-legacy.90bc5a5b.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[940],{5430:function(e,a,t){t.d(a,{v:function(){return n}});var o=t(3872);const r="/api/v1.0/operation_logs",n=e=>o.Z.get(r,{params:e})},3940:function(e,a,t){t.r(a),t.d(a,{default:function(){return h}});var o=t(6252),r=t(3577);const n={key:0},l=(0,o.Uk)("成功"),p={key:1},u=(0,o.Uk)("失败"),i={key:0},g={key:1};function s(e,a,t,s,c,d){const m=(0,o.up)("el-table-column"),P=(0,o.up)("el-option"),h=(0,o.up)("el-select"),j=(0,o.up)("el-tag"),f=(0,o.up)("el-table"),b=(0,o.up)("el-main"),L=(0,o.up)("el-pagination"),O=(0,o.up)("el-footer"),w=(0,o.up)("el-container");return(0,o.wg)(),(0,o.j4)(w,null,{default:(0,o.w5)((()=>[(0,o.Wm)(b,null,{default:(0,o.w5)((()=>[(0,o.Wm)(f,{data:c.projectOperationLogPageData.data},{default:(0,o.w5)((()=>[(0,o.Wm)(m,{prop:"id",label:""}),(0,o.Wm)(m,{prop:"operationModule",label:"系统模块"}),(0,o.Wm)(m,{prop:"operatorNickname",label:"操作人"}),(0,o.Wm)(m,{prop:"operationName",label:"操作"}),(0,o.Wm)(m,{label:"状态"},{header:(0,o.w5)((()=>[(0,o.Wm)(h,{modelValue:c.projectOperationLogPageQuery.isSuccess,"onUpdate:modelValue":a[0]||(a[0]=e=>c.projectOperationLogPageQuery.isSuccess=e),placeholder:"状态",onChange:d.onQuery,clearable:"",size:"small","tag-type":"success"},{default:(0,o.w5)((()=>[((0,o.wg)(),(0,o.iD)(o.HY,null,(0,o.Ko)([!0,!1],(e=>(0,o.Wm)(P,{key:e,label:e?"成功":"失败",value:e},null,8,["label","value"]))),64))])),_:1},8,["modelValue","onChange"])])),default:(0,o.w5)((e=>[e.row.isSuccess?((0,o.wg)(),(0,o.iD)("span",n,[(0,o.Wm)(j,{type:"success"},{default:(0,o.w5)((()=>[l])),_:1})])):((0,o.wg)(),(0,o.iD)("span",p,[(0,o.Wm)(j,{type:"danger"},{default:(0,o.w5)((()=>[u])),_:1})]))])),_:1}),(0,o.Wm)(m,{label:"错误信息"},{default:(0,o.w5)((e=>[e.row.isSuccess?((0,o.wg)(),(0,o.iD)("span",i)):((0,o.wg)(),(0,o.iD)("span",g,(0,r.zw)(e.row.operationResponse.errMessage),1))])),_:1}),(0,o.Wm)(m,{prop:"involvedGroupId",label:"涉及分组"}),(0,o.Wm)(m,{prop:"involvedProjectId",label:"涉及项目"}),(0,o.Wm)(m,{prop:"involvedUserId",label:"涉及用户"}),(0,o.Wm)(m,{prop:"createAt",label:"记录时间"})])),_:1},8,["data"])])),_:1}),(0,o.Wm)(O,null,{default:(0,o.w5)((()=>[(0,o.Wm)(L,{layout:"prev, pager, next","hide-on-single-page":!1,currentPage:c.projectOperationLogPageData.number,"page-size":c.projectOperationLogPageData.size,"page-count":c.projectOperationLogPageData.totalPages,onCurrentChange:d.onProjectOperationLogCurrentPageChange},null,8,["currentPage","page-size","page-count","onCurrentChange"])])),_:1})])),_:1})}var c=t(5430),d={data(){return{projectOperationLogPageData:{data:[],number:1,size:10,totalElements:0,totalPages:1},projectOperationLogPageQuery:{page:0,size:10,isSuccess:null,involveProjectId:null,module:null}}},created(){this.fetchProjectOperationLogs()},methods:{fetchProjectOperationLogs(e){this.projectOperationLogPageQuery.page=e?e-1:null,(0,c.v)(this.projectOperationLogPageQuery).then((e=>{e.errCode||(this.projectOperationLogPageData.data=e.data.content,this.projectOperationLogPageData.number=e.data.number+1,this.projectOperationLogPageData.size=e.data.size,this.projectOperationLogPageData.totalPages=e.data.totalPages,this.projectOperationLogPageData.totalElements=e.data.totalElements)}))},onProjectOperationLogCurrentPageChange(e){e&&e-1!=this.projectOperationLogPageQuery.page&&(this.projectOperationLogPageQuery.page=e-1,this.fetchProjectOperationLogs(e))},onQuery(){this.fetchProjectOperationLogs()}}},m=t(3744);const P=(0,m.Z)(d,[["render",s]]);var h=P}}]);
|
|
||||||
//# sourceMappingURL=940.0286114f.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[99],{5430:function(e,t,a){a.d(t,{v:function(){return r}});var n=a(3872),o="/api/v1.0/operation_logs",r=function(e){return n.Z.get(o,{params:e})}},2099:function(e,t,a){a.r(t),a.d(t,{default:function(){return h}});a(8309);var n=a(6252),o=a(3577),r={key:0},u=(0,n.Uk)("成功"),l={key:1},i=(0,n.Uk)("失败"),p={key:0},c={key:1},g={key:1},s={key:1},d={key:1};function f(e,t,a,f,w,m){var P=(0,n.up)("el-table-column"),j=(0,n.up)("el-option"),h=(0,n.up)("el-select"),v=(0,n.up)("el-tag"),y=(0,n.up)("el-link"),b=(0,n.up)("el-table"),k=(0,n.up)("el-main"),L=(0,n.up)("el-pagination"),O=(0,n.up)("el-footer"),D=(0,n.up)("el-container");return(0,n.wg)(),(0,n.j4)(D,null,{default:(0,n.w5)((function(){return[(0,n.Wm)(k,null,{default:(0,n.w5)((function(){return[(0,n.Wm)(b,{data:w.projectOperationLogPageData.data},{default:(0,n.w5)((function(){return[(0,n.Wm)(P,{prop:"id",label:""}),(0,n.Wm)(P,{prop:"operationModule",label:"系统模块"}),(0,n.Wm)(P,{prop:"operatorNickname",label:"操作人"}),(0,n.Wm)(P,{prop:"operationName",label:"操作"}),(0,n.Wm)(P,{label:"状态"},{header:(0,n.w5)((function(){return[(0,n.Wm)(h,{modelValue:w.projectOperationLogPageQuery.isSuccess,"onUpdate:modelValue":t[0]||(t[0]=function(e){return w.projectOperationLogPageQuery.isSuccess=e}),placeholder:"状态",onChange:m.onQuery,clearable:"",size:"small","tag-type":"success"},{default:(0,n.w5)((function(){return[((0,n.wg)(),(0,n.iD)(n.HY,null,(0,n.Ko)([!0,!1],(function(e){return(0,n.Wm)(j,{key:e,label:e?"成功":"失败",value:e},null,8,["label","value"])})),64))]})),_:1},8,["modelValue","onChange"])]})),default:(0,n.w5)((function(e){return[e.row.isSuccess?((0,n.wg)(),(0,n.iD)("span",r,[(0,n.Wm)(v,{type:"success"},{default:(0,n.w5)((function(){return[u]})),_:1})])):((0,n.wg)(),(0,n.iD)("span",l,[(0,n.Wm)(v,{type:"danger"},{default:(0,n.w5)((function(){return[i]})),_:1})]))]})),_:1}),(0,n.Wm)(P,{label:"错误信息"},{default:(0,n.w5)((function(e){return[e.row.isSuccess?((0,n.wg)(),(0,n.iD)("span",p)):((0,n.wg)(),(0,n.iD)("span",c,(0,o.zw)(e.row.operationResponse.errMessage),1))]})),_:1}),(0,n.Wm)(P,{label:"涉及分组"},{default:(0,n.w5)((function(e){return[e.row.involvedGroup?((0,n.wg)(),(0,n.j4)(y,{key:0},{default:(0,n.w5)((function(){return[(0,n.Uk)((0,o.zw)(e.row.involvedGroup.name),1)]})),_:2},1024)):((0,n.wg)(),(0,n.iD)("span",g," - "))]})),_:1}),(0,n.Wm)(P,{label:"涉及项目"},{default:(0,n.w5)((function(e){return[e.row.involvedProject?((0,n.wg)(),(0,n.j4)(y,{key:0},{default:(0,n.w5)((function(){return[(0,n.Uk)((0,o.zw)(e.row.involvedProject.name),1)]})),_:2},1024)):((0,n.wg)(),(0,n.iD)("span",s," - "))]})),_:1}),(0,n.Wm)(P,{label:"涉及用户"},{default:(0,n.w5)((function(e){return[e.row.involvedUser?((0,n.wg)(),(0,n.j4)(y,{key:0},{default:(0,n.w5)((function(){return[(0,n.Uk)((0,o.zw)(e.row.involvedUser.nickname),1)]})),_:2},1024)):((0,n.wg)(),(0,n.iD)("span",d," - "))]})),_:1}),(0,n.Wm)(P,{prop:"createAt",label:"记录时间"})]})),_:1},8,["data"])]})),_:1}),(0,n.Wm)(O,null,{default:(0,n.w5)((function(){return[(0,n.Wm)(L,{layout:"prev, pager, next","hide-on-single-page":!1,currentPage:w.projectOperationLogPageData.number,"page-size":w.projectOperationLogPageData.size,"page-count":w.projectOperationLogPageData.totalPages,onCurrentChange:m.onProjectOperationLogCurrentPageChange},null,8,["currentPage","page-size","page-count","onCurrentChange"])]})),_:1})]})),_:1})}var w=a(5430),m={data:function(){return{projectOperationLogPageData:{data:[],number:1,size:10,totalElements:0,totalPages:1},projectOperationLogPageQuery:{page:0,size:10,isSuccess:null,involveProjectId:null,module:null}}},created:function(){this.fetchProjectOperationLogs()},methods:{fetchProjectOperationLogs:function(e){var t=this;this.projectOperationLogPageQuery.page=e?e-1:null,(0,w.v)(this.projectOperationLogPageQuery).then((function(e){e.errCode||(t.projectOperationLogPageData.data=e.data.content,t.projectOperationLogPageData.number=e.data.number+1,t.projectOperationLogPageData.size=e.data.size,t.projectOperationLogPageData.totalPages=e.data.totalPages,t.projectOperationLogPageData.totalElements=e.data.totalElements)}))},onProjectOperationLogCurrentPageChange:function(e){e&&e-1!=this.projectOperationLogPageQuery.page&&(this.projectOperationLogPageQuery.page=e-1,this.fetchProjectOperationLogs(e))},onQuery:function(){this.fetchProjectOperationLogs()}}},P=a(3744);const j=(0,P.Z)(m,[["render",f]]);var h=j}}]);
|
||||||
|
//# sourceMappingURL=99-legacy.618121ce.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[99],{5430:function(e,a,t){t.d(a,{v:function(){return n}});var o=t(3872);const r="/api/v1.0/operation_logs",n=e=>o.Z.get(r,{params:e})},2099:function(e,a,t){t.r(a),t.d(a,{default:function(){return j}});var o=t(6252),r=t(3577);const n={key:0},l=(0,o.Uk)("成功"),p={key:1},u=(0,o.Uk)("失败"),i={key:0},g={key:1},s={key:1},c={key:1},d={key:1};function w(e,a,t,w,m,P){const f=(0,o.up)("el-table-column"),h=(0,o.up)("el-option"),j=(0,o.up)("el-select"),v=(0,o.up)("el-tag"),y=(0,o.up)("el-link"),b=(0,o.up)("el-table"),k=(0,o.up)("el-main"),L=(0,o.up)("el-pagination"),O=(0,o.up)("el-footer"),D=(0,o.up)("el-container");return(0,o.wg)(),(0,o.j4)(D,null,{default:(0,o.w5)((()=>[(0,o.Wm)(k,null,{default:(0,o.w5)((()=>[(0,o.Wm)(b,{data:m.projectOperationLogPageData.data},{default:(0,o.w5)((()=>[(0,o.Wm)(f,{prop:"id",label:""}),(0,o.Wm)(f,{prop:"operationModule",label:"系统模块"}),(0,o.Wm)(f,{prop:"operatorNickname",label:"操作人"}),(0,o.Wm)(f,{prop:"operationName",label:"操作"}),(0,o.Wm)(f,{label:"状态"},{header:(0,o.w5)((()=>[(0,o.Wm)(j,{modelValue:m.projectOperationLogPageQuery.isSuccess,"onUpdate:modelValue":a[0]||(a[0]=e=>m.projectOperationLogPageQuery.isSuccess=e),placeholder:"状态",onChange:P.onQuery,clearable:"",size:"small","tag-type":"success"},{default:(0,o.w5)((()=>[((0,o.wg)(),(0,o.iD)(o.HY,null,(0,o.Ko)([!0,!1],(e=>(0,o.Wm)(h,{key:e,label:e?"成功":"失败",value:e},null,8,["label","value"]))),64))])),_:1},8,["modelValue","onChange"])])),default:(0,o.w5)((e=>[e.row.isSuccess?((0,o.wg)(),(0,o.iD)("span",n,[(0,o.Wm)(v,{type:"success"},{default:(0,o.w5)((()=>[l])),_:1})])):((0,o.wg)(),(0,o.iD)("span",p,[(0,o.Wm)(v,{type:"danger"},{default:(0,o.w5)((()=>[u])),_:1})]))])),_:1}),(0,o.Wm)(f,{label:"错误信息"},{default:(0,o.w5)((e=>[e.row.isSuccess?((0,o.wg)(),(0,o.iD)("span",i)):((0,o.wg)(),(0,o.iD)("span",g,(0,r.zw)(e.row.operationResponse.errMessage),1))])),_:1}),(0,o.Wm)(f,{label:"涉及分组"},{default:(0,o.w5)((e=>[e.row.involvedGroup?((0,o.wg)(),(0,o.j4)(y,{key:0},{default:(0,o.w5)((()=>[(0,o.Uk)((0,r.zw)(e.row.involvedGroup.name),1)])),_:2},1024)):((0,o.wg)(),(0,o.iD)("span",s," - "))])),_:1}),(0,o.Wm)(f,{label:"涉及项目"},{default:(0,o.w5)((e=>[e.row.involvedProject?((0,o.wg)(),(0,o.j4)(y,{key:0},{default:(0,o.w5)((()=>[(0,o.Uk)((0,r.zw)(e.row.involvedProject.name),1)])),_:2},1024)):((0,o.wg)(),(0,o.iD)("span",c," - "))])),_:1}),(0,o.Wm)(f,{label:"涉及用户"},{default:(0,o.w5)((e=>[e.row.involvedUser?((0,o.wg)(),(0,o.j4)(y,{key:0},{default:(0,o.w5)((()=>[(0,o.Uk)((0,r.zw)(e.row.involvedUser.nickname),1)])),_:2},1024)):((0,o.wg)(),(0,o.iD)("span",d," - "))])),_:1}),(0,o.Wm)(f,{prop:"createAt",label:"记录时间"})])),_:1},8,["data"])])),_:1}),(0,o.Wm)(O,null,{default:(0,o.w5)((()=>[(0,o.Wm)(L,{layout:"prev, pager, next","hide-on-single-page":!1,currentPage:m.projectOperationLogPageData.number,"page-size":m.projectOperationLogPageData.size,"page-count":m.projectOperationLogPageData.totalPages,onCurrentChange:P.onProjectOperationLogCurrentPageChange},null,8,["currentPage","page-size","page-count","onCurrentChange"])])),_:1})])),_:1})}var m=t(5430),P={data(){return{projectOperationLogPageData:{data:[],number:1,size:10,totalElements:0,totalPages:1},projectOperationLogPageQuery:{page:0,size:10,isSuccess:null,involveProjectId:null,module:null}}},created(){this.fetchProjectOperationLogs()},methods:{fetchProjectOperationLogs(e){this.projectOperationLogPageQuery.page=e?e-1:null,(0,m.v)(this.projectOperationLogPageQuery).then((e=>{e.errCode||(this.projectOperationLogPageData.data=e.data.content,this.projectOperationLogPageData.number=e.data.number+1,this.projectOperationLogPageData.size=e.data.size,this.projectOperationLogPageData.totalPages=e.data.totalPages,this.projectOperationLogPageData.totalElements=e.data.totalElements)}))},onProjectOperationLogCurrentPageChange(e){e&&e-1!=this.projectOperationLogPageQuery.page&&(this.projectOperationLogPageQuery.page=e-1,this.fetchProjectOperationLogs(e))},onQuery(){this.fetchProjectOperationLogs()}}},f=t(3744);const h=(0,f.Z)(P,[["render",w]]);var j=h}}]);
|
||||||
|
//# sourceMappingURL=99.c134b829.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -33,6 +33,7 @@ public @interface Operation {
|
||||||
String PROJECT = "project";
|
String PROJECT = "project";
|
||||||
String USER = "user";
|
String USER = "user";
|
||||||
String GROUP = "group";
|
String GROUP = "group";
|
||||||
|
String LOGIN_APP = "login_app";
|
||||||
String SETTING = "setting";
|
String SETTING = "setting";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,41 @@ package com.databasir.core.domain.log.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
|
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||||
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
||||||
|
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||||
|
import com.databasir.dao.tables.pojos.UserPojo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
||||||
public interface OperationLogPojoConverter {
|
public interface OperationLogPojoConverter {
|
||||||
|
|
||||||
OperationLogPageResponse to(OperationLogPojo pojo);
|
@Mapping(target = "id", source = "pojo.id")
|
||||||
|
@Mapping(target = "createAt", source = "pojo.createAt")
|
||||||
|
OperationLogPageResponse to(OperationLogPojo pojo,
|
||||||
|
GroupPojo involvedGroup,
|
||||||
|
UserPojo involvedUser,
|
||||||
|
ProjectPojo involvedProject);
|
||||||
|
|
||||||
|
default OperationLogPageResponse to(OperationLogPojo operationLogPojo,
|
||||||
|
Map<Integer, GroupPojo> groupMapById,
|
||||||
|
Map<Integer, UserPojo> userMapById,
|
||||||
|
Map<Integer, ProjectPojo> projectMapById) {
|
||||||
|
GroupPojo group = null;
|
||||||
|
if (operationLogPojo.getInvolvedGroupId() != null) {
|
||||||
|
group = groupMapById.get(operationLogPojo.getInvolvedGroupId());
|
||||||
|
}
|
||||||
|
UserPojo user = null;
|
||||||
|
if (operationLogPojo.getInvolvedUserId() != null) {
|
||||||
|
user = userMapById.get(operationLogPojo.getInvolvedUserId());
|
||||||
|
}
|
||||||
|
ProjectPojo project = null;
|
||||||
|
if (operationLogPojo.getInvolvedProjectId() != null) {
|
||||||
|
project = projectMapById.get(operationLogPojo.getInvolvedProjectId());
|
||||||
|
}
|
||||||
|
return to(operationLogPojo, group, user, project);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.databasir.core.domain.log.data;
|
package com.databasir.core.domain.log.data;
|
||||||
|
|
||||||
import com.databasir.common.JsonData;
|
import com.databasir.common.JsonData;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@ -28,12 +30,43 @@ public class OperationLogPageResponse {
|
||||||
|
|
||||||
private Boolean isSuccess;
|
private Boolean isSuccess;
|
||||||
|
|
||||||
private Integer involvedProjectId;
|
private InvolvedProjectData involvedProject;
|
||||||
|
|
||||||
private Integer involvedGroupId;
|
private InvolvedGroupData involvedGroup;
|
||||||
|
|
||||||
private Integer involvedUserId;
|
private InvolvedUserData involvedUser;
|
||||||
|
|
||||||
private LocalDateTime createAt;
|
private LocalDateTime createAt;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class InvolvedProjectData {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class InvolvedGroupData {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class InvolvedUserData {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private String nickname;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,36 @@ import com.databasir.core.domain.log.converter.OperationLogRequestConverter;
|
||||||
import com.databasir.core.domain.log.data.OperationLogPageCondition;
|
import com.databasir.core.domain.log.data.OperationLogPageCondition;
|
||||||
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
||||||
import com.databasir.core.domain.log.data.OperationLogRequest;
|
import com.databasir.core.domain.log.data.OperationLogRequest;
|
||||||
|
import com.databasir.dao.impl.GroupDao;
|
||||||
import com.databasir.dao.impl.OperationLogDao;
|
import com.databasir.dao.impl.OperationLogDao;
|
||||||
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
|
import com.databasir.dao.impl.UserDao;
|
||||||
|
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||||
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
||||||
|
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||||
|
import com.databasir.dao.tables.pojos.UserPojo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class OperationLogService {
|
public class OperationLogService {
|
||||||
|
|
||||||
private final OperationLogDao operationLogDao;
|
private final OperationLogDao operationLogDao;
|
||||||
|
|
||||||
|
private final UserDao userDao;
|
||||||
|
|
||||||
|
private final GroupDao groupDao;
|
||||||
|
|
||||||
|
private final ProjectDao projectDao;
|
||||||
|
|
||||||
private final OperationLogRequestConverter operationLogRequestConverter;
|
private final OperationLogRequestConverter operationLogRequestConverter;
|
||||||
|
|
||||||
private final OperationLogPojoConverter operationLogPojoConverter;
|
private final OperationLogPojoConverter operationLogPojoConverter;
|
||||||
|
@ -30,6 +47,26 @@ public class OperationLogService {
|
||||||
public Page<OperationLogPageResponse> list(Pageable page,
|
public Page<OperationLogPageResponse> list(Pageable page,
|
||||||
OperationLogPageCondition condition) {
|
OperationLogPageCondition condition) {
|
||||||
Page<OperationLogPojo> pojoData = operationLogDao.selectByPage(page, condition.toCondition());
|
Page<OperationLogPojo> pojoData = operationLogDao.selectByPage(page, condition.toCondition());
|
||||||
return pojoData.map(operationLogPojoConverter::to);
|
List<Integer> groupIds = pojoData.filter(p -> p.getInvolvedGroupId() != null)
|
||||||
|
.map(OperationLogPojo::getInvolvedGroupId)
|
||||||
|
.toList();
|
||||||
|
Map<Integer, GroupPojo> groupMapById = groupDao.selectAllInIds(groupIds)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(GroupPojo::getId, Function.identity()));
|
||||||
|
|
||||||
|
List<Integer> userIds = pojoData.filter(p -> p.getInvolvedUserId() != null)
|
||||||
|
.map(OperationLogPojo::getInvolvedUserId)
|
||||||
|
.toList();
|
||||||
|
Map<Integer, UserPojo> userMapById = userDao.selectInIds(userIds)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(UserPojo::getId, Function.identity()));
|
||||||
|
|
||||||
|
List<Integer> projectIds = pojoData.filter(p -> p.getInvolvedProjectId() != null)
|
||||||
|
.map(OperationLogPojo::getInvolvedProjectId)
|
||||||
|
.toList();
|
||||||
|
Map<Integer, ProjectPojo> projectMapById = projectDao.selectInIds(projectIds)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(ProjectPojo::getId, Function.identity()));
|
||||||
|
return pojoData.map(pojo -> operationLogPojoConverter.to(pojo, groupMapById, userMapById, projectMapById));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,4 +56,17 @@ public class GroupDao extends BaseDao<GroupPojo> {
|
||||||
.where(GROUP.ID.in(ids)).and(GROUP.DELETED.eq(false))
|
.where(GROUP.ID.in(ids)).and(GROUP.DELETED.eq(false))
|
||||||
.fetchInto(GroupPojo.class);
|
.fetchInto(GroupPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* with deleted
|
||||||
|
*/
|
||||||
|
public List<GroupPojo> selectAllInIds(List<? extends Serializable> ids) {
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return getDslContext()
|
||||||
|
.select(GROUP.fields()).from(GROUP)
|
||||||
|
.where(GROUP.ID.in(ids))
|
||||||
|
.fetchInto(GroupPojo.class);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue