Redesign document history model (#39)

* feat: jooq model generate

* refactor: redesign document history model

* fix: checkstyle

* feat: add batch query table api

* fix: checkstyle

* feat: update frontend resources
This commit is contained in:
vran 2022-03-09 23:39:57 +08:00 committed by GitHub
parent 4ee98da074
commit 86d6d8d3aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
96 changed files with 508 additions and 3171 deletions

View File

@ -3,6 +3,7 @@ package com.databasir.api;
import com.databasir.common.JsonData;
import com.databasir.common.SystemException;
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
import com.databasir.core.domain.document.service.DocumentService;
import com.databasir.core.domain.log.annotation.Operation;
@ -23,6 +24,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.UUID;
import static org.springframework.data.domain.Sort.Direction.DESC;
@ -54,7 +56,7 @@ public class DocumentController {
@PageableDefault(sort = "id",
direction = DESC)
Pageable page) {
return JsonData.ok(documentService.getVersionsBySchemaSourceId(projectId, page));
return JsonData.ok(documentService.getVersionsByProjectId(projectId, page));
}
@GetMapping(Routes.Document.EXPORT)
@ -79,4 +81,19 @@ public class DocumentController {
}
}
@GetMapping(Routes.Document.GET_SIMPLE_ONE)
public JsonData<DatabaseDocumentSimpleResponse> getSimpleByProjectId(@PathVariable Integer projectId,
@RequestParam(required = false)
Long version) {
return JsonData.ok(documentService.getSimpleOneByProjectId(projectId, version));
}
@PostMapping(Routes.Document.GET_TABLE_DETAIL)
public JsonData<List<DatabaseDocumentResponse.TableDocumentResponse>> getTableDocument(
@PathVariable Integer projectId,
@PathVariable Integer documentId,
@RequestBody List<Integer> tableIds) {
return JsonData.ok(documentService.getTableDetails(projectId, documentId, tableIds));
}
}

View File

@ -78,6 +78,10 @@ public interface Routes {
String LIST_VERSIONS = BASE + "/projects/{projectId}/document_versions";
String GET_SIMPLE_ONE = BASE + "/projects/{projectId}/documents/simple";
String GET_TABLE_DETAIL = BASE + "/projects/{projectId}/documents/{documentId}/table_documents";
String EXPORT = BASE + "/projects/{projectId}/document_files";
}

View File

@ -1 +0,0 @@
.el-row{margin-bottom:20px}.remark-card{margin-bottom:30px}.remark-header{display:flex;justify-content:space-between;align-items:center}.remark-header .remark-user{color:#6d6d6d}.remark-header .remark-time{color:#6d6d6d;font-size:.8rem;margin-left:10px}.remark-content{white-space:pre-wrap;text-align:left}.text{font-size:14px;line-height:1.3rem}.item{margin-top:10px;margin-right:40px}.toc-wrapper{right:0;z-index:0;bottom:auto;padding-left:12px;margin-left:10px}.toc{top:180px;margin-left:0;transform:scale(1);bottom:0;position:fixed;overflow-y:hidden;overflow-x:hidden}.toc:hover{overflow-y:auto;overflow-x:auto}.toc-wrapper .toc ul{list-style:none;line-height:1.7;inline-size:200px;overflow-wrap:break-word}.toc-wrapper .toc a{display:inherit}

View File

@ -0,0 +1 @@
.text{font-size:14px;line-height:1.3rem}.item{margin-top:10px;margin-right:40px}.remark-card{margin-bottom:30px}.remark-header{display:flex;justify-content:space-between;align-items:center}.remark-header .remark-user{color:#6d6d6d}.remark-header .remark-time{color:#6d6d6d;font-size:.8rem;margin-left:10px}.remark-content{white-space:pre-wrap;text-align:left}.span-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;display:flex;align-items:left;justify-content:space-between;font-size:14px}.doc-toc-aside{overflow-wrap:break-word;text-overflow:ellipsis;bottom:0;top:100px;position:fixed;overflow-y:hidden;overflow-x:hidden;max-width:var(--el-aside-width);width:var(--el-aside-width);border-width:0 1px 0 0;border-color:#ddd;border-style:solid}.doc-toc-aside:hover{overflow-y:auto;scrollbar-width:thin}

View File

@ -1,21 +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.b56cd27c.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.3cb9ab8a.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.45746587.js"></script><script defer="defer" type="module" src="/js/app.7be9adb6.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.54c3660b.js" nomodule></script><script defer="defer" src="/js/app-legacy.54c819e0.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>

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

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[596],{7596:function(e,t,n){n.r(t),n.d(t,{default:function(){return _}});var r=n(6252),u=(0,r.Uk)(" 系统邮箱设置 "),o=(0,r.Uk)(" : "),l=(0,r.Uk)("保存"),a=(0,r.Uk)("重置");function s(e,t,n,s,i,m){var f=(0,r.up)("box"),d=(0,r.up)("el-icon"),c=(0,r.up)("el-divider"),p=(0,r.up)("el-input"),w=(0,r.up)("el-form-item"),h=(0,r.up)("el-col"),g=(0,r.up)("el-button"),_=(0,r.up)("el-form"),W=(0,r.up)("el-card"),V=(0,r.up)("el-main"),b=(0,r.up)("el-container");return(0,r.wg)(),(0,r.j4)(b,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(V,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(W,{shadow:"hover",style:{"max-width":"600px"}},{default:(0,r.w5)((function(){return[(0,r.Wm)(c,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(d,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(f)]})),_:1}),u]})),_:1}),(0,r.Wm)(_,{model:i.form,"label-position":"top",rules:i.formRule,ref:"formRef",style:{"max-width":"900px"}},{default:(0,r.w5)((function(){return[(0,r.Wm)(w,{label:"邮箱账号",prop:"username"},{default:(0,r.w5)((function(){return[(0,r.Wm)(p,{modelValue:i.form.username,"onUpdate:modelValue":t[0]||(t[0]=function(e){return i.form.username=e}),placeholder:"请输入邮箱账号"},null,8,["modelValue"])]})),_:1}),(0,r.Wm)(w,{label:"邮箱密码",prop:"password"},{default:(0,r.w5)((function(){return[(0,r.Wm)(p,{modelValue:i.form.password,"onUpdate:modelValue":t[1]||(t[1]=function(e){return i.form.password=e}),type:"password",placeholder:"请输入密码","show-password":""},null,8,["modelValue"])]})),_:1}),(0,r.Wm)(w,{label:"SMTP",prop:"smtpHost"},{default:(0,r.w5)((function(){return[(0,r.Wm)(h,{span:12},{default:(0,r.w5)((function(){return[(0,r.Wm)(p,{modelValue:i.form.smtpHost,"onUpdate:modelValue":t[2]||(t[2]=function(e){return i.form.smtpHost=e}),placeholder:"SMTP Host"},null,8,["modelValue"])]})),_:1}),(0,r.Wm)(h,{span:1,style:{"text-align":"center"}},{default:(0,r.w5)((function(){return[o]})),_:1}),(0,r.Wm)(h,{span:6},{default:(0,r.w5)((function(){return[(0,r.Wm)(p,{modelValue:i.form.smtpPort,"onUpdate:modelValue":t[3]||(t[3]=function(e){return i.form.smtpPort=e}),placeholder:"SMTP Port"},null,8,["modelValue"])]})),_:1})]})),_:1}),(0,r.Wm)(w,{style:{"margin-top":"38px"}},{default:(0,r.w5)((function(){return[(0,r.Wm)(g,{type:"primary",onClick:t[4]||(t[4]=function(e){return m.onSubmit("formRef")})},{default:(0,r.w5)((function(){return[l]})),_:1}),(0,r.Wm)(g,{type:"danger",onClick:t[5]||(t[5]=function(e){return m.onReset()})},{default:(0,r.w5)((function(){return[a]})),_:1})]})),_:1})]})),_:1},8,["model","rules"])]})),_:1})]})),_:1})]})),_:1})}var i=n(8534),m=(n(5666),n(3872)),f="/api/v1.0/settings",d=function(){return m.Z.get(f+"/sys_email")},c=function(e){return m.Z.post(f+"/sys_email",e)},p=function(){return m.Z["delete"](f+"/sys_email")},w={data:function(){return{form:{smtpHost:null,smtpPort:null,username:null,password:null},formRule:{username:[this.requiredInputValidRule("请输入邮箱账号"),{type:"email",message:"邮箱格式不正确",trigger:"blur"}],password:[this.requiredInputValidRule("请输入邮箱密码")],smtpHost:[this.requiredInputValidRule("请输入 SMTP 地址")],smtpPort:[this.requiredInputValidRule("请输入 SMTP 端口"),{min:1,max:65535,message:"端口有效值为 1~65535",trigger:"blur"}]}}},mounted:function(){this.fetchSysMail()},methods:{requiredInputValidRule:function(e){return{required:!0,message:e,trigger:"blur"}},fetchSysMail:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,d().then((function(e){return e.data}));case 2:n=t.sent,n&&(e.form=n);case 4:case"end":return t.stop()}}),t)})))()},onSubmit:function(){var e=this;this.$refs.formRef.validate((function(t){return t?(c(e.form).then((function(t){t.errCode||e.$message.success("更新成功")})),!0):(e.$message.error("请完善表单相关信息!"),!1)}))},onReset:function(){var e=this;this.$confirm("确认重置系统邮件吗?删除后数据将无法恢复","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){p().then((function(t){t.errCode||(e.form={},e.$message.success("重置成功"))}))}))}}},h=n(3744);const g=(0,h.Z)(w,[["render",s]]);var _=g}}]);
//# sourceMappingURL=596-legacy.3a4a4c9d.js.map
//# sourceMappingURL=596-legacy.fcdab935.js.map

View File

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[596],{7596:function(e,l,t){t.r(l),t.d(l,{default:function(){return _}});var r=t(6252);const a=(0,r.Uk)(" 系统邮箱设置 "),s=(0,r.Uk)(" : "),o=(0,r.Uk)("保存"),u=(0,r.Uk)("重置");function m(e,l,t,m,n,d){const p=(0,r.up)("box"),i=(0,r.up)("el-icon"),f=(0,r.up)("el-divider"),c=(0,r.up)("el-input"),h=(0,r.up)("el-form-item"),w=(0,r.up)("el-col"),_=(0,r.up)("el-button"),g=(0,r.up)("el-form"),W=(0,r.up)("el-card"),V=(0,r.up)("el-main"),y=(0,r.up)("el-container");return(0,r.wg)(),(0,r.j4)(y,null,{default:(0,r.w5)((()=>[(0,r.Wm)(V,null,{default:(0,r.w5)((()=>[(0,r.Wm)(W,{shadow:"hover",style:{"max-width":"600px"}},{default:(0,r.w5)((()=>[(0,r.Wm)(f,null,{default:(0,r.w5)((()=>[(0,r.Wm)(i,null,{default:(0,r.w5)((()=>[(0,r.Wm)(p)])),_:1}),a])),_:1}),(0,r.Wm)(g,{model:n.form,"label-position":"top",rules:n.formRule,ref:"formRef",style:{"max-width":"900px"}},{default:(0,r.w5)((()=>[(0,r.Wm)(h,{label:"邮箱账号",prop:"username"},{default:(0,r.w5)((()=>[(0,r.Wm)(c,{modelValue:n.form.username,"onUpdate:modelValue":l[0]||(l[0]=e=>n.form.username=e),placeholder:"请输入邮箱账号"},null,8,["modelValue"])])),_:1}),(0,r.Wm)(h,{label:"邮箱密码",prop:"password"},{default:(0,r.w5)((()=>[(0,r.Wm)(c,{modelValue:n.form.password,"onUpdate:modelValue":l[1]||(l[1]=e=>n.form.password=e),type:"password",placeholder:"请输入密码","show-password":""},null,8,["modelValue"])])),_:1}),(0,r.Wm)(h,{label:"SMTP",prop:"smtpHost"},{default:(0,r.w5)((()=>[(0,r.Wm)(w,{span:12},{default:(0,r.w5)((()=>[(0,r.Wm)(c,{modelValue:n.form.smtpHost,"onUpdate:modelValue":l[2]||(l[2]=e=>n.form.smtpHost=e),placeholder:"SMTP Host"},null,8,["modelValue"])])),_:1}),(0,r.Wm)(w,{span:1,style:{"text-align":"center"}},{default:(0,r.w5)((()=>[s])),_:1}),(0,r.Wm)(w,{span:6},{default:(0,r.w5)((()=>[(0,r.Wm)(c,{modelValue:n.form.smtpPort,"onUpdate:modelValue":l[3]||(l[3]=e=>n.form.smtpPort=e),placeholder:"SMTP Port"},null,8,["modelValue"])])),_:1})])),_:1}),(0,r.Wm)(h,{style:{"margin-top":"38px"}},{default:(0,r.w5)((()=>[(0,r.Wm)(_,{type:"primary",onClick:l[4]||(l[4]=e=>d.onSubmit("formRef"))},{default:(0,r.w5)((()=>[o])),_:1}),(0,r.Wm)(_,{type:"danger",onClick:l[5]||(l[5]=e=>d.onReset())},{default:(0,r.w5)((()=>[u])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1})])),_:1})])),_:1})}var n=t(3872);const d="/api/v1.0/settings",p=()=>n.Z.get(d+"/sys_email"),i=e=>n.Z.post(d+"/sys_email",e),f=()=>n.Z["delete"](d+"/sys_email");var c={data(){return{form:{smtpHost:null,smtpPort:null,username:null,password:null},formRule:{username:[this.requiredInputValidRule("请输入邮箱账号"),{type:"email",message:"邮箱格式不正确",trigger:"blur"}],password:[this.requiredInputValidRule("请输入邮箱密码")],smtpHost:[this.requiredInputValidRule("请输入 SMTP 地址")],smtpPort:[this.requiredInputValidRule("请输入 SMTP 端口"),{min:1,max:65535,message:"端口有效值为 1~65535",trigger:"blur"}]}}},mounted(){this.fetchSysMail()},methods:{requiredInputValidRule(e){return{required:!0,message:e,trigger:"blur"}},async fetchSysMail(){const e=await p().then((e=>e.data));e&&(this.form=e)},onSubmit(){this.$refs.formRef.validate((e=>e?(i(this.form).then((e=>{e.errCode||this.$message.success("更新成功")})),!0):(this.$message.error("请完善表单相关信息!"),!1)))},onReset(){this.$confirm("确认重置系统邮件吗?删除后数据将无法恢复","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{f().then((e=>{e.errCode||(this.form={},this.$message.success("重置成功"))}))}))}}},h=t(3744);const w=(0,h.Z)(c,[["render",m]]);var _=w}}]);
//# sourceMappingURL=596.afe6b2d4.js.map
//# sourceMappingURL=596.5dd323cf.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

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[865],{8865:function(t,n,e){e.r(n),e.d(n,{default:function(){return f}});var i=e(6252),r=e(9963),a=(0,i.Uk)("立即跳转");function o(t,n,e,o,u,l){var s=(0,i.up)("el-button"),c=(0,i.up)("el-result"),d=(0,i.up)("el-main"),f=(0,i.up)("el-container"),g=(0,i.Q2)("loading");return(0,i.wg)(),(0,i.j4)(f,null,{default:(0,i.w5)((function(){return[(0,i.wy)(((0,i.wg)(),(0,i.j4)(d,{class:"login-main"},{default:(0,i.w5)((function(){return[(0,i.wy)((0,i.Wm)(c,{icon:u.icon,title:u.title,"sub-title":u.subTitle},{extra:(0,i.w5)((function(){return[(0,i.Wm)(s,{type:"primary",onClick:n[0]||(n[0]=function(t){return l.toIndexPage()})},{default:(0,i.w5)((function(){return[a]})),_:1})]})),_:1},8,["icon","title","sub-title"]),[[r.F8,!u.loading]])]})),_:1})),[[g,u.loading]])]})),_:1})}var u=e(152),l=e(1836),s={data:function(){return{registrationId:null,icon:"",title:"",subTitle:"",loading:!0}},created:function(){this.registrationId=this.$route.params.id,this.login()},methods:{login:function(){var t=this,n=window.location.href,e=this.$route.query;e.redirect_uri=n,(0,u.rd)(this.registrationId,e).then((function(n){n.errCode?(t.title=n.errMessage,t.icon="error"):(l.E.saveUserLoginData(n.data),t.$store.commit("userUpdate",{nickname:n.data.nickname,username:n.data.username,email:n.data.email,avatar:n.data.avatar}),t.icon="success",t.$router.push({path:"/groups"})),t.loading=!1})).catch((function(n){console.log("login failed: "+n),t.icon="error",t.title="登陆失败,请重试",t.loading=!1}))},toIndexPage:function(){this.$router.push({path:"/"})}}},c=e(3744);const d=(0,c.Z)(s,[["render",o]]);var f=d}}]);
//# sourceMappingURL=865-legacy.fc2fd7b3.js.map
//# sourceMappingURL=865-legacy.3c829294.js.map

View File

@ -1 +1 @@
{"version":3,"file":"js/865-legacy.fc2fd7b3.js","mappings":"mNAUiE,Q,qKAT7DA,EAAAA,EAAAA,IAaeC,EAAA,M,kBAZX,iBAWU,uBAXVD,EAAAA,EAAAA,IAWUE,EAAA,CAXmBC,MAAM,cAAY,C,kBAC3C,iBASY,WATZC,EAAAA,EAAAA,IASYC,EAAA,CARPC,KAAMC,EAAAA,KACNC,MAAOD,EAAAA,MACP,YAAWA,EAAAA,UAHhB,CAMeE,OAAK,SAChB,iBAAiE,EAAjEL,EAAAA,EAAAA,IAAiEM,EAAA,CAAtDC,KAAK,UAAWC,QAAK,+BAAEC,EAAAA,iBAAlC,C,kBAAiD,iBAAI,O,eAPzD,wCAIaN,EAAAA,e,OALjB,IAAoBA,EAAAA,e,6BA2B5B,GACIO,KADW,WAEP,MAAO,CACHC,eAAgB,KAChBT,KAAM,GACNE,MAAO,GACPQ,SAAU,GACVC,SAAS,IAIjBC,QAXW,WAYPC,KAAKJ,eAAiBI,KAAKC,OAAOC,OAAOC,GACzCH,KAAKI,SAGTC,QAAS,CACJD,MADI,WACI,WACCE,EAAcC,OAAOC,SAASC,KAC9BP,EAASF,KAAKC,OAAOS,MAC3BR,EAAOS,aAAeL,GACtBM,EAAAA,EAAAA,IAAYZ,KAAKJ,eAAgBM,GAAQW,MAAK,SAAAC,GACrCA,EAAKC,SAWN,EAAK1B,MAAQyB,EAAKE,WAClB,EAAK7B,KAAO,UAXZ8B,EAAAA,EAAAA,kBAAuBH,EAAKnB,MAC5B,EAAKuB,OAAOC,OAAO,aAAc,CAC7BC,SAAUN,EAAKnB,KAAKyB,SACpBC,SAAUP,EAAKnB,KAAK0B,SACpBC,MAAOR,EAAKnB,KAAK2B,MACjBC,OAAQT,EAAKnB,KAAK4B,SAEtB,EAAKpC,KAAK,UACV,EAAKqC,QAAQC,KAAK,CAACC,KAAM,aAK7B,EAAK5B,SAAU,KAChB6B,OAAM,SAAAC,GACLC,QAAQC,IAAI,iBAAiBF,GAC7B,EAAKzC,KAAO,QACZ,EAAKE,MAAQ,WACb,EAAKS,SAAU,MAIvBiC,YA7BK,WA8BD/B,KAAKwB,QAAQC,KAAK,CAACC,KAAM,S,UCpErC,MAAMM,GAA2B,OAAgB,EAAQ,CAAC,CAAC,SAASC,KAEpE","sources":["webpack://databasir-frontend/./src/views/OAuth2Login.vue","webpack://databasir-frontend/./src/views/OAuth2Login.vue?b6ea"],"sourcesContent":["<template>\r\n <el-container>\r\n <el-main v-loading=\"loading\" class=\"login-main\">\r\n <el-result\r\n :icon=\"icon\"\r\n :title=\"title\"\r\n :sub-title=\"subTitle\"\r\n v-show=\"!loading\"\r\n >\r\n <template #extra>\r\n <el-button type=\"primary\" @click=\"toIndexPage()\">立即跳转</el-button>\r\n </template>\r\n </el-result>\r\n </el-main>\r\n </el-container>\r\n</template>\r\n\r\n<style>\r\n.login-main {\r\n margin: 0 auto;\r\n margin-top: 200px;\r\n}\r\n\r\n</style>\r\n<script>\r\nimport { oauth2Login } from \"../api/Login\"\r\nimport { user } from \"../utils/auth\"\r\n\r\n\r\nexport default {\r\n data() {\r\n return {\r\n registrationId: null,\r\n icon: '',\r\n title: '',\r\n subTitle: '',\r\n loading: true,\r\n }\r\n },\r\n\r\n created() {\r\n this.registrationId = this.$route.params.id\r\n this.login()\r\n },\r\n\r\n methods: {\r\n login() {\r\n const redirectUri = window.location.href\r\n const params = this.$route.query\r\n params.redirect_uri = redirectUri\r\n oauth2Login(this.registrationId, params).then(resp => {\r\n if (!resp.errCode) {\r\n user.saveUserLoginData(resp.data)\r\n this.$store.commit('userUpdate', {\r\n nickname: resp.data.nickname,\r\n username: resp.data.username,\r\n email: resp.data.email,\r\n avatar: resp.data.avatar\r\n })\r\n this.icon='success'\r\n this.$router.push({path: '/groups'})\r\n } else {\r\n this.title = resp.errMessage\r\n this.icon = 'error'\r\n }\r\n this.loading = false\r\n }).catch(err => {\r\n console.log('login failed: '+err)\r\n this.icon = 'error'\r\n this.title = '登陆失败,请重试'\r\n this.loading = false\r\n })\r\n },\r\n\r\n toIndexPage() {\r\n this.$router.push({path: '/'})\r\n }\r\n }\r\n}\r\n</script>","import { render } from \"./OAuth2Login.vue?vue&type=template&id=65bc9922\"\nimport script from \"./OAuth2Login.vue?vue&type=script&lang=js\"\nexport * from \"./OAuth2Login.vue?vue&type=script&lang=js\"\n\nimport \"./OAuth2Login.vue?vue&type=style&index=0&id=65bc9922&lang=css\"\n\nimport exportComponent from \"E:\\\\git_workspace\\\\databasir-frontend\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"names":["_createBlock","_component_el_container","_component_el_main","class","_createVNode","_component_el_result","icon","$data","title","extra","_component_el_button","type","onClick","$options","data","registrationId","subTitle","loading","created","this","$route","params","id","login","methods","redirectUri","window","location","href","query","redirect_uri","oauth2Login","then","resp","errCode","errMessage","user","$store","commit","nickname","username","email","avatar","$router","push","path","catch","err","console","log","toIndexPage","__exports__","render"],"sourceRoot":""}
{"version":3,"file":"js/865-legacy.3c829294.js","mappings":"mNAUiE,Q,qKAT7DA,EAAAA,EAAAA,IAaeC,EAAA,M,kBAZX,iBAWU,uBAXVD,EAAAA,EAAAA,IAWUE,EAAA,CAXmBC,MAAM,cAAY,C,kBAC3C,iBASY,WATZC,EAAAA,EAAAA,IASYC,EAAA,CARPC,KAAMC,EAAAA,KACNC,MAAOD,EAAAA,MACP,YAAWA,EAAAA,UAHhB,CAMeE,OAAK,SAChB,iBAAiE,EAAjEL,EAAAA,EAAAA,IAAiEM,EAAA,CAAtDC,KAAK,UAAWC,QAAK,+BAAEC,EAAAA,iBAAlC,C,kBAAiD,iBAAI,O,eAPzD,wCAIaN,EAAAA,e,OALjB,IAAoBA,EAAAA,e,6BA2B5B,GACIO,KADW,WAEP,MAAO,CACHC,eAAgB,KAChBT,KAAM,GACNE,MAAO,GACPQ,SAAU,GACVC,SAAS,IAIjBC,QAXW,WAYPC,KAAKJ,eAAiBI,KAAKC,OAAOC,OAAOC,GACzCH,KAAKI,SAGTC,QAAS,CACJD,MADI,WACI,WACCE,EAAcC,OAAOC,SAASC,KAC9BP,EAASF,KAAKC,OAAOS,MAC3BR,EAAOS,aAAeL,GACtBM,EAAAA,EAAAA,IAAYZ,KAAKJ,eAAgBM,GAAQW,MAAK,SAAAC,GACrCA,EAAKC,SAWN,EAAK1B,MAAQyB,EAAKE,WAClB,EAAK7B,KAAO,UAXZ8B,EAAAA,EAAAA,kBAAuBH,EAAKnB,MAC5B,EAAKuB,OAAOC,OAAO,aAAc,CAC7BC,SAAUN,EAAKnB,KAAKyB,SACpBC,SAAUP,EAAKnB,KAAK0B,SACpBC,MAAOR,EAAKnB,KAAK2B,MACjBC,OAAQT,EAAKnB,KAAK4B,SAEtB,EAAKpC,KAAK,UACV,EAAKqC,QAAQC,KAAK,CAACC,KAAM,aAK7B,EAAK5B,SAAU,KAChB6B,OAAM,SAAAC,GACLC,QAAQC,IAAI,iBAAiBF,GAC7B,EAAKzC,KAAO,QACZ,EAAKE,MAAQ,WACb,EAAKS,SAAU,MAIvBiC,YA7BK,WA8BD/B,KAAKwB,QAAQC,KAAK,CAACC,KAAM,S,UCpErC,MAAMM,GAA2B,OAAgB,EAAQ,CAAC,CAAC,SAASC,KAEpE","sources":["webpack://databasir-frontend/./src/views/OAuth2Login.vue","webpack://databasir-frontend/./src/views/OAuth2Login.vue?b6ea"],"sourcesContent":["<template>\r\n <el-container>\r\n <el-main v-loading=\"loading\" class=\"login-main\">\r\n <el-result\r\n :icon=\"icon\"\r\n :title=\"title\"\r\n :sub-title=\"subTitle\"\r\n v-show=\"!loading\"\r\n >\r\n <template #extra>\r\n <el-button type=\"primary\" @click=\"toIndexPage()\">立即跳转</el-button>\r\n </template>\r\n </el-result>\r\n </el-main>\r\n </el-container>\r\n</template>\r\n\r\n<style>\r\n.login-main {\r\n margin: 0 auto;\r\n margin-top: 200px;\r\n}\r\n\r\n</style>\r\n<script>\r\nimport { oauth2Login } from \"../api/Login\"\r\nimport { user } from \"../utils/auth\"\r\n\r\n\r\nexport default {\r\n data() {\r\n return {\r\n registrationId: null,\r\n icon: '',\r\n title: '',\r\n subTitle: '',\r\n loading: true,\r\n }\r\n },\r\n\r\n created() {\r\n this.registrationId = this.$route.params.id\r\n this.login()\r\n },\r\n\r\n methods: {\r\n login() {\r\n const redirectUri = window.location.href\r\n const params = this.$route.query\r\n params.redirect_uri = redirectUri\r\n oauth2Login(this.registrationId, params).then(resp => {\r\n if (!resp.errCode) {\r\n user.saveUserLoginData(resp.data)\r\n this.$store.commit('userUpdate', {\r\n nickname: resp.data.nickname,\r\n username: resp.data.username,\r\n email: resp.data.email,\r\n avatar: resp.data.avatar\r\n })\r\n this.icon='success'\r\n this.$router.push({path: '/groups'})\r\n } else {\r\n this.title = resp.errMessage\r\n this.icon = 'error'\r\n }\r\n this.loading = false\r\n }).catch(err => {\r\n console.log('login failed: '+err)\r\n this.icon = 'error'\r\n this.title = '登陆失败,请重试'\r\n this.loading = false\r\n })\r\n },\r\n\r\n toIndexPage() {\r\n this.$router.push({path: '/'})\r\n }\r\n }\r\n}\r\n</script>","import { render } from \"./OAuth2Login.vue?vue&type=template&id=65bc9922\"\nimport script from \"./OAuth2Login.vue?vue&type=script&lang=js\"\nexport * from \"./OAuth2Login.vue?vue&type=script&lang=js\"\n\nimport \"./OAuth2Login.vue?vue&type=style&index=0&id=65bc9922&lang=css\"\n\nimport exportComponent from \"E:\\\\git_workspace\\\\databasir-frontend\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"names":["_createBlock","_component_el_container","_component_el_main","class","_createVNode","_component_el_result","icon","$data","title","extra","_component_el_button","type","onClick","$options","data","registrationId","subTitle","loading","created","this","$route","params","id","login","methods","redirectUri","window","location","href","query","redirect_uri","oauth2Login","then","resp","errCode","errMessage","user","$store","commit","nickname","username","email","avatar","$router","push","path","catch","err","console","log","toIndexPage","__exports__","render"],"sourceRoot":""}

View File

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[865],{8865:function(t,e,i){i.r(e),i.d(e,{default:function(){return h}});var a=i(6252),n=i(9963);const r=(0,a.Uk)("立即跳转");function s(t,e,i,s,o,l){const u=(0,a.up)("el-button"),d=(0,a.up)("el-result"),c=(0,a.up)("el-main"),h=(0,a.up)("el-container"),g=(0,a.Q2)("loading");return(0,a.wg)(),(0,a.j4)(h,null,{default:(0,a.w5)((()=>[(0,a.wy)(((0,a.wg)(),(0,a.j4)(c,{class:"login-main"},{default:(0,a.w5)((()=>[(0,a.wy)((0,a.Wm)(d,{icon:o.icon,title:o.title,"sub-title":o.subTitle},{extra:(0,a.w5)((()=>[(0,a.Wm)(u,{type:"primary",onClick:e[0]||(e[0]=t=>l.toIndexPage())},{default:(0,a.w5)((()=>[r])),_:1})])),_:1},8,["icon","title","sub-title"]),[[n.F8,!o.loading]])])),_:1})),[[g,o.loading]])])),_:1})}var o=i(152),l=i(1836),u={data(){return{registrationId:null,icon:"",title:"",subTitle:"",loading:!0}},created(){this.registrationId=this.$route.params.id,this.login()},methods:{login(){const t=window.location.href,e=this.$route.query;e.redirect_uri=t,(0,o.rd)(this.registrationId,e).then((t=>{t.errCode?(this.title=t.errMessage,this.icon="error"):(l.E.saveUserLoginData(t.data),this.$store.commit("userUpdate",{nickname:t.data.nickname,username:t.data.username,email:t.data.email,avatar:t.data.avatar}),this.icon="success",this.$router.push({path:"/groups"})),this.loading=!1})).catch((t=>{console.log("login failed: "+t),this.icon="error",this.title="登陆失败,请重试",this.loading=!1}))},toIndexPage(){this.$router.push({path:"/"})}}},d=i(3744);const c=(0,d.Z)(u,[["render",s]]);var h=c}}]);
//# sourceMappingURL=865.ebbb1893.js.map
//# sourceMappingURL=865.ef6dc5a3.js.map

View File

@ -1 +1 @@
{"version":3,"file":"js/865.ebbb1893.js","mappings":"yNAUiE,Q,uKAT7DA,EAAAA,EAAAA,IAaeC,EAAA,M,kBAZX,IAWU,uBAXVD,EAAAA,EAAAA,IAWUE,EAAA,CAXmBC,MAAM,cAAY,C,kBAC3C,IASY,WATZC,EAAAA,EAAAA,IASYC,EAAA,CARPC,KAAMC,EAAAA,KACNC,MAAOD,EAAAA,MACP,YAAWA,EAAAA,UAHhB,CAMeE,OAAK,SAChB,IAAiE,EAAjEL,EAAAA,EAAAA,IAAiEM,EAAA,CAAtDC,KAAK,UAAWC,QAAK,eAAEC,EAAAA,gBAAlC,C,kBAAiD,IAAI,M,cAPzD,wCAIaN,EAAAA,c,OALjB,IAAoBA,EAAAA,c,6BA2B5B,GACIO,OACI,MAAO,CACHC,eAAgB,KAChBT,KAAM,GACNE,MAAO,GACPQ,SAAU,GACVC,SAAS,IAIjBC,UACIC,KAAKJ,eAAiBI,KAAKC,OAAOC,OAAOC,GACzCH,KAAKI,SAGTC,QAAS,CACJD,QACG,MAAME,EAAcC,OAAOC,SAASC,KAC9BP,EAASF,KAAKC,OAAOS,MAC3BR,EAAOS,aAAeL,GACtBM,EAAAA,EAAAA,IAAYZ,KAAKJ,eAAgBM,GAAQW,MAAKC,IACrCA,EAAKC,SAWNf,KAAKX,MAAQyB,EAAKE,WAClBhB,KAAKb,KAAO,UAXZ8B,EAAAA,EAAAA,kBAAuBH,EAAKnB,MAC5BK,KAAKkB,OAAOC,OAAO,aAAc,CAC7BC,SAAUN,EAAKnB,KAAKyB,SACpBC,SAAUP,EAAKnB,KAAK0B,SACpBC,MAAOR,EAAKnB,KAAK2B,MACjBC,OAAQT,EAAKnB,KAAK4B,SAEtBvB,KAAKb,KAAK,UACVa,KAAKwB,QAAQC,KAAK,CAACC,KAAM,aAK7B1B,KAAKF,SAAU,KAChB6B,OAAMC,IACLC,QAAQC,IAAI,iBAAiBF,GAC7B5B,KAAKb,KAAO,QACZa,KAAKX,MAAQ,WACbW,KAAKF,SAAU,MAIvBiC,cACI/B,KAAKwB,QAAQC,KAAK,CAACC,KAAM,S,UCpErC,MAAMM,GAA2B,OAAgB,EAAQ,CAAC,CAAC,SAASC,KAEpE","sources":["webpack://databasir-frontend/./src/views/OAuth2Login.vue","webpack://databasir-frontend/./src/views/OAuth2Login.vue?b6ea"],"sourcesContent":["<template>\r\n <el-container>\r\n <el-main v-loading=\"loading\" class=\"login-main\">\r\n <el-result\r\n :icon=\"icon\"\r\n :title=\"title\"\r\n :sub-title=\"subTitle\"\r\n v-show=\"!loading\"\r\n >\r\n <template #extra>\r\n <el-button type=\"primary\" @click=\"toIndexPage()\">立即跳转</el-button>\r\n </template>\r\n </el-result>\r\n </el-main>\r\n </el-container>\r\n</template>\r\n\r\n<style>\r\n.login-main {\r\n margin: 0 auto;\r\n margin-top: 200px;\r\n}\r\n\r\n</style>\r\n<script>\r\nimport { oauth2Login } from \"../api/Login\"\r\nimport { user } from \"../utils/auth\"\r\n\r\n\r\nexport default {\r\n data() {\r\n return {\r\n registrationId: null,\r\n icon: '',\r\n title: '',\r\n subTitle: '',\r\n loading: true,\r\n }\r\n },\r\n\r\n created() {\r\n this.registrationId = this.$route.params.id\r\n this.login()\r\n },\r\n\r\n methods: {\r\n login() {\r\n const redirectUri = window.location.href\r\n const params = this.$route.query\r\n params.redirect_uri = redirectUri\r\n oauth2Login(this.registrationId, params).then(resp => {\r\n if (!resp.errCode) {\r\n user.saveUserLoginData(resp.data)\r\n this.$store.commit('userUpdate', {\r\n nickname: resp.data.nickname,\r\n username: resp.data.username,\r\n email: resp.data.email,\r\n avatar: resp.data.avatar\r\n })\r\n this.icon='success'\r\n this.$router.push({path: '/groups'})\r\n } else {\r\n this.title = resp.errMessage\r\n this.icon = 'error'\r\n }\r\n this.loading = false\r\n }).catch(err => {\r\n console.log('login failed: '+err)\r\n this.icon = 'error'\r\n this.title = '登陆失败,请重试'\r\n this.loading = false\r\n })\r\n },\r\n\r\n toIndexPage() {\r\n this.$router.push({path: '/'})\r\n }\r\n }\r\n}\r\n</script>","import { render } from \"./OAuth2Login.vue?vue&type=template&id=65bc9922\"\nimport script from \"./OAuth2Login.vue?vue&type=script&lang=js\"\nexport * from \"./OAuth2Login.vue?vue&type=script&lang=js\"\n\nimport \"./OAuth2Login.vue?vue&type=style&index=0&id=65bc9922&lang=css\"\n\nimport exportComponent from \"E:\\\\git_workspace\\\\databasir-frontend\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"names":["_createBlock","_component_el_container","_component_el_main","class","_createVNode","_component_el_result","icon","$data","title","extra","_component_el_button","type","onClick","$options","data","registrationId","subTitle","loading","created","this","$route","params","id","login","methods","redirectUri","window","location","href","query","redirect_uri","oauth2Login","then","resp","errCode","errMessage","user","$store","commit","nickname","username","email","avatar","$router","push","path","catch","err","console","log","toIndexPage","__exports__","render"],"sourceRoot":""}
{"version":3,"file":"js/865.ef6dc5a3.js","mappings":"yNAUiE,Q,uKAT7DA,EAAAA,EAAAA,IAaeC,EAAA,M,kBAZX,IAWU,uBAXVD,EAAAA,EAAAA,IAWUE,EAAA,CAXmBC,MAAM,cAAY,C,kBAC3C,IASY,WATZC,EAAAA,EAAAA,IASYC,EAAA,CARPC,KAAMC,EAAAA,KACNC,MAAOD,EAAAA,MACP,YAAWA,EAAAA,UAHhB,CAMeE,OAAK,SAChB,IAAiE,EAAjEL,EAAAA,EAAAA,IAAiEM,EAAA,CAAtDC,KAAK,UAAWC,QAAK,eAAEC,EAAAA,gBAAlC,C,kBAAiD,IAAI,M,cAPzD,wCAIaN,EAAAA,c,OALjB,IAAoBA,EAAAA,c,6BA2B5B,GACIO,OACI,MAAO,CACHC,eAAgB,KAChBT,KAAM,GACNE,MAAO,GACPQ,SAAU,GACVC,SAAS,IAIjBC,UACIC,KAAKJ,eAAiBI,KAAKC,OAAOC,OAAOC,GACzCH,KAAKI,SAGTC,QAAS,CACJD,QACG,MAAME,EAAcC,OAAOC,SAASC,KAC9BP,EAASF,KAAKC,OAAOS,MAC3BR,EAAOS,aAAeL,GACtBM,EAAAA,EAAAA,IAAYZ,KAAKJ,eAAgBM,GAAQW,MAAKC,IACrCA,EAAKC,SAWNf,KAAKX,MAAQyB,EAAKE,WAClBhB,KAAKb,KAAO,UAXZ8B,EAAAA,EAAAA,kBAAuBH,EAAKnB,MAC5BK,KAAKkB,OAAOC,OAAO,aAAc,CAC7BC,SAAUN,EAAKnB,KAAKyB,SACpBC,SAAUP,EAAKnB,KAAK0B,SACpBC,MAAOR,EAAKnB,KAAK2B,MACjBC,OAAQT,EAAKnB,KAAK4B,SAEtBvB,KAAKb,KAAK,UACVa,KAAKwB,QAAQC,KAAK,CAACC,KAAM,aAK7B1B,KAAKF,SAAU,KAChB6B,OAAMC,IACLC,QAAQC,IAAI,iBAAiBF,GAC7B5B,KAAKb,KAAO,QACZa,KAAKX,MAAQ,WACbW,KAAKF,SAAU,MAIvBiC,cACI/B,KAAKwB,QAAQC,KAAK,CAACC,KAAM,S,UCpErC,MAAMM,GAA2B,OAAgB,EAAQ,CAAC,CAAC,SAASC,KAEpE","sources":["webpack://databasir-frontend/./src/views/OAuth2Login.vue","webpack://databasir-frontend/./src/views/OAuth2Login.vue?b6ea"],"sourcesContent":["<template>\r\n <el-container>\r\n <el-main v-loading=\"loading\" class=\"login-main\">\r\n <el-result\r\n :icon=\"icon\"\r\n :title=\"title\"\r\n :sub-title=\"subTitle\"\r\n v-show=\"!loading\"\r\n >\r\n <template #extra>\r\n <el-button type=\"primary\" @click=\"toIndexPage()\">立即跳转</el-button>\r\n </template>\r\n </el-result>\r\n </el-main>\r\n </el-container>\r\n</template>\r\n\r\n<style>\r\n.login-main {\r\n margin: 0 auto;\r\n margin-top: 200px;\r\n}\r\n\r\n</style>\r\n<script>\r\nimport { oauth2Login } from \"../api/Login\"\r\nimport { user } from \"../utils/auth\"\r\n\r\n\r\nexport default {\r\n data() {\r\n return {\r\n registrationId: null,\r\n icon: '',\r\n title: '',\r\n subTitle: '',\r\n loading: true,\r\n }\r\n },\r\n\r\n created() {\r\n this.registrationId = this.$route.params.id\r\n this.login()\r\n },\r\n\r\n methods: {\r\n login() {\r\n const redirectUri = window.location.href\r\n const params = this.$route.query\r\n params.redirect_uri = redirectUri\r\n oauth2Login(this.registrationId, params).then(resp => {\r\n if (!resp.errCode) {\r\n user.saveUserLoginData(resp.data)\r\n this.$store.commit('userUpdate', {\r\n nickname: resp.data.nickname,\r\n username: resp.data.username,\r\n email: resp.data.email,\r\n avatar: resp.data.avatar\r\n })\r\n this.icon='success'\r\n this.$router.push({path: '/groups'})\r\n } else {\r\n this.title = resp.errMessage\r\n this.icon = 'error'\r\n }\r\n this.loading = false\r\n }).catch(err => {\r\n console.log('login failed: '+err)\r\n this.icon = 'error'\r\n this.title = '登陆失败,请重试'\r\n this.loading = false\r\n })\r\n },\r\n\r\n toIndexPage() {\r\n this.$router.push({path: '/'})\r\n }\r\n }\r\n}\r\n</script>","import { render } from \"./OAuth2Login.vue?vue&type=template&id=65bc9922\"\nimport script from \"./OAuth2Login.vue?vue&type=script&lang=js\"\nexport * from \"./OAuth2Login.vue?vue&type=script&lang=js\"\n\nimport \"./OAuth2Login.vue?vue&type=style&index=0&id=65bc9922&lang=css\"\n\nimport exportComponent from \"E:\\\\git_workspace\\\\databasir-frontend\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"names":["_createBlock","_component_el_container","_component_el_main","class","_createVNode","_component_el_result","icon","$data","title","extra","_component_el_button","type","onClick","$options","data","registrationId","subTitle","loading","created","this","$route","params","id","login","methods","redirectUri","window","location","href","query","redirect_uri","oauth2Login","then","resp","errCode","errMessage","user","$store","commit","nickname","username","email","avatar","$router","push","path","catch","err","console","log","toIndexPage","__exports__","render"],"sourceRoot":""}

View File

@ -1,2 +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.6cfcb3aa.js.map
//# sourceMappingURL=99-legacy.618121ce.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

View File

@ -1,2 +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.79a6a4f8.js.map
//# 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

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

File diff suppressed because one or more lines are too long

View File

@ -1,20 +0,0 @@
package com.databasir.core.domain.document.converter;
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
import com.databasir.core.infrastructure.converter.JsonConverter;
import com.databasir.dao.tables.pojos.DatabaseDocumentHistoryPojo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
@Mapper(componentModel = "spring", uses = JsonConverter.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface DocumentHistoryPojoConverter {
@Mapping(target = "databaseDocumentObject", source = "databaseMetaObject")
@Mapping(target = "id", ignore = true)
@Mapping(target = "createAt", ignore = true)
DatabaseDocumentHistoryPojo of(DatabaseDocumentResponse databaseMetaObject,
Integer projectId,
Integer databaseDocumentId,
Long version);
}

View File

@ -16,16 +16,11 @@ import java.util.stream.Collectors;
public interface DocumentPojoConverter extends BaseConverter {
@Mapping(target = "databaseName", source = "meta.databaseName")
@Mapping(target = "isArchive", constant = "false")
DatabaseDocumentPojo toDatabasePojo(Integer projectId,
com.databasir.core.meta.data.DatabaseMeta meta,
Long version);
@Mapping(target = "databaseName", source = "meta.databaseName")
DatabaseDocumentPojo toDatabasePojo(Integer projectId,
com.databasir.core.meta.data.DatabaseMeta meta,
Integer id,
Long version);
@Mapping(target = "comment", qualifiedBy = NullToEmpty.class)
TableDocumentPojo toTablePojo(Integer databaseDocumentId,
com.databasir.core.meta.data.TableMeta meta);

View File

@ -0,0 +1,21 @@
package com.databasir.core.domain.document.converter;
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
import com.databasir.core.infrastructure.converter.JsonConverter;
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
import com.databasir.dao.tables.pojos.TableDocumentPojo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import java.util.List;
@Mapper(componentModel = "spring", uses = JsonConverter.class, unmappedTargetPolicy = ReportingPolicy.WARN)
public interface DocumentSimpleResponseConverter {
@Mapping(target = "id", source = "databaseDocument.id")
@Mapping(target = "createAt", source = "databaseDocument.createAt")
@Mapping(target = "documentVersion", source = "databaseDocument.version")
DatabaseDocumentSimpleResponse of(DatabaseDocumentPojo databaseDocument,
List<TableDocumentPojo> tables);
}

View File

@ -0,0 +1,37 @@
package com.databasir.core.domain.document.data;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Data
public class DatabaseDocumentSimpleResponse {
private Integer id;
private String databaseName;
private String productName;
private String productVersion;
private Integer documentVersion;
private List<TableData> tables = new ArrayList<>();
private LocalDateTime createAt;
@Data
public static class TableData {
private Integer id;
private String name;
private String type;
private String comment;
}
}

View File

@ -13,6 +13,8 @@ import java.time.LocalDateTime;
@Builder
public class DatabaseDocumentVersionResponse {
private Integer databaseDocumentId;
private Long version;
private LocalDateTime createAt;

View File

@ -3,10 +3,11 @@ package com.databasir.core.domain.document.service;
import com.databasir.core.Databasir;
import com.databasir.core.DatabasirConfig;
import com.databasir.core.domain.DomainErrors;
import com.databasir.core.domain.document.converter.DocumentHistoryPojoConverter;
import com.databasir.core.domain.document.converter.DocumentPojoConverter;
import com.databasir.core.domain.document.converter.DocumentResponseConverter;
import com.databasir.core.domain.document.converter.DocumentSimpleResponseConverter;
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
import com.databasir.core.infrastructure.connection.DatabaseConnectionService;
import com.databasir.core.infrastructure.converter.JsonConverter;
@ -20,6 +21,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.sql.Connection;
import java.util.*;
@ -53,30 +55,28 @@ public class DocumentService {
private final TableTriggerDocumentDao tableTriggerDocumentDao;
private final DatabaseDocumentHistoryDao databaseDocumentHistoryDao;
private final DocumentPojoConverter documentPojoConverter;
private final DocumentResponseConverter documentResponseConverter;
private final DocumentHistoryPojoConverter documentHistoryPojoConverter;
private final DocumentSimpleResponseConverter documentSimpleResponseConverter;
private final JsonConverter jsonConverter;
@Transactional
public void syncByProjectId(Integer projectId) {
ProjectPojo project = projectDao.selectOptionalById(projectId)
projectDao.selectOptionalById(projectId)
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
DatabaseMeta meta = retrieveDatabaseMeta(projectId);
Optional<DatabaseDocumentPojo> historyDocumentOpt = databaseDocumentDao.selectOptionalByProjectId(projectId);
if (historyDocumentOpt.isPresent()) {
DatabaseDocumentPojo historyDocument = historyDocumentOpt.get();
Integer previousDocumentId = historyDocument.getId();
saveAsHistory(historyDocument);
deleteDeprecatedDocument(previousDocumentId);
saveNewDocument(meta, historyDocument.getVersion() + 1, historyDocument.getProjectId(), previousDocumentId);
Optional<DatabaseDocumentPojo> latestDocumentOpt = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
if (latestDocumentOpt.isPresent()) {
DatabaseDocumentPojo latestDocument = latestDocumentOpt.get();
Integer previousDocumentId = latestDocument.getId();
// archive old version
databaseDocumentDao.updateIsArchiveById(previousDocumentId, true);
saveNewDocument(meta, latestDocument.getVersion() + 1, latestDocument.getProjectId());
} else {
saveNewDocument(meta, 1L, projectId, null);
saveNewDocument(meta, 1L, projectId);
}
}
@ -93,42 +93,12 @@ public class DocumentService {
.orElseThrow(DomainErrors.DATABASE_META_NOT_FOUND::exception);
}
private void saveAsHistory(DatabaseDocumentPojo databaseDocument) {
// save history
Integer projectId = databaseDocument.getProjectId();
Integer databaseMetaId = databaseDocument.getId();
DatabaseDocumentResponse databaseDocumentResponse = getOneByProjectId(projectId, null).orElse(null);
Long currVersion = databaseDocument.getVersion();
DatabaseDocumentHistoryPojo documentHistoryPojo =
documentHistoryPojoConverter.of(databaseDocumentResponse, projectId, databaseMetaId, currVersion);
databaseDocumentHistoryDao.insertAndReturnId(documentHistoryPojo);
log.info("save old meta info to history success");
}
private void deleteDeprecatedDocument(Integer databaseDocumentId) {
// delete old meta info
tableDocumentDao.deleteByDatabaseDocumentId(databaseDocumentId);
tableColumnDocumentDao.deleteByDatabaseDocumentId(databaseDocumentId);
tableIndexDocumentDao.deleteByDatabaseMetaId(databaseDocumentId);
tableTriggerDocumentDao.deleteByDatabaseDocumentId(databaseDocumentId);
log.info("delete old meta info success");
}
private void saveNewDocument(DatabaseMeta meta,
Long version,
Integer projectId,
Integer databaseDocumentId) {
Integer projectId) {
Integer currentDatabaseDocumentId = databaseDocumentId;
if (databaseDocumentId == null) {
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, 1L);
currentDatabaseDocumentId = databaseDocumentDao.insertAndReturnId(pojo);
} else {
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, databaseDocumentId, version);
databaseDocumentDao.update(pojo);
}
final Integer docId = currentDatabaseDocumentId;
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, version);
final Integer docId = databaseDocumentDao.insertAndReturnId(pojo);
meta.getTables().forEach(table -> {
TableDocumentPojo tableMeta =
documentPojoConverter.toTablePojo(docId, table);
@ -143,13 +113,37 @@ public class DocumentService {
documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
tableTriggerDocumentDao.batchInsert(tableTriggerMetas);
});
log.info("save new meta info success");
log.info("save new version document success: projectId = {}, name = {}, version = {}",
projectId, meta.getDatabaseName(), version);
}
public Optional<DatabaseDocumentSimpleResponse> getSimpleOneByProjectId(Integer projectId, Long version) {
if (version == null) {
return databaseDocumentDao.selectNotArchivedByProjectId(projectId)
.map(document -> {
Integer id = document.getId();
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
return documentSimpleResponseConverter.of(document, tables);
});
} else {
return databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, version)
.map(document -> {
Integer id = document.getId();
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
return documentSimpleResponseConverter.of(document, tables);
});
}
}
public Optional<DatabaseDocumentResponse> getOneByProjectId(Integer projectId, Long version) {
Optional<DatabaseDocumentPojo> documentOption;
if (version == null) {
return databaseDocumentDao.selectOptionalByProjectId(projectId)
.map(document -> {
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
} else {
documentOption = databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, version);
}
return documentOption.map(document -> {
Integer id = document.getId();
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(id);
@ -164,34 +158,61 @@ public class DocumentService {
var tableDocumentResponseList = tables.stream()
.map(table -> {
Integer tableId = table.getId();
var subColumns =
columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subIndexes =
indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subTriggers =
triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subColumns = columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subIndexes = indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subTriggers = triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
})
.collect(Collectors.toList());
return documentResponseConverter.of(document, tableDocumentResponseList);
});
} else {
return databaseDocumentHistoryDao.selectOptionalByProjectIdAndVersion(projectId, version)
.map(obj -> jsonConverter.of(obj.getDatabaseDocumentObject()));
}
}
public Page<DatabaseDocumentVersionResponse> getVersionsBySchemaSourceId(Integer projectId, Pageable page) {
return databaseDocumentDao.selectOptionalByProjectId(projectId)
.map(schemaMeta ->
databaseDocumentHistoryDao.selectVersionPageByDatabaseDocumentId(page, schemaMeta.getId())
public Page<DatabaseDocumentVersionResponse> getVersionsByProjectId(Integer projectId, Pageable page) {
return databaseDocumentDao.selectNotArchivedByProjectId(projectId)
.map(databaseDocument ->
databaseDocumentDao.selectVersionPageByProjectId(page, projectId)
.map(history -> DatabaseDocumentVersionResponse.builder()
.databaseDocumentId(history.getId())
.version(history.getVersion())
.createAt(history.getCreateAt())
.build()))
.orElseGet(Page::empty);
}
public List<DatabaseDocumentResponse.TableDocumentResponse> getTableDetails(Integer projectId,
Integer databaseDocumentId,
List<Integer> tableIds) {
// maybe deleted
if (CollectionUtils.isEmpty(tableIds) || !projectDao.existsById(projectId)) {
return Collections.emptyList();
}
var tables =
tableDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
var columns =
tableColumnDocumentDao.selectByDatabaseDocumentIdAndTableIdIn(databaseDocumentId, tableIds);
var indexes =
tableIndexDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
var triggers =
tableTriggerDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
return tables.stream()
.map(table -> {
Integer tableId = table.getId();
var subColumns = columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subIndexes = indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
var subTriggers = triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
})
.collect(Collectors.toList());
}
public Optional<String> toMarkdown(Integer projectId, Long version) {
return getOneByProjectId(projectId, version)
.map(doc -> {

View File

@ -4,11 +4,19 @@ import com.databasir.core.domain.group.data.GroupCreateRequest;
import com.databasir.core.domain.group.data.GroupUpdateRequest;
import com.databasir.dao.tables.pojos.GroupPojo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper(componentModel = "spring")
public interface GroupPojoConverter {
@Mapping(target = "id", ignore = true)
@Mapping(target = "deleted", ignore = true)
@Mapping(target = "createAt", ignore = true)
@Mapping(target = "updateAt", ignore = true)
GroupPojo of(GroupCreateRequest groupCreateRequest);
@Mapping(target = "deleted", ignore = true)
@Mapping(target = "createAt", ignore = true)
@Mapping(target = "updateAt", ignore = true)
GroupPojo of(GroupUpdateRequest groupUpdateRequest);
}

View File

@ -7,7 +7,6 @@ package com.databasir.dao;
import com.databasir.dao.tables.DataSource;
import com.databasir.dao.tables.DataSourceProperty;
import com.databasir.dao.tables.DatabaseDocument;
import com.databasir.dao.tables.DatabaseDocumentHistory;
import com.databasir.dao.tables.DocumentRemark;
import com.databasir.dao.tables.Group;
import com.databasir.dao.tables.Login;
@ -61,11 +60,6 @@ public class Databasir extends SchemaImpl {
*/
public final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
/**
* The table <code>databasir.database_document_history</code>.
*/
public final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY;
/**
* The table <code>databasir.document_remark</code>.
*/
@ -165,7 +159,6 @@ public class Databasir extends SchemaImpl {
DataSource.DATA_SOURCE,
DataSourceProperty.DATA_SOURCE_PROPERTY,
DatabaseDocument.DATABASE_DOCUMENT,
DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY,
DocumentRemark.DOCUMENT_REMARK,
Group.GROUP,
Login.LOGIN,

View File

@ -5,7 +5,7 @@ package com.databasir.dao;
import com.databasir.dao.tables.DataSourceProperty;
import com.databasir.dao.tables.DatabaseDocumentHistory;
import com.databasir.dao.tables.DatabaseDocument;
import com.databasir.dao.tables.DocumentRemark;
import com.databasir.dao.tables.TableColumnDocument;
import com.databasir.dao.tables.TableDocument;
@ -33,7 +33,7 @@ public class Indexes {
public static final Index TABLE_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableDocument.TABLE_DOCUMENT, new OrderField[] { TableDocument.TABLE_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index TABLE_INDEX_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableIndexDocument.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index TABLE_TRIGGER_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableTriggerDocument.TABLE_TRIGGER_DOCUMENT, new OrderField[] { TableTriggerDocument.TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index DATABASE_DOCUMENT_HISTORY_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY, new OrderField[] { DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.PROJECT_ID }, false);
public static final Index DATABASE_DOCUMENT_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DatabaseDocument.DATABASE_DOCUMENT, new OrderField[] { DatabaseDocument.DATABASE_DOCUMENT.PROJECT_ID }, false);
public static final Index DOCUMENT_REMARK_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentRemark.DOCUMENT_REMARK, new OrderField[] { DocumentRemark.DOCUMENT_REMARK.PROJECT_ID }, false);
public static final Index TABLE_COLUMN_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableColumnDocument.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocument.TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID }, false);
public static final Index TABLE_INDEX_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableIndexDocument.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.TABLE_DOCUMENT_ID }, false);

View File

@ -7,7 +7,6 @@ package com.databasir.dao;
import com.databasir.dao.tables.DataSource;
import com.databasir.dao.tables.DataSourceProperty;
import com.databasir.dao.tables.DatabaseDocument;
import com.databasir.dao.tables.DatabaseDocumentHistory;
import com.databasir.dao.tables.DocumentRemark;
import com.databasir.dao.tables.Group;
import com.databasir.dao.tables.Login;
@ -26,7 +25,6 @@ import com.databasir.dao.tables.UserFavoriteProject;
import com.databasir.dao.tables.UserRole;
import com.databasir.dao.tables.records.DataSourcePropertyRecord;
import com.databasir.dao.tables.records.DataSourceRecord;
import com.databasir.dao.tables.records.DatabaseDocumentHistoryRecord;
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
import com.databasir.dao.tables.records.DocumentRemarkRecord;
import com.databasir.dao.tables.records.GroupRecord;
@ -66,9 +64,6 @@ public class Keys {
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_UK_PROJECT_ID = Internal.createUniqueKey(DataSource.DATA_SOURCE, DSL.name("KEY_data_source_uk_project_id"), new TableField[] { DataSource.DATA_SOURCE.PROJECT_ID }, true);
public static final UniqueKey<DataSourcePropertyRecord> KEY_DATA_SOURCE_PROPERTY_PRIMARY = Internal.createUniqueKey(DataSourceProperty.DATA_SOURCE_PROPERTY, DSL.name("KEY_data_source_property_PRIMARY"), new TableField[] { DataSourceProperty.DATA_SOURCE_PROPERTY.ID }, true);
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_PRIMARY = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_PRIMARY"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.ID }, true);
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_UK_PROJECT_ID = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_uk_project_id"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.PROJECT_ID }, true);
public static final UniqueKey<DatabaseDocumentHistoryRecord> KEY_DATABASE_DOCUMENT_HISTORY_PRIMARY = Internal.createUniqueKey(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY, DSL.name("KEY_database_document_history_PRIMARY"), new TableField[] { DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.ID }, true);
public static final UniqueKey<DatabaseDocumentHistoryRecord> KEY_DATABASE_DOCUMENT_HISTORY_UK_CONNECTION_ID_VERSION = Internal.createUniqueKey(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY, DSL.name("KEY_database_document_history_uk_connection_id_version"), new TableField[] { DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID, DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.VERSION }, true);
public static final UniqueKey<DocumentRemarkRecord> KEY_DOCUMENT_REMARK_PRIMARY = Internal.createUniqueKey(DocumentRemark.DOCUMENT_REMARK, DSL.name("KEY_document_remark_PRIMARY"), new TableField[] { DocumentRemark.DOCUMENT_REMARK.ID }, true);
public static final UniqueKey<GroupRecord> KEY_GROUP_PRIMARY = Internal.createUniqueKey(Group.GROUP, DSL.name("KEY_group_PRIMARY"), new TableField[] { Group.GROUP.ID }, true);
public static final UniqueKey<LoginRecord> KEY_LOGIN_PRIMARY = Internal.createUniqueKey(Login.LOGIN, DSL.name("KEY_login_PRIMARY"), new TableField[] { Login.LOGIN.ID }, true);

View File

@ -7,7 +7,6 @@ package com.databasir.dao;
import com.databasir.dao.tables.DataSource;
import com.databasir.dao.tables.DataSourceProperty;
import com.databasir.dao.tables.DatabaseDocument;
import com.databasir.dao.tables.DatabaseDocumentHistory;
import com.databasir.dao.tables.DocumentRemark;
import com.databasir.dao.tables.Group;
import com.databasir.dao.tables.Login;
@ -47,11 +46,6 @@ public class Tables {
*/
public static final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
/**
* The table <code>databasir.database_document_history</code>.
*/
public static final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY;
/**
* The table <code>databasir.document_remark</code>.
*/

View File

@ -5,6 +5,7 @@ package com.databasir.dao.tables;
import com.databasir.dao.Databasir;
import com.databasir.dao.Indexes;
import com.databasir.dao.Keys;
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
@ -15,9 +16,10 @@ import java.util.List;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row8;
import org.jooq.Row9;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
@ -79,6 +81,11 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
*/
public final TableField<DatabaseDocumentRecord, Long> VERSION = createField(DSL.name("version"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.inline("1", SQLDataType.BIGINT)), this, "");
/**
* The column <code>databasir.database_document.is_archive</code>.
*/
public final TableField<DatabaseDocumentRecord, Boolean> IS_ARCHIVE = createField(DSL.name("is_archive"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.inline("0", SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>databasir.database_document.update_at</code>.
*/
@ -129,6 +136,11 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
return aliased() ? null : Databasir.DATABASIR;
}
@Override
public List<Index> getIndexes() {
return Arrays.asList(Indexes.DATABASE_DOCUMENT_IDX_PROJECT_ID);
}
@Override
public Identity<DatabaseDocumentRecord, Integer> getIdentity() {
return (Identity<DatabaseDocumentRecord, Integer>) super.getIdentity();
@ -139,11 +151,6 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
return Keys.KEY_DATABASE_DOCUMENT_PRIMARY;
}
@Override
public List<UniqueKey<DatabaseDocumentRecord>> getUniqueKeys() {
return Arrays.asList(Keys.KEY_DATABASE_DOCUMENT_UK_PROJECT_ID);
}
@Override
public DatabaseDocument as(String alias) {
return new DatabaseDocument(DSL.name(alias), this);
@ -171,11 +178,11 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
}
// -------------------------------------------------------------------------
// Row8 type methods
// Row9 type methods
// -------------------------------------------------------------------------
@Override
public Row8<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row8) super.fieldsRow();
public Row9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row9) super.fieldsRow();
}
}

View File

@ -1,182 +0,0 @@
/*
* This file is generated by jOOQ.
*/
package com.databasir.dao.tables;
import com.databasir.dao.Databasir;
import com.databasir.dao.Indexes;
import com.databasir.dao.Keys;
import com.databasir.dao.tables.records.DatabaseDocumentHistoryRecord;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.JSON;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row6;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DatabaseDocumentHistory extends TableImpl<DatabaseDocumentHistoryRecord> {
private static final long serialVersionUID = 1L;
/**
* The reference instance of
* <code>databasir.database_document_history</code>
*/
public static final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = new DatabaseDocumentHistory();
/**
* The class holding records for this type
*/
@Override
public Class<DatabaseDocumentHistoryRecord> getRecordType() {
return DatabaseDocumentHistoryRecord.class;
}
/**
* The column <code>databasir.database_document_history.id</code>.
*/
public final TableField<DatabaseDocumentHistoryRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");
/**
* The column <code>databasir.database_document_history.project_id</code>.
*/
public final TableField<DatabaseDocumentHistoryRecord, Integer> PROJECT_ID = createField(DSL.name("project_id"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column
* <code>databasir.database_document_history.database_document_id</code>.
*/
public final TableField<DatabaseDocumentHistoryRecord, Integer> DATABASE_DOCUMENT_ID = createField(DSL.name("database_document_id"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column
* <code>databasir.database_document_history.database_document_object</code>.
*/
public final TableField<DatabaseDocumentHistoryRecord, JSON> DATABASE_DOCUMENT_OBJECT = createField(DSL.name("database_document_object"), SQLDataType.JSON, this, "");
/**
* The column <code>databasir.database_document_history.version</code>.
*/
public final TableField<DatabaseDocumentHistoryRecord, Long> VERSION = createField(DSL.name("version"), SQLDataType.BIGINT.nullable(false), this, "");
/**
* The column <code>databasir.database_document_history.create_at</code>.
*/
public final TableField<DatabaseDocumentHistoryRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
private DatabaseDocumentHistory(Name alias, Table<DatabaseDocumentHistoryRecord> aliased) {
this(alias, aliased, null);
}
private DatabaseDocumentHistory(Name alias, Table<DatabaseDocumentHistoryRecord> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
}
/**
* Create an aliased <code>databasir.database_document_history</code> table
* reference
*/
public DatabaseDocumentHistory(String alias) {
this(DSL.name(alias), DATABASE_DOCUMENT_HISTORY);
}
/**
* Create an aliased <code>databasir.database_document_history</code> table
* reference
*/
public DatabaseDocumentHistory(Name alias) {
this(alias, DATABASE_DOCUMENT_HISTORY);
}
/**
* Create a <code>databasir.database_document_history</code> table reference
*/
public DatabaseDocumentHistory() {
this(DSL.name("database_document_history"), null);
}
public <O extends Record> DatabaseDocumentHistory(Table<O> child, ForeignKey<O, DatabaseDocumentHistoryRecord> key) {
super(child, key, DATABASE_DOCUMENT_HISTORY);
}
@Override
public Schema getSchema() {
return aliased() ? null : Databasir.DATABASIR;
}
@Override
public List<Index> getIndexes() {
return Arrays.asList(Indexes.DATABASE_DOCUMENT_HISTORY_IDX_PROJECT_ID);
}
@Override
public Identity<DatabaseDocumentHistoryRecord, Integer> getIdentity() {
return (Identity<DatabaseDocumentHistoryRecord, Integer>) super.getIdentity();
}
@Override
public UniqueKey<DatabaseDocumentHistoryRecord> getPrimaryKey() {
return Keys.KEY_DATABASE_DOCUMENT_HISTORY_PRIMARY;
}
@Override
public List<UniqueKey<DatabaseDocumentHistoryRecord>> getUniqueKeys() {
return Arrays.asList(Keys.KEY_DATABASE_DOCUMENT_HISTORY_UK_CONNECTION_ID_VERSION);
}
@Override
public DatabaseDocumentHistory as(String alias) {
return new DatabaseDocumentHistory(DSL.name(alias), this);
}
@Override
public DatabaseDocumentHistory as(Name alias) {
return new DatabaseDocumentHistory(alias, this);
}
/**
* Rename this table
*/
@Override
public DatabaseDocumentHistory rename(String name) {
return new DatabaseDocumentHistory(DSL.name(name), null);
}
/**
* Rename this table
*/
@Override
public DatabaseDocumentHistory rename(Name name) {
return new DatabaseDocumentHistory(name, null);
}
// -------------------------------------------------------------------------
// Row6 type methods
// -------------------------------------------------------------------------
@Override
public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> fieldsRow() {
return (Row6) super.fieldsRow();
}
}

View File

@ -1,157 +0,0 @@
/*
* This file is generated by jOOQ.
*/
package com.databasir.dao.tables.pojos;
import java.io.Serializable;
import java.time.LocalDateTime;
import org.jooq.JSON;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DatabaseDocumentHistoryPojo implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private Integer projectId;
private Integer databaseDocumentId;
private JSON databaseDocumentObject;
private Long version;
private LocalDateTime createAt;
public DatabaseDocumentHistoryPojo() {}
public DatabaseDocumentHistoryPojo(DatabaseDocumentHistoryPojo value) {
this.id = value.id;
this.projectId = value.projectId;
this.databaseDocumentId = value.databaseDocumentId;
this.databaseDocumentObject = value.databaseDocumentObject;
this.version = value.version;
this.createAt = value.createAt;
}
public DatabaseDocumentHistoryPojo(
Integer id,
Integer projectId,
Integer databaseDocumentId,
JSON databaseDocumentObject,
Long version,
LocalDateTime createAt
) {
this.id = id;
this.projectId = projectId;
this.databaseDocumentId = databaseDocumentId;
this.databaseDocumentObject = databaseDocumentObject;
this.version = version;
this.createAt = createAt;
}
/**
* Getter for <code>databasir.database_document_history.id</code>.
*/
public Integer getId() {
return this.id;
}
/**
* Setter for <code>databasir.database_document_history.id</code>.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Getter for <code>databasir.database_document_history.project_id</code>.
*/
public Integer getProjectId() {
return this.projectId;
}
/**
* Setter for <code>databasir.database_document_history.project_id</code>.
*/
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
/**
* Getter for
* <code>databasir.database_document_history.database_document_id</code>.
*/
public Integer getDatabaseDocumentId() {
return this.databaseDocumentId;
}
/**
* Setter for
* <code>databasir.database_document_history.database_document_id</code>.
*/
public void setDatabaseDocumentId(Integer databaseDocumentId) {
this.databaseDocumentId = databaseDocumentId;
}
/**
* Getter for
* <code>databasir.database_document_history.database_document_object</code>.
*/
public JSON getDatabaseDocumentObject() {
return this.databaseDocumentObject;
}
/**
* Setter for
* <code>databasir.database_document_history.database_document_object</code>.
*/
public void setDatabaseDocumentObject(JSON databaseDocumentObject) {
this.databaseDocumentObject = databaseDocumentObject;
}
/**
* Getter for <code>databasir.database_document_history.version</code>.
*/
public Long getVersion() {
return this.version;
}
/**
* Setter for <code>databasir.database_document_history.version</code>.
*/
public void setVersion(Long version) {
this.version = version;
}
/**
* Getter for <code>databasir.database_document_history.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return this.createAt;
}
/**
* Setter for <code>databasir.database_document_history.create_at</code>.
*/
public void setCreateAt(LocalDateTime createAt) {
this.createAt = createAt;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("DatabaseDocumentHistoryPojo (");
sb.append(id);
sb.append(", ").append(projectId);
sb.append(", ").append(databaseDocumentId);
sb.append(", ").append(databaseDocumentObject);
sb.append(", ").append(version);
sb.append(", ").append(createAt);
sb.append(")");
return sb.toString();
}
}

View File

@ -22,6 +22,7 @@ public class DatabaseDocumentPojo implements Serializable {
private String productName;
private String productVersion;
private Long version;
private Boolean isArchive;
private LocalDateTime updateAt;
private LocalDateTime createAt;
@ -34,6 +35,7 @@ public class DatabaseDocumentPojo implements Serializable {
this.productName = value.productName;
this.productVersion = value.productVersion;
this.version = value.version;
this.isArchive = value.isArchive;
this.updateAt = value.updateAt;
this.createAt = value.createAt;
}
@ -45,6 +47,7 @@ public class DatabaseDocumentPojo implements Serializable {
String productName,
String productVersion,
Long version,
Boolean isArchive,
LocalDateTime updateAt,
LocalDateTime createAt
) {
@ -54,6 +57,7 @@ public class DatabaseDocumentPojo implements Serializable {
this.productName = productName;
this.productVersion = productVersion;
this.version = version;
this.isArchive = isArchive;
this.updateAt = updateAt;
this.createAt = createAt;
}
@ -142,6 +146,20 @@ public class DatabaseDocumentPojo implements Serializable {
this.version = version;
}
/**
* Getter for <code>databasir.database_document.is_archive</code>.
*/
public Boolean getIsArchive() {
return this.isArchive;
}
/**
* Setter for <code>databasir.database_document.is_archive</code>.
*/
public void setIsArchive(Boolean isArchive) {
this.isArchive = isArchive;
}
/**
* Getter for <code>databasir.database_document.update_at</code>.
*/
@ -180,6 +198,7 @@ public class DatabaseDocumentPojo implements Serializable {
sb.append(", ").append(productName);
sb.append(", ").append(productVersion);
sb.append(", ").append(version);
sb.append(", ").append(isArchive);
sb.append(", ").append(updateAt);
sb.append(", ").append(createAt);

View File

@ -1,316 +0,0 @@
/*
* This file is generated by jOOQ.
*/
package com.databasir.dao.tables.records;
import com.databasir.dao.tables.DatabaseDocumentHistory;
import com.databasir.dao.tables.pojos.DatabaseDocumentHistoryPojo;
import java.time.LocalDateTime;
import org.jooq.Field;
import org.jooq.JSON;
import org.jooq.Record1;
import org.jooq.Record6;
import org.jooq.Row6;
import org.jooq.impl.UpdatableRecordImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DatabaseDocumentHistoryRecord extends UpdatableRecordImpl<DatabaseDocumentHistoryRecord> implements Record6<Integer, Integer, Integer, JSON, Long, LocalDateTime> {
private static final long serialVersionUID = 1L;
/**
* Setter for <code>databasir.database_document_history.id</code>.
*/
public void setId(Integer value) {
set(0, value);
}
/**
* Getter for <code>databasir.database_document_history.id</code>.
*/
public Integer getId() {
return (Integer) get(0);
}
/**
* Setter for <code>databasir.database_document_history.project_id</code>.
*/
public void setProjectId(Integer value) {
set(1, value);
}
/**
* Getter for <code>databasir.database_document_history.project_id</code>.
*/
public Integer getProjectId() {
return (Integer) get(1);
}
/**
* Setter for
* <code>databasir.database_document_history.database_document_id</code>.
*/
public void setDatabaseDocumentId(Integer value) {
set(2, value);
}
/**
* Getter for
* <code>databasir.database_document_history.database_document_id</code>.
*/
public Integer getDatabaseDocumentId() {
return (Integer) get(2);
}
/**
* Setter for
* <code>databasir.database_document_history.database_document_object</code>.
*/
public void setDatabaseDocumentObject(JSON value) {
set(3, value);
}
/**
* Getter for
* <code>databasir.database_document_history.database_document_object</code>.
*/
public JSON getDatabaseDocumentObject() {
return (JSON) get(3);
}
/**
* Setter for <code>databasir.database_document_history.version</code>.
*/
public void setVersion(Long value) {
set(4, value);
}
/**
* Getter for <code>databasir.database_document_history.version</code>.
*/
public Long getVersion() {
return (Long) get(4);
}
/**
* Setter for <code>databasir.database_document_history.create_at</code>.
*/
public void setCreateAt(LocalDateTime value) {
set(5, value);
}
/**
* Getter for <code>databasir.database_document_history.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return (LocalDateTime) get(5);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@Override
public Record1<Integer> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Record6 type implementation
// -------------------------------------------------------------------------
@Override
public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> fieldsRow() {
return (Row6) super.fieldsRow();
}
@Override
public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> valuesRow() {
return (Row6) super.valuesRow();
}
@Override
public Field<Integer> field1() {
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.ID;
}
@Override
public Field<Integer> field2() {
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.PROJECT_ID;
}
@Override
public Field<Integer> field3() {
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID;
}
@Override
public Field<JSON> field4() {
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_OBJECT;
}
@Override
public Field<Long> field5() {
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.VERSION;
}
@Override
public Field<LocalDateTime> field6() {
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.CREATE_AT;
}
@Override
public Integer component1() {
return getId();
}
@Override
public Integer component2() {
return getProjectId();
}
@Override
public Integer component3() {
return getDatabaseDocumentId();
}
@Override
public JSON component4() {
return getDatabaseDocumentObject();
}
@Override
public Long component5() {
return getVersion();
}
@Override
public LocalDateTime component6() {
return getCreateAt();
}
@Override
public Integer value1() {
return getId();
}
@Override
public Integer value2() {
return getProjectId();
}
@Override
public Integer value3() {
return getDatabaseDocumentId();
}
@Override
public JSON value4() {
return getDatabaseDocumentObject();
}
@Override
public Long value5() {
return getVersion();
}
@Override
public LocalDateTime value6() {
return getCreateAt();
}
@Override
public DatabaseDocumentHistoryRecord value1(Integer value) {
setId(value);
return this;
}
@Override
public DatabaseDocumentHistoryRecord value2(Integer value) {
setProjectId(value);
return this;
}
@Override
public DatabaseDocumentHistoryRecord value3(Integer value) {
setDatabaseDocumentId(value);
return this;
}
@Override
public DatabaseDocumentHistoryRecord value4(JSON value) {
setDatabaseDocumentObject(value);
return this;
}
@Override
public DatabaseDocumentHistoryRecord value5(Long value) {
setVersion(value);
return this;
}
@Override
public DatabaseDocumentHistoryRecord value6(LocalDateTime value) {
setCreateAt(value);
return this;
}
@Override
public DatabaseDocumentHistoryRecord values(Integer value1, Integer value2, Integer value3, JSON value4, Long value5, LocalDateTime value6) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
value5(value5);
value6(value6);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached DatabaseDocumentHistoryRecord
*/
public DatabaseDocumentHistoryRecord() {
super(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY);
}
/**
* Create a detached, initialised DatabaseDocumentHistoryRecord
*/
public DatabaseDocumentHistoryRecord(Integer id, Integer projectId, Integer databaseDocumentId, JSON databaseDocumentObject, Long version, LocalDateTime createAt) {
super(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY);
setId(id);
setProjectId(projectId);
setDatabaseDocumentId(databaseDocumentId);
setDatabaseDocumentObject(databaseDocumentObject);
setVersion(version);
setCreateAt(createAt);
}
/**
* Create a detached, initialised DatabaseDocumentHistoryRecord
*/
public DatabaseDocumentHistoryRecord(DatabaseDocumentHistoryPojo value) {
super(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY);
if (value != null) {
setId(value.getId());
setProjectId(value.getProjectId());
setDatabaseDocumentId(value.getDatabaseDocumentId());
setDatabaseDocumentObject(value.getDatabaseDocumentObject());
setVersion(value.getVersion());
setCreateAt(value.getCreateAt());
}
}
}

View File

@ -11,8 +11,8 @@ import java.time.LocalDateTime;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record8;
import org.jooq.Row8;
import org.jooq.Record9;
import org.jooq.Row9;
import org.jooq.impl.UpdatableRecordImpl;
@ -20,7 +20,7 @@ import org.jooq.impl.UpdatableRecordImpl;
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocumentRecord> implements Record8<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime> {
public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocumentRecord> implements Record9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> {
private static final long serialVersionUID = 1L;
@ -108,32 +108,46 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
return (Long) get(5);
}
/**
* Setter for <code>databasir.database_document.is_archive</code>.
*/
public void setIsArchive(Boolean value) {
set(6, value);
}
/**
* Getter for <code>databasir.database_document.is_archive</code>.
*/
public Boolean getIsArchive() {
return (Boolean) get(6);
}
/**
* Setter for <code>databasir.database_document.update_at</code>.
*/
public void setUpdateAt(LocalDateTime value) {
set(6, value);
set(7, value);
}
/**
* Getter for <code>databasir.database_document.update_at</code>.
*/
public LocalDateTime getUpdateAt() {
return (LocalDateTime) get(6);
return (LocalDateTime) get(7);
}
/**
* Setter for <code>databasir.database_document.create_at</code>.
*/
public void setCreateAt(LocalDateTime value) {
set(7, value);
set(8, value);
}
/**
* Getter for <code>databasir.database_document.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return (LocalDateTime) get(7);
return (LocalDateTime) get(8);
}
// -------------------------------------------------------------------------
@ -146,17 +160,17 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
}
// -------------------------------------------------------------------------
// Record8 type implementation
// Record9 type implementation
// -------------------------------------------------------------------------
@Override
public Row8<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row8) super.fieldsRow();
public Row9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row9) super.fieldsRow();
}
@Override
public Row8<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime> valuesRow() {
return (Row8) super.valuesRow();
public Row9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> valuesRow() {
return (Row9) super.valuesRow();
}
@Override
@ -190,12 +204,17 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
}
@Override
public Field<LocalDateTime> field7() {
return DatabaseDocument.DATABASE_DOCUMENT.UPDATE_AT;
public Field<Boolean> field7() {
return DatabaseDocument.DATABASE_DOCUMENT.IS_ARCHIVE;
}
@Override
public Field<LocalDateTime> field8() {
return DatabaseDocument.DATABASE_DOCUMENT.UPDATE_AT;
}
@Override
public Field<LocalDateTime> field9() {
return DatabaseDocument.DATABASE_DOCUMENT.CREATE_AT;
}
@ -230,12 +249,17 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
}
@Override
public LocalDateTime component7() {
return getUpdateAt();
public Boolean component7() {
return getIsArchive();
}
@Override
public LocalDateTime component8() {
return getUpdateAt();
}
@Override
public LocalDateTime component9() {
return getCreateAt();
}
@ -270,12 +294,17 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
}
@Override
public LocalDateTime value7() {
return getUpdateAt();
public Boolean value7() {
return getIsArchive();
}
@Override
public LocalDateTime value8() {
return getUpdateAt();
}
@Override
public LocalDateTime value9() {
return getCreateAt();
}
@ -316,19 +345,25 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
}
@Override
public DatabaseDocumentRecord value7(LocalDateTime value) {
setUpdateAt(value);
public DatabaseDocumentRecord value7(Boolean value) {
setIsArchive(value);
return this;
}
@Override
public DatabaseDocumentRecord value8(LocalDateTime value) {
setUpdateAt(value);
return this;
}
@Override
public DatabaseDocumentRecord value9(LocalDateTime value) {
setCreateAt(value);
return this;
}
@Override
public DatabaseDocumentRecord values(Integer value1, Integer value2, String value3, String value4, String value5, Long value6, LocalDateTime value7, LocalDateTime value8) {
public DatabaseDocumentRecord values(Integer value1, Integer value2, String value3, String value4, String value5, Long value6, Boolean value7, LocalDateTime value8, LocalDateTime value9) {
value1(value1);
value2(value2);
value3(value3);
@ -337,6 +372,7 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
value6(value6);
value7(value7);
value8(value8);
value9(value9);
return this;
}
@ -354,7 +390,7 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
/**
* Create a detached, initialised DatabaseDocumentRecord
*/
public DatabaseDocumentRecord(Integer id, Integer projectId, String databaseName, String productName, String productVersion, Long version, LocalDateTime updateAt, LocalDateTime createAt) {
public DatabaseDocumentRecord(Integer id, Integer projectId, String databaseName, String productName, String productVersion, Long version, Boolean isArchive, LocalDateTime updateAt, LocalDateTime createAt) {
super(DatabaseDocument.DATABASE_DOCUMENT);
setId(id);
@ -363,6 +399,7 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
setProductName(productName);
setProductVersion(productVersion);
setVersion(version);
setIsArchive(isArchive);
setUpdateAt(updateAt);
setCreateAt(createAt);
}
@ -380,6 +417,7 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
setProductName(value.getProductName());
setProductVersion(value.getProductVersion());
setVersion(value.getVersion());
setIsArchive(value.getIsArchive());
setUpdateAt(value.getUpdateAt());
setCreateAt(value.getCreateAt());
}

View File

@ -2,11 +2,17 @@ package com.databasir.dao.impl;
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
import com.databasir.dao.value.DatabaseDocumentVersionPojo;
import lombok.Getter;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import static com.databasir.dao.Tables.DATABASE_DOCUMENT;
@ -29,10 +35,54 @@ public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
.fetchOptionalInto(DatabaseDocumentPojo.class);
}
public Optional<DatabaseDocumentPojo> selectOptionalByProjectIdAndVersion(Integer projectId,
Long version) {
return getDslContext()
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT)
.where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId).and(DATABASE_DOCUMENT.VERSION.eq(version)))
.fetchOptionalInto(DatabaseDocumentPojo.class);
}
public void update(DatabaseDocumentPojo toPojo) {
DatabaseDocumentRecord record = getDslContext().newRecord(DATABASE_DOCUMENT, toPojo);
record.changed(DATABASE_DOCUMENT.ID, false);
record.changed(DATABASE_DOCUMENT.CREATE_AT, false);
record.update();
}
public Optional<DatabaseDocumentPojo> selectNotArchivedByProjectId(Integer projectId) {
return getDslContext()
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT)
.where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId).and(DATABASE_DOCUMENT.IS_ARCHIVE.eq(false)))
.fetchOptionalInto(DatabaseDocumentPojo.class);
}
public void updateIsArchiveById(Integer id, Boolean isArchive) {
this.getDslContext()
.update(DATABASE_DOCUMENT).set(DATABASE_DOCUMENT.IS_ARCHIVE, isArchive)
.where(DATABASE_DOCUMENT.ID.eq(id).and(DATABASE_DOCUMENT.IS_ARCHIVE.eq(!isArchive)))
.execute();
}
public Page<DatabaseDocumentVersionPojo> selectVersionPageByProjectId(Pageable request,
Integer projectId) {
Condition condition = DATABASE_DOCUMENT.PROJECT_ID.eq(projectId);
Integer count = getDslContext()
.selectCount().from(DATABASE_DOCUMENT).where(condition)
.fetchOne(0, int.class);
int total = count == null ? 0 : count;
List<DatabaseDocumentVersionPojo> data = getDslContext()
.select(
DATABASE_DOCUMENT.VERSION,
DATABASE_DOCUMENT.ID,
DATABASE_DOCUMENT.CREATE_AT
)
.from(DATABASE_DOCUMENT)
.where(condition)
.orderBy(getSortFields(request.getSort()))
.offset(request.getOffset())
.limit(request.getPageSize())
.fetchInto(DatabaseDocumentVersionPojo.class);
return new PageImpl<>(data, request, total);
}
}

View File

@ -1,59 +0,0 @@
package com.databasir.dao.impl;
import com.databasir.dao.tables.pojos.DatabaseDocumentHistoryPojo;
import com.databasir.dao.value.DatabaseDocumentVersionPojo;
import lombok.Getter;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import static com.databasir.dao.Tables.DATABASE_DOCUMENT_HISTORY;
@Repository
public class DatabaseDocumentHistoryDao extends BaseDao<DatabaseDocumentHistoryPojo> {
@Autowired
@Getter
private DSLContext dslContext;
public DatabaseDocumentHistoryDao() {
super(DATABASE_DOCUMENT_HISTORY, DatabaseDocumentHistoryPojo.class);
}
public Optional<DatabaseDocumentHistoryPojo> selectOptionalByProjectIdAndVersion(Integer projectId, Long version) {
return dslContext
.selectFrom(DATABASE_DOCUMENT_HISTORY)
.where(DATABASE_DOCUMENT_HISTORY.PROJECT_ID.eq(projectId)
.and(DATABASE_DOCUMENT_HISTORY.VERSION.eq(version)))
.fetchOptionalInto(DatabaseDocumentHistoryPojo.class);
}
public Page<DatabaseDocumentVersionPojo> selectVersionPageByDatabaseDocumentId(Pageable request,
Integer schemaDocumentId) {
Condition condition = DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID.eq(schemaDocumentId);
Integer count = getDslContext()
.selectCount().from(DATABASE_DOCUMENT_HISTORY).where(condition)
.fetchOne(0, int.class);
int total = count == null ? 0 : count;
List<DatabaseDocumentVersionPojo> data = getDslContext()
.select(
DATABASE_DOCUMENT_HISTORY.VERSION,
DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID,
DATABASE_DOCUMENT_HISTORY.CREATE_AT
)
.from(DATABASE_DOCUMENT_HISTORY)
.where(condition)
.orderBy(getSortFields(request.getSort()))
.offset(request.getOffset())
.limit(request.getPageSize())
.fetchInto(DatabaseDocumentVersionPojo.class);
return new PageImpl<>(data, request, total);
}
}

View File

@ -6,6 +6,7 @@ import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Collections;
import java.util.List;
import static com.databasir.dao.Tables.TABLE_COLUMN_DOCUMENT;
@ -28,10 +29,15 @@ public class TableColumnDocumentDao extends BaseDao<TableColumnDocumentPojo> {
.fetchInto(TableColumnDocumentPojo.class);
}
public void deleteByDatabaseDocumentId(Integer schemaDocumentId) {
getDslContext()
.deleteFrom(TABLE_COLUMN_DOCUMENT)
.where(TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
.execute();
public List<TableColumnDocumentPojo> selectByDatabaseDocumentIdAndTableIdIn(Integer schemaDocumentId,
List<Integer> tableIdIn) {
if (tableIdIn == null || tableIdIn.isEmpty()) {
return Collections.emptyList();
}
return getDslContext()
.select(TABLE_COLUMN_DOCUMENT.fields()).from(TABLE_COLUMN_DOCUMENT)
.where(TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId)
.and(TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
.fetchInto(TableColumnDocumentPojo.class);
}
}

View File

@ -6,6 +6,7 @@ import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Collections;
import java.util.List;
import static com.databasir.dao.Tables.TABLE_DOCUMENT;
@ -33,4 +34,16 @@ public class TableDocumentDao extends BaseDao<TableDocumentPojo> {
.deleteFrom(TABLE_DOCUMENT).where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
.execute();
}
public List<TableDocumentPojo> selectByDatabaseDocumentIdAndIdIn(Integer databaseDocumentId,
List<Integer> idList) {
if (idList == null || idList.isEmpty()) {
return Collections.emptyList();
}
return getDslContext()
.selectFrom(TABLE_DOCUMENT)
.where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(databaseDocumentId)
.and(TABLE_DOCUMENT.ID.in(idList)))
.fetchInto(TableDocumentPojo.class);
}
}

View File

@ -6,6 +6,7 @@ import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Collections;
import java.util.List;
import static com.databasir.dao.Tables.TABLE_INDEX_DOCUMENT;
@ -21,16 +22,22 @@ public class TableIndexDocumentDao extends BaseDao<TableIndexDocumentPojo> {
super(TABLE_INDEX_DOCUMENT, TableIndexDocumentPojo.class);
}
public List<TableIndexDocumentPojo> selectByDatabaseMetaId(Integer schemaMetaId) {
public List<TableIndexDocumentPojo> selectByDatabaseMetaId(Integer documentId) {
return getDslContext()
.select(TABLE_INDEX_DOCUMENT.fields()).from(TABLE_INDEX_DOCUMENT)
.where(TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaMetaId))
.where(TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID.eq(documentId))
.fetchInto(TableIndexDocumentPojo.class);
}
public void deleteByDatabaseMetaId(Integer schemaMetaId) {
getDslContext()
.deleteFrom(TABLE_INDEX_DOCUMENT).where(TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaMetaId))
.execute();
public List<TableIndexDocumentPojo> selectByDatabaseDocumentIdAndIdIn(Integer documentId,
List<Integer> tableIdIn) {
if (tableIdIn == null || tableIdIn.isEmpty()) {
return Collections.emptyList();
}
return getDslContext()
.select(TABLE_INDEX_DOCUMENT.fields()).from(TABLE_INDEX_DOCUMENT)
.where(TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID.eq(documentId)
.and(TABLE_INDEX_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
.fetchInto(TableIndexDocumentPojo.class);
}
}

View File

@ -6,6 +6,7 @@ import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Collections;
import java.util.List;
import static com.databasir.dao.Tables.TABLE_TRIGGER_DOCUMENT;
@ -28,10 +29,15 @@ public class TableTriggerDocumentDao extends BaseDao<TableTriggerDocumentPojo> {
.fetchInto(TableTriggerDocumentPojo.class);
}
public void deleteByDatabaseDocumentId(Integer schemaDocumentId) {
getDslContext()
.deleteFrom(TABLE_TRIGGER_DOCUMENT)
.where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
.execute();
public List<TableTriggerDocumentPojo> selectByDatabaseDocumentIdAndIdIn(Integer documentId,
List<Integer> tableIdIn) {
if (tableIdIn == null || tableIdIn.isEmpty()) {
return Collections.emptyList();
}
return getDslContext()
.select(TABLE_TRIGGER_DOCUMENT.fields()).from(TABLE_TRIGGER_DOCUMENT)
.where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(documentId)
.and(TABLE_TRIGGER_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
.fetchInto(TableTriggerDocumentPojo.class);
}
}

View File

@ -7,7 +7,7 @@ import java.time.LocalDateTime;
@Data
public class DatabaseDocumentVersionPojo {
private Integer databaseDocumentId;
private Integer id;
private Long version;

View File

@ -123,21 +123,9 @@ CREATE TABLE IF NOT EXISTS database_document
product_name TEXT NOT NULL,
product_version TEXT NOT NULL,
version BIGINT NOT NULL DEFAULT 1,
is_archive BOOLEAN NOT NULL DEFAULT FALSE,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT uk_project_id UNIQUE (project_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS database_document_history
(
id INT PRIMARY KEY AUTO_INCREMENT,
project_id INT NOT NULL,
database_document_id INT NOT NULL,
database_document_object JSON DEFAULT NULL,
version BIGINT NOT NULL,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT uk_connection_id_version UNIQUE (database_document_id, version),
INDEX idx_project_id (project_id)
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;