Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
鲁鑫
topsun-bpm
Commits
3099a277
Commit
3099a277
authored
Nov 14, 2023
by
鲁鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资源库树结构和资源类型增删改查
parent
5846e3ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1023 additions
and
271 deletions
+1023
-271
jquery.commonTree.js
huigou-xt/src/main/webapp/lib/jquery/jquery.commonTree.js
+371
-200
spring-mybatis-plus.xml
.../src/main/resources/config/spring/spring-mybatis-plus.xml
+1
-1
spring-resource-basenames.xml
...ain/resources/config/spring/spring-resource-basenames.xml
+1
-9
HomePage.jsp
topsun-xt/src/main/webapp/HomePage.jsp
+2
-2
fieldTreeDetail.js
...xt/src/main/webapp/biz/topsun/resource/fieldTreeDetail.js
+113
-0
fieldTreeDetail.jsp
...t/src/main/webapp/biz/topsun/resource/fieldTreeDetail.jsp
+27
-0
fieldValueDetail.js
...t/src/main/webapp/biz/topsun/resource/fieldValueDetail.js
+38
-0
fieldValueDetail.jsp
.../src/main/webapp/biz/topsun/resource/fieldValueDetail.jsp
+15
-0
resourceList.js
...un-xt/src/main/webapp/biz/topsun/resource/resourceList.js
+208
-0
resourceList.jsp
...n-xt/src/main/webapp/biz/topsun/resource/resourceList.jsp
+26
-3
ResourceController.java
...huigou/topsun/resource/controller/ResourceController.java
+67
-13
ResourceFieldController.java
...u/topsun/resource/controller/ResourceFieldController.java
+24
-4
ResourceFiled.java
...java/com/huigou/topsun/resource/domain/ResourceFiled.java
+0
-5
ResourceTypeMapper.java
...com/huigou/topsun/resource/mapper/ResourceTypeMapper.java
+6
-0
ResourceTypeService.java
...m/huigou/topsun/resource/service/ResourceTypeService.java
+6
-2
ResourceFiledServiceImpl.java
...opsun/resource/service/impl/ResourceFiledServiceImpl.java
+22
-7
ResourceTypeServiceImpl.java
...topsun/resource/service/impl/ResourceTypeServiceImpl.java
+22
-15
ResourceFiledVo.java
...n/java/com/huigou/topsun/resource/vo/ResourceFiledVo.java
+9
-7
ResourceTypeTreeVo.java
...ava/com/huigou/topsun/resource/vo/ResourceTypeTreeVo.java
+35
-0
A
topsun/src/main/resources/config/topsun/mapper/A
+0
-0
ResourceFiledMapper.xml
...ces/config/topsun/mapper/resource/ResourceFiledMapper.xml
+9
-3
ResourceTypeMapper.xml
...rces/config/topsun/mapper/resource/ResourceTypeMapper.xml
+21
-0
No files found.
huigou-xt/src/main/webapp/lib/jquery/jquery.commonTree.js
View file @
3099a277
This diff is collapsed.
Click to expand it.
topsun-xt/src/main/resources/config/spring/spring-mybatis-plus.xml
View file @
3099a277
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<bean
id=
"sqlSessionFactory"
class=
"com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean"
>
<bean
id=
"sqlSessionFactory"
class=
"com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
<property
name=
"dataSource"
ref=
"dataSource"
/>
<!-- <property name="configuration" ref="configuration"/>-->
<!-- <property name="configuration" ref="configuration"/>-->
<property
name=
"mapperLocations"
value=
"classpath:
com/huigou/topsun/**/mapper/xml
/*.xml"
/>
<property
name=
"mapperLocations"
value=
"classpath:
/config/topsun/mapper/**
/*.xml"
/>
<property
name=
"globalConfig"
ref=
"globalConfig"
/>
<property
name=
"globalConfig"
ref=
"globalConfig"
/>
<property
name=
"plugins"
>
<property
name=
"plugins"
>
<array>
<array>
...
...
topsun-xt/src/main/resources/config/spring/spring-resource-basenames.xml
View file @
3099a277
...
@@ -16,15 +16,7 @@
...
@@ -16,15 +16,7 @@
<bean
id=
"messageSourceBasenames"
class=
"com.huigou.context.MessageSourceBasenames"
>
<bean
id=
"messageSourceBasenames"
class=
"com.huigou.context.MessageSourceBasenames"
>
<property
name=
"basenames"
>
<property
name=
"basenames"
>
<list>
<list>
<value>
i18n/techBase
</value>
<value>
i18n/topsun
</value>
<!--<value>i18n/tech_reimbursement</value>
<value>i18n/tech_project</value>
<value>i18n/tech_mm</value>
<value>i18n/tech_pm</value>-->
<value>
i18n/tech_bm
</value>
<value>
i18n/ssrf_hx
</value>
<value>
i18n/ssrf_budget
</value>
<value>
i18n/ssrf_contract
</value>
</list>
</list>
</property>
</property>
</bean>
</bean>
...
...
topsun-xt/src/main/webapp/HomePage.jsp
View file @
3099a277
...
@@ -4,13 +4,13 @@
...
@@ -4,13 +4,13 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<x:base
include=
"dialog,dateTime,tree,combox
,echart
"
/>
<x:base
include=
"dialog,dateTime,tree,combox"
/>
<x:script
src=
'/system/taskCenter/TasksExecute.js'
/>
<x:script
src=
'/system/taskCenter/TasksExecute.js'
/>
<x:script
src=
'/system/bpm/BpmUtil.js'
/>
<x:script
src=
'/system/bpm/BpmUtil.js'
/>
<x:script
src=
'/javaScript/remind.js'
/>
<x:script
src=
'/javaScript/remind.js'
/>
<x:script
src=
'/javaScript/addFunction.js'
/>
<x:script
src=
'/javaScript/addFunction.js'
/>
<x:script
src=
'/javaScript/HomePage.js'
/>
<x:script
src=
'/javaScript/HomePage.js'
/>
<
x:script
src=
'/javaScript/HomePageEcharts.js'
/
>
<
%--<x:script src='/javaScript/HomePageEcharts.js'/>--%
>
</head>
</head>
<body>
<body>
<div
class=
"container-gray-bg"
>
<div
class=
"container-gray-bg"
>
...
...
topsun-xt/src/main/webapp/biz/topsun/resource/fieldTreeDetail.js
0 → 100644
View file @
3099a277
$
(
document
).
ready
(
function
()
{
initResourceFieldGrid
();
});
//初始化研制人员
function
initResourceFieldGrid
(){
var
toolbarOptions
=
UICtrl
.
getDefaultToolbarOptions
({
addHandler
:
function
(){
UICtrl
.
addGridRow
(
resourceFieldGrid
);
},
deleteHandler
:
function
()
{
var
_grid
=
UICtrl
.
getGridManager
(
'#resourceFieldGrid'
);
DataUtil
.
delSelectedRows
({
action
:
'purchase/deleteProviderBids.ajax'
,
param
:
{},
gridManager
:
_grid
,
onSuccess
:
function
()
{
reloadGrid
();
}
});
}
});
resourceFieldGrid
=
UICtrl
.
grid
(
'#resourceFieldGrid'
,
{
columns
:
getGridColumns
(),
dataAction
:
'server'
,
url
:
web_app
.
name
+
'/resource/findResourceTypeFields.ajax'
,
parms
:
{
tableName
:
$
(
"#tableName"
).
val
()
||
$
(
"#parentTableName"
).
val
()},
width
:
'99.8%'
,
height
:
'400'
,
checkbox
:
true
,
heightDiff
:
-
5
,
sortName
:
'contact'
,
enabledEdit
:
true
,
sortOrder
:
'asc'
,
toolbar
:
toolbarOptions
,
/*onLoadData: function () {
const contractId = getEntityId();
if (!contractId) {
return false;
}
if (gridEntityContactManager) {
gridEntityContactManager.setParm('contractId', contractId);
}
}*/
});
}
function
getGridColumns
(){
var
columns
=
[];
columns
.
push
({
display
:
"字段名称"
,
name
:
"resourceFiledTitle"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'text'
,
required
:
true
}
});
columns
.
push
({
display
:
"字段类型"
,
name
:
"resourceFieldTypeTextView"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'combobox'
,
data
:
$
(
"#resourceFieldType"
).
combox
(
'getJSONData'
),
required
:
true
,
valueField
:
'resourceFieldType'
}
});
columns
.
push
({
display
:
"是否可见"
,
name
:
"resourceFieldShowTextView"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'combobox'
,
data
:
$
(
"#yesorno"
).
combox
(
'getJSONData'
),
required
:
false
,
valueField
:
'resourceFieldShow'
}
});
columns
.
push
({
display
:
"字段大小"
,
name
:
"resourceFieldSize"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'text'
,
required
:
false
}
});
columns
.
push
({
display
:
"整型长度"
,
name
:
"integerLength"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'text'
,
required
:
false
}
});
columns
.
push
({
display
:
"小数点位数"
,
name
:
"decimalPrecision"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'text'
,
required
:
false
}
});
columns
.
push
({
display
:
"序号"
,
name
:
"sortNum"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'text'
,
required
:
false
}
});
columns
.
push
({
display
:
"数据字典"
,
name
:
"dictCode"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"center"
,
editor
:
{
type
:
'text'
,
required
:
false
}
});
return
columns
;
}
function
reloadGrid
()
{
var
param
=
{
tableName
:
$
(
"#tableName"
).
val
()};
$
(
'#resourceFieldGrid'
).
ligerGetGridManager
().
options
.
url
=
web_app
.
name
+
'/resource/findParentResourceTypeAndFields.ajax'
;
_grid
=
UICtrl
.
getGridManager
(
'#resourceFieldGrid'
);
UICtrl
.
gridSearch
(
_grid
,
param
);
}
// $('#ok').click(function () {
// $('#submitForm').ajaxSubmit({
// url: web_app.name + '/resource/saveResourceType.ajax',
// param: {
// resourceFields: $.toJSON(resourceFieldGrid.getData()),
// },
// success: function (data) {
// //reloadData();
// },
// });
// })
topsun-xt/src/main/webapp/biz/topsun/resource/fieldTreeDetail.jsp
0 → 100644
View file @
3099a277
<%@ page
language=
"java"
contentType=
"text/html; charset=utf-8"
%>
<%@taglib
uri=
"/WEB-INF/taglib.tld"
prefix=
"x"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<head>
<x:script
src=
'/biz/topsun/resource/fieldTreeDetail.js'
/>
</head>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<x:hidden
name=
"tableName"
/>
<x:hidden
name=
"resourceTypeId"
/>
<div
class=
"hg-form-cols"
>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"resourceTableTitle"
required=
"true"
label=
"资源名称"
labelCol=
"2"
fieldCol=
"4"
/>
<x:inputC
name=
"resourceTableName"
required=
"false"
readonly=
"true"
label=
"资源表"
labelCol=
"2"
fieldCol=
"4"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"parentTableTitle"
required=
"false"
readonly=
"true"
label=
"父类名称"
labelCol=
"2"
fieldCol=
"4"
/>
<x:inputC
name=
"parentTableName"
required=
"false"
readonly=
"true"
label=
"父类表"
labelCol=
"2"
fieldCol=
"4"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"superTableTitle"
required=
"false"
readonly=
"true"
label=
"超类名称"
labelCol=
"2"
fieldCol=
"4"
/>
<x:inputC
name=
"superTableName"
required=
"false"
readonly=
"true"
label=
"超类表"
labelCol=
"2"
fieldCol=
"4"
/>
</div>
</div>
<div
class=
"hg-form-row"
>
<div
id=
"resourceFieldGrid"
></div>
</div>
</form>
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/resource/fieldValueDetail.js
0 → 100644
View file @
3099a277
$
(
document
).
ready
(
function
()
{
initResourceFields
();
});
function
initResourceFields
()
{
Public
.
ajax
(
web_app
.
name
+
"/resourceField/getResourceField.ajax"
,
{
resourceTypeId
:
$
(
"#resourceTypeId"
).
val
()
},
function
(
data
)
{
debugger
;
var
$d
=
$
(
'#rowDiv'
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
field
=
data
[
i
];
//var s = $(`<input name="${field.resourceFieldName}" label="${field.resourceFiledTitle}" labelCol="2" fieldCol="4"/>`);
//var input = $("<x:inputC name='").append(field.resourceFieldName).append("' label='").append(field.resourceFiledTitle).append("'").append("/>");
/*var ss = $(`<div class="col-xs-4 col-sm-2">
<label class="hg-form-label" id="${field.resourceFiledTitle}_label" title="${field.resourceFiledTitle}">
${field.resourceFiledTitle} :
</label>
</div>
<div class="col-xs-8 col-sm-4 col-warp col-white-bg">
<input type="text" name="${field.resourceFieldName}" id="${field.resourceFieldName}" label="${field.resourceFiledTitle}">
</div>`)*/
var
ss
=
$
(
`<div class="col-xs-4 col-sm-2">
<label class="hg-form-label" id="resourceFiledTitle_label" title="哈哈哈哈哈哈">
哈哈哈哈 :
</label>
</div>
`
)
var
s2
=
$
(
`<div class="col-xs-8 col-sm-4 col-warp col-white-bg">
<input type="text" name="name" id="name" label="hhhhhhh">
</div>`
);
$d
.
append
(
ss
,
s2
);
//input1.attr('value', data[i]);
}
}
)
}
topsun-xt/src/main/webapp/biz/topsun/resource/fieldValueDetail.jsp
0 → 100644
View file @
3099a277
<%@ page
language=
"java"
contentType=
"text/html; charset=utf-8"
%>
<%@taglib
uri=
"/WEB-INF/taglib.tld"
prefix=
"x"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<head>
<x:script
src=
'/biz/topsun/resource/fieldValueDetail.js'
/>
</head>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<x:hidden
name=
"tableName"
/>
<x:hidden
name=
"resourceTypeId"
/>
<div
class=
"hg-form-cols"
>
<div
class=
"hg-form-row"
id=
"rowDiv>
<x:inputC
name=
"resourceTableTitle"
required=
"true"
label=
"资源名称"
labelCol=
"2"
fieldCol=
"4"
/>
</div>
</div>
</form>
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/resource/resourceList.js
0 → 100644
View file @
3099a277
var
gridManager
=
null
,
refreshFlag
=
false
,
OrgRootId
=
0
,
columnData
=
null
;
$
(
document
).
ready
(
function
()
{
initializeUI
();
initializeGrid
();
});
function
initializeUI
(){
UICtrl
.
layout
(
"#layoutDiv"
,{
leftWidth
:
2
});
$
(
'#maintree'
).
commonTree
({
loadTreesAction
:
'resource/findResourceTypes.ajax'
,
parentId
:
OrgRootId
,
getParam
:
function
(
e
){
return
{
showDisabledOrg
:
0
,
displayableOrgKinds
:
"ogn"
};
},
changeNodeIcon
:
function
(
data
){
data
[
this
.
options
.
iconFieldName
]
=
OpmUtil
.
getOrgImgUrl
(
data
.
orgKindId
,
data
.
status
);
},
IsShowMenu
:
false
,
IsShowFieldMenu
:
true
,
onClick
:
function
(
data
){
var
html
=
[];
html
.
push
(
'<span class="tomato-color">['
,
data
.
name
,
']</span>'
);
$
(
'#layoutDiv'
).
layout
(
'setCenterTitle'
,
html
.
join
(
''
));
// 创建表格
var
table
=
document
.
getElementById
(
"maingrid"
);
var
thead
=
table
.
querySelector
(
"thead tr"
);
$
(
"#resourceTypeId"
).
val
(
data
.
resourceTypeId
);
getFieldAndTitle
(
data
.
resourceTypeId
);
}
});
}
//初始化表格
function
initializeGrid
()
{
var
toolbarOptions
=
UICtrl
.
getDefaultToolbarOptions
({
addHandler
:
addHandler
,
updateHandler
:
function
(){
updateHandler
();
},
deleteHandler
:
deleteHandler
});
gridManager
=
UICtrl
.
grid
(
'#maingrid'
,
{
//columns: columnData,
dataAction
:
'server'
,
url
:
web_app
.
name
+
'/resourceField/getResourceFieldValue.ajax'
,
parms
:
{
resourceTypeId
:
$
(
"#resourceTypeId"
).
val
()},
checkbox
:
true
,
width
:
'100%'
,
height
:
'100%'
,
heightDiff
:
-
5
,
sortName
:
'code'
,
sortOrder
:
'asc'
,
toolbar
:
toolbarOptions
,
onDblClickRow
:
function
(
data
,
rowindex
,
rowobj
)
{
updateHandler
(
data
.
id
);
}
});
$
(
'#maingrid'
).
on
(
'click'
,
function
(
e
){
var
$clicked
=
$
(
e
.
target
||
e
.
srcElement
);
if
(
$clicked
.
is
(
'a.budgetFrozen'
)){
//报销授权
showBudgetFrozen
(
$clicked
.
data
(
'code'
));
return
false
;
}
if
(
$clicked
.
is
(
'a.budgetLog'
)){
//报销授权查询
showBudgetLog
(
$clicked
.
data
(
'code'
));
return
false
;
}
});
UICtrl
.
setSearchAreaToggle
(
gridManager
);
}
// 查询
function
query
(
obj
)
{
var
param
=
$
(
obj
).
formToJSON
();
UICtrl
.
gridSearch
(
gridManager
,
param
);
}
//刷新表格
function
reloadGrid
()
{
gridManager
.
loadData
();
}
//重置表单
function
resetForm
(
obj
)
{
$
(
obj
).
formClean
();
}
//关闭对话框
function
dialogClose
(){
if
(
refreshFlag
){
reloadGrid
();
refreshFlag
=
false
;
}
}
//添加按钮
function
addHandler
()
{
var
resourceTypeId
=
$
(
'#resourceTypeId'
).
val
();
if
(
Public
.
isBlank
(
resourceTypeId
))
{
Public
.
tip
(
'请选择资源!'
);
return
;
}
UICtrl
.
showAjaxDialog
({
title
:
$
.
i18nProp
(
'资源值'
),
url
:
web_app
.
name
+
'/resourceField/forwardAddResourceFieldValue.load'
,
//init:initDetailDialog,
param
:{
resourceTypeId
:
resourceTypeId
},
ok
:
insert
,
width
:
600
,
close
:
dialogClose
});
}
//新增保存
function
insert
()
{
var
_self
=
this
,
systemId
=
$
(
'#treeSystemId'
).
val
();
$
(
'#submitForm'
).
ajaxSubmit
({
url
:
web_app
.
name
+
'/ssrfPurchaseBudget/insertSsrfBudgetRecord.ajax'
,
param
:{
systemId
:
systemId
},
success
:
function
(
data
)
{
_self
.
close
();
reloadGrid
();
}
});
}
//编辑按钮
function
updateHandler
(
id
)
{
if
(
!
id
)
{
id
=
DataUtil
.
getUpdateRowId
(
gridManager
);
if
(
!
id
)
{
return
;
}
}
UICtrl
.
showAjaxDialog
({
title
:
$
.
i18nProp
(
'common.field.modif.title'
,
'预算'
),
width
:
600
,
url
:
web_app
.
name
+
'/ssrfPurchaseBudget/showLoadSsrfBudgetRecord.load'
,
init
:
initDetailDialog
,
param
:
{
id
:
id
},
ok
:
update
,
close
:
dialogClose
});
}
//编辑保存
function
update
()
{
var
_self
=
this
;
$
(
'#submitForm'
).
ajaxSubmit
({
url
:
web_app
.
name
+
'/ssrfPurchaseBudget/updateSsrfBudgetRecord.ajax'
,
success
:
function
()
{
refreshFlag
=
true
;
_self
.
close
();
}
});
}
//删除按钮
function
deleteHandler
()
{
DataUtil
.
del
({
action
:
'ssrfPurchaseBudget/deleteSsrfBudgetRecord.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'id'
,
onSuccess
:
function
()
{
reloadGrid
();
}
});
}
//启用
function
enableHandler
(){
DataUtil
.
updateById
({
action
:
'ssrfPurchaseBudget/updateHaseBudgetStatus.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'id'
,
param
:{
status
:
1
},
message
:
'common.confirm.enable'
,
onSuccess
:
function
(){
reloadGrid
();
}
});
}
//禁用
function
disableHandler
(){
DataUtil
.
updateById
({
action
:
'ssrfPurchaseBudget/updateHaseBudgetStatus.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'id'
,
param
:{
status
:
0
},
message
:
'common.confirm.disable'
,
onSuccess
:
function
(){
reloadGrid
();
}
});
}
function
getFieldAndTitle
(
resourceTypeId
){
Public
.
ajax
(
web_app
.
name
+
'/resourceField/getResourceField.ajax?resourceTypeId='
+
resourceTypeId
,
{}
,
function
(
data
)
{
// 动态生成列配置
columnData
=
data
.
map
(
function
(
column
)
{
return
{
name
:
column
.
resourceFieldName
,
display
:
column
.
resourceFiledTitle
,
sorting
:
true
,
// 如果需要启用排序
};
});
gridManager
=
UICtrl
.
getGridManager
(
'#maingrid'
);
UICtrl
.
reRenderGridColumns
(
gridManager
,
columnData
);
UICtrl
.
gridSearch
(
gridManager
,{
resourceTypeId
:
$
(
"#resourceTypeId"
).
val
()});
});
}
topsun-xt/src/main/webapp/biz/topsun/resource/resourceList.jsp
View file @
3099a277
...
@@ -3,13 +3,36 @@
...
@@ -3,13 +3,36 @@
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<html>
<html>
<head>
<head>
<x:base
include=
"
dialog,grid,combox,comboDialog,attachment"
/>
<x:base
include=
"
layout,dialog,grid,tree,combox,date,commonTree,attachment,datetime,excelImp,selectOrg"
/>
<x:i
18n name="topsun"
/>
<x:i
18n name="topsun"
/>
<x:script
src=
'/system/opm/js/OpmUtil.js'
/>
<x:script
src=
'/biz/topsun/common/purchaseCommon.js'
/>
<x:script
src=
'/biz/topsun/resource/resourceList.js'
/>
</head>
</head>
<body>
<body>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<h1>
哈哈哈哈
</h1>
<div
class=
"ui-hide"
>
<x:select
name=
"resourceFieldType"
dictionary=
"resourceFieldType"
/>
<x:select
name=
"yesorno"
dictionary=
"yesorno"
/>
</div>
<div
id=
"layoutDiv"
>
<div
position=
"left"
title=
"
<x:message
key=
"common.field.org"
/>
"
>
<ul
id=
"maintree"
></ul>
</div>
<div
position=
"center"
title=
"资源列表"
>
<x:title
title=
"common.button.query"
isHide=
"true"
hideTable=
"queryMainForm"
/>
<x:hidden
name=
"resourceTypeId"
id=
"resourceTypeId"
/>
<form
method=
"post"
class=
"hg-form ui-hide"
action=
""
id=
"queryMainForm"
>
<x:inputC
name=
"code"
title=
"编码"
required=
"false"
label=
"common.field.code"
labelCol=
"1"
/>
<x:inputC
name=
"name"
title=
"名称"
required=
"false"
label=
"common.field.name"
labelCol=
"1"
/>
<x:inputC
name=
"orderNumber"
required=
"false"
label=
"common.field.sequence"
labelCol=
"1"
/>
<div
class=
"clearfix"
></div>
<x:searchButtons/>
</form>
<div
class=
"blank_div clearfix"
></div>
<div
id=
"maingrid"
></div>
</div>
</div>
</div>
</div>
</body>
</body>
</html>
</html>
topsun/src/main/java/com/huigou/topsun/resource/controller/ResourceController.java
View file @
3099a277
package
com
.
huigou
.
topsun
.
resource
.
controller
;
package
com
.
huigou
.
topsun
.
resource
.
controller
;
import
com.huigou.cache.DictUtil
;
import
com.huigou.topsun.resource.service.ResourceTypeService
;
import
com.huigou.topsun.resource.service.ResourceTypeService
;
import
com.huigou.topsun.resource.vo.ResourceFiledVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeTreeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.util.SDO
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @Auther: xin.lu
* @Auther: xin.lu
...
@@ -26,30 +31,73 @@ public class ResourceController extends CommonController {
...
@@ -26,30 +31,73 @@ public class ResourceController extends CommonController {
@Resource
@Resource
private
ResourceTypeService
resourceTypeService
;
private
ResourceTypeService
resourceTypeService
;
/**
* 资源列表页
* @return
*/
public
String
forwardResourceList
(){
public
String
forwardResourceList
(){
Map
<
String
,
String
>
resourceFieldType
=
DictUtil
.
getDictionary
(
"resourceFieldType"
);
this
.
putAttribute
(
"resourceFieldType"
,
resourceFieldType
);
Map
<
String
,
String
>
yesorno
=
DictUtil
.
getDictionary
(
"yesorno"
);
this
.
putAttribute
(
"yesorno"
,
yesorno
);
return
forward
(
"resourceList"
);
return
forward
(
"resourceList"
);
}
}
/**
* 添加资源页面
* @return
*/
public
String
forwardFieldTreeDetail
(){
SDO
sdo
=
this
.
getSDO
();
String
tableName
=
sdo
.
getString
(
"tableName"
);
ResourceTypeVo
resourceTypeVo
=
resourceTypeService
.
initResourceTypeVo
(
tableName
);
return
forward
(
"fieldTreeDetail"
,
resourceTypeVo
);
}
/**
* 修改资源页面
* @return
*/
public
String
forwardUpdateFieldTreeDetail
(){
SDO
sdo
=
this
.
getSDO
();
String
tableName
=
sdo
.
getString
(
"tableName"
);
ResourceTypeVo
resourceTypeVo
=
resourceTypeService
.
findByTableName
(
tableName
);
return
forward
(
"fieldTreeDetail"
,
resourceTypeVo
);
}
//@Operation(summary = "保存资源类型")
//@Operation(summary = "保存资源类型")
public
String
saveResourceType
(
@RequestBody
ResourceTypeVo
resourceTypeVo
){
public
String
saveResourceType
(){
SDO
sdo
=
this
.
getSDO
();
ResourceTypeVo
resourceTypeVo
=
sdo
.
toObject
(
ResourceTypeVo
.
class
);
List
<
ResourceFiledVo
>
resourceFields
=
sdo
.
getList
(
"resourceFields"
,
ResourceFiledVo
.
class
);
resourceTypeVo
.
setResourceFileds
(
resourceFields
);
resourceTypeService
.
saveResourceTypeMain
(
resourceTypeVo
);
resourceTypeService
.
saveResourceTypeMain
(
resourceTypeVo
);
return
toResult
(
resourceTypeVo
);
return
toResult
(
resourceTypeVo
);
}
}
//@Operation(summary = "修改资源类型")
//@Operation(summary = "修改资源类型")
public
String
updateResourceType
(
@RequestBody
ResourceTypeVo
resourceTypeVo
){
public
String
updateResourceType
(){
SDO
sdo
=
this
.
getSDO
();
ResourceTypeVo
resourceTypeVo
=
sdo
.
toObject
(
ResourceTypeVo
.
class
);
List
<
ResourceFiledVo
>
resourceFields
=
sdo
.
getList
(
"resourceFields"
,
ResourceFiledVo
.
class
);
resourceTypeVo
.
setResourceFileds
(
resourceFields
);
resourceTypeService
.
updateResourceTypeMain
(
resourceTypeVo
);
resourceTypeService
.
updateResourceTypeMain
(
resourceTypeVo
);
return
toResult
(
resourceTypeVo
);
return
toResult
(
resourceTypeVo
);
}
}
//@Operation(summary = "根据id删除资源")
//@Operation(summary = "根据id删除资源")
public
String
deleteResourceType
(
@RequestParam
(
"id"
)
Long
id
){
public
String
deleteResourceType
(){
resourceTypeService
.
deleteById
(
id
);
SDO
sdo
=
this
.
getSDO
();
String
tableName
=
sdo
.
getString
(
"tableName"
);
ResourceTypeVo
resourceTypeVo
=
resourceTypeService
.
findByTableName
(
tableName
);
resourceTypeService
.
deleteById
(
resourceTypeVo
.
getResourceTypeId
());
return
success
();
return
success
();
}
}
//@Operation(summary = "根据id查询资源")
//@Operation(summary = "根据id查询资源")
public
String
findById
(
@RequestParam
(
"id"
)
Long
id
){
public
String
findById
(){
SDO
sdo
=
this
.
getSDO
();
Long
id
=
sdo
.
getLong
(
"id"
);
ResourceTypeVo
resourceTypeVo
=
resourceTypeService
.
findById
(
id
);
ResourceTypeVo
resourceTypeVo
=
resourceTypeService
.
findById
(
id
);
return
toResult
(
resourceTypeVo
);
return
toResult
(
resourceTypeVo
);
}
}
...
@@ -59,20 +107,26 @@ public class ResourceController extends CommonController {
...
@@ -59,20 +107,26 @@ public class ResourceController extends CommonController {
return
toResult
(
resourceTypeService
.
findList
());
return
toResult
(
resourceTypeService
.
findList
());
}
}
public
String
findResourceTypes
(){
SDO
sdo
=
this
.
getSDO
();
String
parentTableName
=
sdo
.
getString
(
"parentId"
);
List
<
ResourceTypeTreeVo
>
resourceTypeTreeVoList
=
resourceTypeService
.
queryResourceTypes
(
parentTableName
);
HashMap
<
Object
,
Object
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"Rows"
,
resourceTypeTreeVoList
);
return
toResult
(
hashMap
);
}
/*@Operation(summary = "根据表名,递归查询该表及父类字段")
/*@Operation(summary = "根据表名,递归查询该表及父类字段")
@GetMapping("/findParentResourceFields")
@GetMapping("/findParentResourceFields")
public Result<Set<ResourceFiled>> findParentResourceFields(@RequestParam String tableName){
public Result<Set<ResourceFiled>> findParentResourceFields(@RequestParam String tableName){
return Result.ok(resourceTypeService.findParentResourceFileds(tableName));
return Result.ok(resourceTypeService.findParentResourceFileds(tableName));
}*/
}*/
//@Operation(summary = "新增资源类型时,根据对象的父类表名,返回父类和超类及所属的字段")
public
String
findParentResourceTypeAndFields
(
@RequestParam
String
tableName
){
return
toResult
(
resourceTypeService
.
findParentResourceTypeAndFields
(
tableName
));
}
//@Operation(summary = "修改/查看资源类型时,根据当前表名,返回自己和父类和超类及所属的字段")
//@Operation(summary = "修改/查看资源类型时,根据当前表名,返回自己和父类和超类及所属的字段")
public
String
findResourceTypeAndFields
(
@RequestParam
String
tableName
){
public
String
findResourceTypeFields
(){
return
toResult
(
resourceTypeService
.
findResourceTypeAndFields
(
tableName
));
SDO
sdo
=
this
.
getSDO
();
String
tableName
=
sdo
.
getString
(
"tableName"
);
return
packGridDataAndResult
(
resourceTypeService
.
findResourceTypeFields
(
tableName
));
}
}
}
}
topsun/src/main/java/com/huigou/topsun/resource/controller/ResourceFieldController.java
View file @
3099a277
...
@@ -3,11 +3,14 @@ package com.huigou.topsun.resource.controller;
...
@@ -3,11 +3,14 @@ package com.huigou.topsun.resource.controller;
import
com.huigou.topsun.resource.service.ResourceFiledService
;
import
com.huigou.topsun.resource.service.ResourceFiledService
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.util.SDO
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @Auther: xin.lu
* @Auther: xin.lu
...
@@ -18,12 +21,23 @@ import java.util.HashMap;
...
@@ -18,12 +21,23 @@ import java.util.HashMap;
@Controller
@Controller
@ControllerMapping
(
"/resourceField"
)
@ControllerMapping
(
"/resourceField"
)
public
class
ResourceFieldController
extends
CommonController
{
public
class
ResourceFieldController
extends
CommonController
{
protected
String
getPagePath
()
{
return
"/biz/topsun/resource/"
;
}
@Resource
@Resource
private
ResourceFiledService
resourceFiledService
;
private
ResourceFiledService
resourceFiledService
;
public
String
forwardAddResourceFieldValue
(){
SDO
sdo
=
this
.
getSDO
();
String
resourceTypeId
=
sdo
.
getString
(
"resourceTypeId"
);
this
.
putAttribute
(
"resourceTypeId"
,
resourceTypeId
);
return
forward
(
"fieldValueDetail"
);
}
//@Operation(summary = "根据资源类型id,查询资源字段")
//@Operation(summary = "根据资源类型id,查询资源字段")
public
String
getResourceField
(
@RequestParam
(
"resourceTypeId"
)
Long
resourceTypeId
){
public
String
getResourceField
(){
SDO
sdo
=
this
.
getSDO
();
Long
resourceTypeId
=
sdo
.
getLong
(
"resourceTypeId"
);
return
toResult
(
resourceFiledService
.
findByResourceTypeId
(
resourceTypeId
));
return
toResult
(
resourceFiledService
.
findByResourceTypeId
(
resourceTypeId
));
}
}
...
@@ -38,8 +52,14 @@ public class ResourceFieldController extends CommonController {
...
@@ -38,8 +52,14 @@ public class ResourceFieldController extends CommonController {
}
}
//@Operation(summary = "根据资源类型id,获取资源值")
//@Operation(summary = "根据资源类型id,获取资源值")
public
String
getResourceFieldValue
(
@RequestParam
(
"resourceTypeId"
)
Long
resourceTypeId
){
public
String
getResourceFieldValue
(){
return
toResult
(
resourceFiledService
.
getResourceFieldValue
(
resourceTypeId
));
SDO
sdo
=
this
.
getSDO
();
Long
resourceTypeId
=
sdo
.
getLong
(
"resourceTypeId"
);
List
<
Map
<
String
,
Object
>>
resourceFieldValue
=
resourceFiledService
.
getResourceFieldValue
(
resourceTypeId
);
HashMap
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"Rows"
,
resourceFieldValue
);
return
toResult
(
map
);
//return success();
}
}
//@Operation(summary = "根据资源类型id和数据id删除资源值")
//@Operation(summary = "根据资源类型id和数据id删除资源值")
...
...
topsun/src/main/java/com/huigou/topsun/resource/domain/ResourceFiled.java
View file @
3099a277
...
@@ -91,11 +91,6 @@ public class ResourceFiled implements Serializable {
...
@@ -91,11 +91,6 @@ public class ResourceFiled implements Serializable {
@TableField
(
value
=
"dict_code"
)
@TableField
(
value
=
"dict_code"
)
private
String
dictCode
;
private
String
dictCode
;
//@Schema(description = "假删除标记(-1已删除,0正常)")
@TableField
(
value
=
"deleted"
)
@TableLogic
//逻辑删除
private
Integer
deleted
;
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/resource/mapper/ResourceTypeMapper.java
View file @
3099a277
...
@@ -3,9 +3,12 @@ package com.huigou.topsun.resource.mapper;
...
@@ -3,9 +3,12 @@ package com.huigou.topsun.resource.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.huigou.topsun.resource.domain.ResourceType
;
import
com.huigou.topsun.resource.domain.ResourceType
;
import
com.huigou.topsun.resource.vo.ResourceTypeTreeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author 16508
* @author 16508
...
@@ -15,6 +18,9 @@ import java.util.List;
...
@@ -15,6 +18,9 @@ import java.util.List;
*/
*/
public
interface
ResourceTypeMapper
extends
BaseMapper
<
ResourceType
>
{
public
interface
ResourceTypeMapper
extends
BaseMapper
<
ResourceType
>
{
List
<
ResourceTypeVo
>
noteTree
();
List
<
ResourceTypeVo
>
noteTree
();
List
<
ResourceTypeTreeVo
>
queryResourceTypes
(
@Param
(
"parentTableName"
)
String
parentTableName
);
}
}
...
...
topsun/src/main/java/com/huigou/topsun/resource/service/ResourceTypeService.java
View file @
3099a277
...
@@ -4,9 +4,11 @@ package com.huigou.topsun.resource.service;
...
@@ -4,9 +4,11 @@ package com.huigou.topsun.resource.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.huigou.topsun.resource.domain.ResourceType
;
import
com.huigou.topsun.resource.domain.ResourceType
;
import
com.huigou.topsun.resource.vo.ResourceFiledVo
;
import
com.huigou.topsun.resource.vo.ResourceFiledVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeTreeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
/**
/**
...
@@ -33,7 +35,9 @@ public interface ResourceTypeService extends IService<ResourceType> {
...
@@ -33,7 +35,9 @@ public interface ResourceTypeService extends IService<ResourceType> {
void
findParentMenusRecursively
(
String
tableName
,
Set
<
ResourceFiledVo
>
resourceFileds
);
void
findParentMenusRecursively
(
String
tableName
,
Set
<
ResourceFiledVo
>
resourceFileds
);
ResourceTypeVo
findParentResourceTypeAndFields
(
String
tableName
);
ResourceTypeVo
initResourceTypeVo
(
String
tableName
);
ResourceTypeVo
findResourceTypeAndFields
(
String
tableName
);
List
<
ResourceFiledVo
>
findResourceTypeFields
(
String
tableName
);
List
<
ResourceTypeTreeVo
>
queryResourceTypes
(
String
parentTableName
);
}
}
topsun/src/main/java/com/huigou/topsun/resource/service/impl/ResourceFiledServiceImpl.java
View file @
3099a277
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.huigou.cache.DictUtil
;
import
com.huigou.topsun.resource.domain.ResourceFieldValue
;
import
com.huigou.topsun.resource.domain.ResourceFieldValue
;
import
com.huigou.topsun.resource.domain.ResourceFiled
;
import
com.huigou.topsun.resource.domain.ResourceFiled
;
import
com.huigou.topsun.resource.domain.ResourceType
;
import
com.huigou.topsun.resource.domain.ResourceType
;
...
@@ -37,7 +38,7 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
...
@@ -37,7 +38,7 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
public
ResourceFiledVo
saveResourceFiled
(
ResourceFiledVo
resourceFiledVo
)
{
public
ResourceFiledVo
saveResourceFiled
(
ResourceFiledVo
resourceFiledVo
)
{
ResourceFiled
resourceFiled
=
ResourceFiledVo
.
getResourceFiled
(
resourceFiledVo
);
ResourceFiled
resourceFiled
=
ResourceFiledVo
.
getResourceFiled
(
resourceFiledVo
);
this
.
save
(
resourceFiled
);
this
.
save
(
resourceFiled
);
resourceFiledVo
.
setResourceFieldId
(
resourceFiled
.
getResourceFieldId
());
resourceFiledVo
.
setResourceFieldId
(
resourceFiled
.
getResourceFieldId
()
.
toString
()
);
return
resourceFiledVo
;
return
resourceFiledVo
;
}
}
...
@@ -114,7 +115,16 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
...
@@ -114,7 +115,16 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
LambdaQueryWrapper
<
ResourceFiled
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
ResourceFiled
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
ResourceFiled:
:
getResourceTypeId
,
resourceTypeId
);
queryWrapper
.
eq
(
ResourceFiled:
:
getResourceTypeId
,
resourceTypeId
);
List
<
ResourceFiled
>
list
=
this
.
list
(
queryWrapper
);
List
<
ResourceFiled
>
list
=
this
.
list
(
queryWrapper
);
return
JSON
.
parseArray
(
JSON
.
toJSONString
(
list
),
ResourceFiledVo
.
class
);
List
<
ResourceFiledVo
>
resourceFiledVos
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
list
),
ResourceFiledVo
.
class
);
resourceFiledVos
.
forEach
(
resourceFiledVo
->
{
String
resourceFieldTypeText
=
DictUtil
.
getDictionaryDetailText
(
"resourceFieldType"
,
resourceFiledVo
.
getResourceFieldType
());
resourceFiledVo
.
setResourceFieldTypeTextView
(
resourceFieldTypeText
);
String
yesornoText
=
DictUtil
.
getDictionaryDetailText
(
"yesorno"
,
resourceFiledVo
.
getResourceFieldShow
());
resourceFiledVo
.
setResourceFieldShowTextView
(
yesornoText
);
});
return
resourceFiledVos
;
}
}
@Override
@Override
...
@@ -177,11 +187,16 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
...
@@ -177,11 +187,16 @@ public class ResourceFiledServiceImpl extends ServiceImpl<ResourceFiledMapper, R
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
getResourceFieldValue
(
Long
resourceTypeId
){
public
List
<
Map
<
String
,
Object
>>
getResourceFieldValue
(
Long
resourceTypeId
){
ResourceType
resourceType
=
resourceTypeMapper
.
selectById
(
resourceTypeId
);
List
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
//获取表名
if
(
resourceTypeId
==
null
){
String
tableName
=
resourceType
.
getResourceTableName
();
return
maps
;
List
<
Map
<
String
,
Object
>>
maps
=
resourceFiledMapper
.
selectDataList
(
tableName
);
}
else
{
return
maps
;
ResourceType
resourceType
=
resourceTypeMapper
.
selectById
(
resourceTypeId
);
//获取表名
String
tableName
=
resourceType
.
getResourceTableName
();
maps
=
resourceFiledMapper
.
selectDataList
(
tableName
);
return
maps
;
}
}
}
@Override
@Override
...
...
topsun/src/main/java/com/huigou/topsun/resource/service/impl/ResourceTypeServiceImpl.java
View file @
3099a277
...
@@ -9,6 +9,7 @@ import com.huigou.topsun.resource.service.ResourceFiledService;
...
@@ -9,6 +9,7 @@ import com.huigou.topsun.resource.service.ResourceFiledService;
import
com.huigou.topsun.resource.service.ResourceTypeService
;
import
com.huigou.topsun.resource.service.ResourceTypeService
;
import
com.huigou.topsun.resource.util.PinyinHelperUtil
;
import
com.huigou.topsun.resource.util.PinyinHelperUtil
;
import
com.huigou.topsun.resource.vo.ResourceFiledVo
;
import
com.huigou.topsun.resource.vo.ResourceFiledVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeTreeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
com.huigou.topsun.resource.vo.ResourceTypeVo
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -46,9 +47,8 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
...
@@ -46,9 +47,8 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
List
<
String
>
fieldList
=
new
ArrayList
<>();
List
<
String
>
fieldList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
resourceFileds
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
resourceFileds
.
size
();
i
++)
{
ResourceFiledVo
resourceFiled
=
resourceFileds
.
get
(
i
);
ResourceFiledVo
resourceFiled
=
resourceFileds
.
get
(
i
);
resourceFiled
.
setResourceTypeId
(
resourceType
.
getResourceTypeId
());
resourceFiled
.
setResourceTypeId
(
resourceType
.
getResourceTypeId
()
.
toString
()
);
resourceFiled
.
setResourceFieldId
(
null
);
resourceFiled
.
setResourceFieldId
(
null
);
resourceFiled
.
setDeleted
(
0
);
//字段名称首字母小写
//字段名称首字母小写
String
pinYinHeadChar
=
PinyinHelperUtil
.
getPinYinHeadChar
(
resourceFiled
.
getResourceFiledTitle
());
String
pinYinHeadChar
=
PinyinHelperUtil
.
getPinYinHeadChar
(
resourceFiled
.
getResourceFiledTitle
());
if
(
fieldList
.
indexOf
(
pinYinHeadChar
)
>
0
)
{
if
(
fieldList
.
indexOf
(
pinYinHeadChar
)
>
0
)
{
...
@@ -62,8 +62,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
...
@@ -62,8 +62,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
resourceFiled
.
setResourceFieldSize
(
resourceFiled
.
getResourceFieldSize
()
==
null
?
255
:
resourceFiled
.
getResourceFieldSize
());
resourceFiled
.
setResourceFieldSize
(
resourceFiled
.
getResourceFieldSize
()
==
null
?
255
:
resourceFiled
.
getResourceFieldSize
());
}
}
if
(
"float"
.
equals
(
resourceFiled
.
getResourceFieldType
())
if
(
"float"
.
equals
(
resourceFiled
.
getResourceFieldType
())
||
"double"
.
equals
(
resourceFiled
.
getResourceFieldType
())
||
"double"
.
equals
(
resourceFiled
.
getResourceFieldType
())){
||
"decimal"
.
equals
(
resourceFiled
.
getResourceFieldType
())){
resourceFiled
.
setIntegerLength
(
resourceFiled
.
getIntegerLength
()
==
null
?
10
:
resourceFiled
.
getIntegerLength
());
resourceFiled
.
setIntegerLength
(
resourceFiled
.
getIntegerLength
()
==
null
?
10
:
resourceFiled
.
getIntegerLength
());
resourceFiled
.
setDecimalPrecision
(
resourceFiled
.
getDecimalPrecision
()
==
null
?
2
:
resourceFiled
.
getDecimalPrecision
());
resourceFiled
.
setDecimalPrecision
(
resourceFiled
.
getDecimalPrecision
()
==
null
?
2
:
resourceFiled
.
getDecimalPrecision
());
}
}
...
@@ -82,15 +81,17 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
...
@@ -82,15 +81,17 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
//先获取到数据库资源表配置字段
//先获取到数据库资源表配置字段
this
.
updateById
(
ResourceTypeVo
.
getResourceType
(
resourceTypeVo
));
this
.
updateById
(
ResourceTypeVo
.
getResourceType
(
resourceTypeVo
));
List
<
ResourceFiledVo
>
resourceFileds
=
resourceTypeVo
.
getResourceFileds
();
List
<
ResourceFiledVo
>
resourceFileds
=
resourceTypeVo
.
getResourceFileds
();
List
<
ResourceFiledVo
>
dbFiledVoList
=
resourceFiledService
.
findByResourceTypeId
(
resourceTypeVo
.
getResourceTypeId
());
//先根据资源类型id删除字段,再保存
//先根据资源类型id删除字段,再保存
resourceFiledService
.
deleteByResourceTypeId
(
resourceTypeVo
.
getResourceTypeId
());
resourceFiledService
.
deleteByResourceTypeId
(
resourceTypeVo
.
getResourceTypeId
());
this
.
dealResourceFileds
(
resourceFileds
,
resourceTypeVo
.
getResourceTableName
());
this
.
dealResourceFileds
(
resourceFileds
,
dbFiledVoList
,
resourceTypeVo
.
getResourceTableName
());
for
(
ResourceFiledVo
resourceFiledVo
:
resourceFileds
)
{
for
(
ResourceFiledVo
resourceFiledVo
:
resourceFileds
)
{
//字段名称首字母小写
//字段名称首字母小写
String
pinYinHeadChar
=
PinyinHelperUtil
.
getPinYinHeadChar
(
resourceFiledVo
.
getResourceFieldName
());
String
pinYinHeadChar
=
PinyinHelperUtil
.
getPinYinHeadChar
(
resourceFiledVo
.
getResourceFieldName
());
resourceFiledVo
.
setResourceFieldName
(
pinYinHeadChar
);
resourceFiledVo
.
setResourceFieldName
(
pinYinHeadChar
);
resourceFiledVo
.
setResourceTypeId
(
resourceTypeVo
.
getResourceTypeId
());
resourceFiledVo
.
setResourceTypeId
(
resourceTypeVo
.
getResourceTypeId
()
.
toString
()
);
resourceFiledService
.
saveResourceFiled
(
resourceFiledVo
);
resourceFiledService
.
saveResourceFiled
(
resourceFiledVo
);
}
}
//更新表
//更新表
...
@@ -98,7 +99,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
...
@@ -98,7 +99,7 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
}
}
@Transactional
@Transactional
public
void
dealResourceFileds
(
List
<
ResourceFiledVo
>
resourceFileds
,
String
tableName
)
{
public
void
dealResourceFileds
(
List
<
ResourceFiledVo
>
resourceFileds
,
List
<
ResourceFiledVo
>
dbFiledVoList
,
String
tableName
)
{
if
(
resourceFileds
.
isEmpty
())
{
if
(
resourceFileds
.
isEmpty
())
{
//添加新增的所有字段(id除外)
//添加新增的所有字段(id除外)
resourceFiledService
.
updateTableAddColumn
(
resourceFileds
,
tableName
);
resourceFiledService
.
updateTableAddColumn
(
resourceFileds
,
tableName
);
...
@@ -109,6 +110,11 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
...
@@ -109,6 +110,11 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
String
pinYinHeadChar
=
PinyinHelperUtil
.
getPinYinHeadChar
(
resourceFiledVo
.
getResourceFiledTitle
());
String
pinYinHeadChar
=
PinyinHelperUtil
.
getPinYinHeadChar
(
resourceFiledVo
.
getResourceFiledTitle
());
resourceFiledVo
.
setResourceFieldName
(
pinYinHeadChar
);
resourceFiledVo
.
setResourceFieldName
(
pinYinHeadChar
);
if
(
resourceFiledVo
.
getResourceFieldId
()
!=
null
)
{
//如果id不为空,更新字段
if
(
resourceFiledVo
.
getResourceFieldId
()
!=
null
)
{
//如果id不为空,更新字段
for
(
ResourceFiledVo
dbFiledVo
:
dbFiledVoList
)
{
if
(
resourceFiledVo
.
getResourceFieldId
().
equals
(
dbFiledVo
.
getResourceFieldId
())){
resourceFiledVo
.
setDbResourceFieldName
(
dbFiledVo
.
getResourceFieldName
());
}
}
resourceFiledChangeSet
.
add
(
resourceFiledVo
);
resourceFiledChangeSet
.
add
(
resourceFiledVo
);
}
else
{
}
else
{
resourceFiledSet
.
add
(
resourceFiledVo
);
//id 为null则是新增的字段,添加
resourceFiledSet
.
add
(
resourceFiledVo
);
//id 为null则是新增的字段,添加
...
@@ -191,24 +197,25 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
...
@@ -191,24 +197,25 @@ public class ResourceTypeServiceImpl extends ServiceImpl<ResourceTypeMapper, Res
}
}
@Override
@Override
public
ResourceTypeVo
findParentResourceTypeAndFields
(
String
tableName
)
{
public
ResourceTypeVo
initResourceTypeVo
(
String
tableName
)
{
ResourceTypeVo
resourceTypeVo
=
new
ResourceTypeVo
();
ResourceTypeVo
resourceTypeVo
=
new
ResourceTypeVo
();
ResourceTypeVo
parentResourceType
=
this
.
findByTableName
(
tableName
);
ResourceTypeVo
parentResourceType
=
this
.
findByTableName
(
tableName
);
resourceTypeVo
.
setParentTableName
(
parentResourceType
.
getResourceTableName
());
resourceTypeVo
.
setParentTableName
(
parentResourceType
.
getResourceTableName
());
resourceTypeVo
.
setParentTableTitle
(
parentResourceType
.
getResourceTableTitle
());
resourceTypeVo
.
setParentTableTitle
(
parentResourceType
.
getResourceTableTitle
());
resourceTypeVo
.
setSuperTableName
(
parentResourceType
.
getParentTableName
());
resourceTypeVo
.
setSuperTableName
(
parentResourceType
.
getParentTableName
());
resourceTypeVo
.
setSuperTableTitle
(
parentResourceType
.
getParentTableTitle
());
resourceTypeVo
.
setSuperTableTitle
(
parentResourceType
.
getParentTableTitle
());
List
<
ResourceFiledVo
>
parentResourceFileds
=
this
.
findParentResourceFileds
(
tableName
);
resourceTypeVo
.
setResourceFileds
(
parentResourceFileds
);
return
resourceTypeVo
;
return
resourceTypeVo
;
}
}
@Override
@Override
public
ResourceTypeVo
findResourceTypeAndFields
(
String
tableName
)
{
public
List
<
ResourceFiledVo
>
findResourceTypeFields
(
String
tableName
)
{
ResourceTypeVo
resourceTypeVo
=
this
.
findByTableName
(
tableName
);
List
<
ResourceFiledVo
>
resourceFileds
=
this
.
findParentResourceFileds
(
tableName
);
List
<
ResourceFiledVo
>
parentResourceFileds
=
this
.
findParentResourceFileds
(
tableName
);
return
resourceFileds
;
resourceTypeVo
.
setResourceFileds
(
parentResourceFileds
);
}
return
resourceTypeVo
;
@Override
public
List
<
ResourceTypeTreeVo
>
queryResourceTypes
(
String
parentTableName
)
{
return
resourceTypeMapper
.
queryResourceTypes
(
parentTableName
);
}
}
}
}
...
...
topsun/src/main/java/com/huigou/topsun/resource/vo/ResourceFiledVo.java
View file @
3099a277
...
@@ -3,6 +3,7 @@ package com.huigou.topsun.resource.vo;
...
@@ -3,6 +3,7 @@ package com.huigou.topsun.resource.vo;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.huigou.topsun.resource.domain.ResourceFiled
;
import
com.huigou.topsun.resource.domain.ResourceFiled
;
import
com.topsunit.query.annotations.Dictionary
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -18,13 +19,13 @@ public class ResourceFiledVo implements Serializable {
...
@@ -18,13 +19,13 @@ public class ResourceFiledVo implements Serializable {
* 资源字段ID
* 资源字段ID
*/
*/
//@Schema(description = "资源字段ID")
//@Schema(description = "资源字段ID")
private
Lo
ng
resourceFieldId
;
private
Stri
ng
resourceFieldId
;
/**
/**
* 所属资源类型
* 所属资源类型
*/
*/
//@Schema(description = "所属资源类型ID")
//@Schema(description = "所属资源类型ID")
private
Lo
ng
resourceTypeId
;
private
Stri
ng
resourceTypeId
;
/**
/**
* 字段名
* 字段名
...
@@ -41,15 +42,20 @@ public class ResourceFiledVo implements Serializable {
...
@@ -41,15 +42,20 @@ public class ResourceFiledVo implements Serializable {
/**
/**
* 字段类型
* 字段类型
*/
*/
//@Schema(description = "字段类型,码表(resourceFieldType))")
//@Schema(description = "字段类型,码表(resourceFieldType))
@Dictionary
(
"resourceFieldType"
)
private
String
resourceFieldType
;
private
String
resourceFieldType
;
private
String
resourceFieldTypeTextView
;
/**
/**
* 是否可见
* 是否可见
*/
*/
//@Schema(description = "是否可见,码表(resourceFieldShow))")
//@Schema(description = "是否可见,码表(resourceFieldShow))")
private
String
resourceFieldShow
;
private
String
resourceFieldShow
;
private
String
resourceFieldShowTextView
;
/**
/**
* 字段大小
* 字段大小
*/
*/
...
@@ -80,10 +86,6 @@ public class ResourceFiledVo implements Serializable {
...
@@ -80,10 +86,6 @@ public class ResourceFiledVo implements Serializable {
//@Schema(description = "对应码表的编码")
//@Schema(description = "对应码表的编码")
private
String
dictCode
;
private
String
dictCode
;
//@Schema(description = "假删除标记(-1已删除,0正常)")
@TableLogic
()
//逻辑删除
private
Integer
deleted
;
private
String
dbResourceFieldName
;
private
String
dbResourceFieldName
;
public
static
ResourceFiledVo
getResourceFiledVo
(
ResourceFiled
resourceFiled
){
public
static
ResourceFiledVo
getResourceFiledVo
(
ResourceFiled
resourceFiled
){
...
...
topsun/src/main/java/com/huigou/topsun/resource/vo/ResourceTypeTreeVo.java
0 → 100644
View file @
3099a277
package
com
.
huigou
.
topsun
.
resource
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Auther: xin.lu
* @Date: 2023/11/13/9:51
* @Description:
*/
@Data
public
class
ResourceTypeTreeVo
implements
Serializable
{
private
String
resourceTypeId
;
private
String
id
;
private
String
name
;
private
String
parentId
;
private
String
parentTableTitle
;
private
String
superTableName
;
private
String
superTableTitle
;
private
Integer
status
;
private
String
nodeKindId
;
private
String
orgKindId
;
private
Integer
hasChildren
;
}
topsun/src/main/resources/config/topsun/mapper/A
0 → 100644
View file @
3099a277
topsun/src/main/
java/com/huigou/topsun/resource/mapper/xml
/ResourceFiledMapper.xml
→
topsun/src/main/
resources/config/topsun/mapper/resource
/ResourceFiledMapper.xml
View file @
3099a277
...
@@ -29,10 +29,16 @@
...
@@ -29,10 +29,16 @@
<if
test=
"resourceField.resourceFieldType == 'string'"
>
<if
test=
"resourceField.resourceFieldType == 'string'"
>
varchar( ${resourceField.resourceFieldSize} )
varchar( ${resourceField.resourceFieldSize} )
</if>
</if>
<if
test=
"resourceField.resourceFieldType == '
decimal' or resourceField.resourceFieldType == 'float' or resourceField.resourceFieldType == 'double
'"
>
<if
test=
"resourceField.resourceFieldType == '
int
'"
>
decimal( ${resourceField.integerLength},${resourceField.decimalPrecision}
)
int(0
)
</if>
</if>
<if
test=
"resourceField.resourceFieldType == 'datetime'"
>
<if
test=
"resourceField.resourceFieldType == 'double'"
>
double( ${resourceField.integerLength},${resourceField.decimalPrecision} )
</if>
<if
test=
"resourceField.resourceFieldType == 'float'"
>
float( ${resourceField.integerLength},${resourceField.decimalPrecision} )
</if>
<if
test=
"resourceField.resourceFieldType == 'date'"
>
datetime(0)
datetime(0)
</if>
</if>
<if
test=
"resourceField.resourceFieldType == 'text'"
>
<if
test=
"resourceField.resourceFieldType == 'text'"
>
...
...
topsun/src/main/
java/com/huigou/topsun/resource/mapper/xml
/ResourceTypeMapper.xml
→
topsun/src/main/
resources/config/topsun/mapper/resource
/ResourceTypeMapper.xml
View file @
3099a277
...
@@ -41,4 +41,25 @@
...
@@ -41,4 +41,25 @@
from resource_type
from resource_type
where parent_table_name=#{resource_table_name}
where parent_table_name=#{resource_table_name}
</select>
</select>
<select
id=
"queryResourceTypes"
resultType=
"com.huigou.topsun.resource.vo.ResourceTypeTreeVo"
>
SELECT
resource_type_id as resourceTypeId,
resource_table_name AS id,
resource_table_title AS name,
parent_table_name as parentTableName,
parent_table_name AS parentId,
parent_table_title as parentTableTitle,
super_table_name as superTableName,
super_table_title as superTableTitle,
1 as status,
CASE
WHEN ( SELECT count(*) FROM resource_type i WHERE i.parent_table_name = t.resource_table_name ) > 0 THEN
"folder" ELSE "fun"
END AS nodeKindId,
'ogn' AS orgKindId,
( SELECT count(*) FROM resource_type i WHERE i.parent_table_name = t.resource_table_name ) hasChildren
FROM
resource_type t where t.parent_table_name = #{parentTableName}
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment