Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
loit-build-common
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
loit-Infrastructure
loit-build-common
Commits
b406ce95
提交
b406ce95
authored
5月 22, 2023
作者:
chenshiying
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[新增] 廊坊生成大小类管理问题sql
上级
71159648
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
199 行增加
和
18 行删除
+199
-18
GeneratorCommandManualScript.java
...om/loit/common/langfang/GeneratorCommandManualScript.java
+63
-17
CommandManualDTO.java
...n/java/com/loit/common/langfang/dto/CommandManualDTO.java
+40
-0
bigTypeScript.ftl
...nv/src/main/resources/template/langfang/bigTypeScript.ftl
+48
-1
smallTypeScript.ftl
.../src/main/resources/template/langfang/smallTypeScript.ftl
+48
-0
没有找到文件。
loit-build-component/loit-build-deploy-env/src/main/java/com/loit/common/langfang/GeneratorCommandManualScript.java
浏览文件 @
b406ce95
package
com
.
loit
.
common
.
langfang
;
import
com.loit.common.langfang.dto.CommandManualDTO
;
import
com.loit.common.script.dto.BackendFrontEnum
;
import
com.loit.common.script.dto.DeployInfoDataDTO
;
import
com.loit.common.utils.ListUtil
;
import
com.loit.common.utils.StringUtils
;
import
com.loit.common.utils.excel.ImportExcel
;
...
...
@@ -16,18 +14,16 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
public
class
GeneratorCommandManualScript
{
public
static
final
String
CASE_TYPE
=
"1"
;
protected
static
String
root_path
=
"F:\\9Git140\\loit-build-common\\loit-build-component\\loit-build-deploy-env\\src\\main\\resources\\langfang"
;
public
static
void
main
(
String
[]
args
)
{
try
{
...
...
@@ -50,6 +46,9 @@ public class GeneratorCommandManualScript {
createBigTypeScript
(
transformList
);
createSmallTypeScript
(
transformList
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
...
...
@@ -104,9 +103,6 @@ public class GeneratorCommandManualScript {
}
resultList
.
add
(
commandManual
);
String
atype
=
commandManual
.
getAtype
();
if
(
StringUtils
.
isEmpty
(
commandManual
.
getBtype
()))
{
commandManual
.
setBtype
(
atype
);
...
...
@@ -116,13 +112,21 @@ public class GeneratorCommandManualScript {
commandManual
.
setCtype
(
atype
);
}
commandManual
.
setBigAndSmallCode
(
commandManual
.
getBigTypeCode
()
+
"|"
+
commandManual
.
getSmallTypeCode
());
commandManual
.
setBigTypeCodeInt
(
Integer
.
valueOf
(
commandManual
.
getBigTypeCode
()));
commandManual
.
setSmallTypeCodeInt
(
Integer
.
valueOf
(
commandManual
.
getSmallTypeCode
()));
resultList
.
add
(
commandManual
);
}
return
resultList
;
}
/**
* 生成大类脚本
*
...
...
@@ -130,16 +134,58 @@ public class GeneratorCommandManualScript {
*/
private
static
void
createBigTypeScript
(
List
<
CommandManualDTO
>
commandManualList
)
{
Map
model
=
new
HashMap
();
model
.
put
(
"springProfilesActive"
,
"123"
);
String
configFilePath
=
root_path
+
"\\bigTypeScript.sql"
;
String
jobConfig
=
FreeMarkerUtils
.
process
(
"langfang"
+
"\\bigTypeScript.ftl"
,
model
);
FileUtils
.
appendNewLine
(
configFilePath
,
jobConfig
);
List
<
CommandManualDTO
>
bitTypeList
=
commandManualList
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CommandManualDTO:
:
getBigTypeCode
))),
ArrayList:
:
new
));
if
(
bitTypeList
==
null
||
bitTypeList
.
isEmpty
())
{
return
;
}
for
(
CommandManualDTO
commandManualDTO
:
bitTypeList
)
{
Map
model
=
new
HashMap
();
model
.
put
(
"bigTypeCode"
,
commandManualDTO
.
getBigTypeCode
());
model
.
put
(
"bigTypeName"
,
commandManualDTO
.
getBigTypeName
());
model
.
put
(
"caseType"
,
CASE_TYPE
);
System
.
out
.
println
(
"test"
);
String
configFilePath
=
root_path
+
"\\bigTypeScript.sql"
;
String
jobConfig
=
FreeMarkerUtils
.
process
(
"langfang"
+
"\\bigTypeScript.ftl"
,
model
);
FileUtils
.
append
(
configFilePath
,
jobConfig
);
}
}
/**
* 生成小类脚本
*
* @throws IOException
*/
private
static
void
createSmallTypeScript
(
List
<
CommandManualDTO
>
commandManualList
)
{
List
<
CommandManualDTO
>
smallTypeList
=
commandManualList
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CommandManualDTO:
:
getBigAndSmallCode
))),
ArrayList:
:
new
));
if
(
smallTypeList
==
null
||
smallTypeList
.
isEmpty
())
{
return
;
}
smallTypeList
.
sort
(
Comparator
.
comparing
(
CommandManualDTO:
:
getBigTypeCodeInt
)
.
thenComparing
(
CommandManualDTO:
:
getSmallTypeCodeInt
));
for
(
CommandManualDTO
commandManualDTO
:
smallTypeList
)
{
Map
model
=
new
HashMap
();
model
.
put
(
"bigTypeCode"
,
commandManualDTO
.
getBigTypeCode
());
model
.
put
(
"bigTypeName"
,
commandManualDTO
.
getBigTypeName
());
model
.
put
(
"smallTypeCode"
,
commandManualDTO
.
getSmallTypeCode
());
model
.
put
(
"smallTypeName"
,
commandManualDTO
.
getSmallTypeName
());
model
.
put
(
"caseType"
,
CASE_TYPE
);
String
configFilePath
=
root_path
+
"\\smallTypeScript.sql"
;
String
jobConfig
=
FreeMarkerUtils
.
process
(
"langfang"
+
"\\smallTypeScript.ftl"
,
model
);
FileUtils
.
append
(
configFilePath
,
jobConfig
);
}
}
}
loit-build-component/loit-build-deploy-env/src/main/java/com/loit/common/langfang/dto/CommandManualDTO.java
浏览文件 @
b406ce95
...
...
@@ -50,6 +50,22 @@ public class CommandManualDTO implements Serializable {
private
String
ctype
;
/**
* 大类编号Int
*/
private
Integer
bigTypeCodeInt
;
/**
* 小类编号Int
*/
private
Integer
smallTypeCodeInt
;
/**
* 大类和小类组合编码
*/
private
String
bigAndSmallCode
;
public
String
getBigTypeCode
()
{
return
bigTypeCode
;
}
...
...
@@ -113,4 +129,28 @@ public class CommandManualDTO implements Serializable {
public
void
setCtype
(
String
ctype
)
{
this
.
ctype
=
ctype
;
}
public
Integer
getBigTypeCodeInt
()
{
return
bigTypeCodeInt
;
}
public
void
setBigTypeCodeInt
(
Integer
bigTypeCodeInt
)
{
this
.
bigTypeCodeInt
=
bigTypeCodeInt
;
}
public
Integer
getSmallTypeCodeInt
()
{
return
smallTypeCodeInt
;
}
public
void
setSmallTypeCodeInt
(
Integer
smallTypeCodeInt
)
{
this
.
smallTypeCodeInt
=
smallTypeCodeInt
;
}
public
String
getBigAndSmallCode
()
{
return
bigAndSmallCode
;
}
public
void
setBigAndSmallCode
(
String
bigAndSmallCode
)
{
this
.
bigAndSmallCode
=
bigAndSmallCode
;
}
}
loit-build-component/loit-build-deploy-env/src/main/resources/template/langfang/bigTypeScript.ftl
浏览文件 @
b406ce95
spring.profiles.active=${springProfilesActive}
INSERT INTO `base_base_casetype`(
`obj_code`,
`obj_name`,
`parent_id`,
`all_code`,
`icon`,
`discript`,
`major_depart`,
`is_system`,
`sort`,
`person_name`,
`phone`,
`remarks`,
`create_by`,
`create_date`,
`update_by`,
`update_date`,
`del_flag`,
`verison`,
`is_use`,
`business_type_id`,
`level`,
`case_type`
)
VALUES (
'${bigTypeCode}', -- 大类编码,自己取⼀个
'${bigTypeName}', -- 修改你的大类名称
'',
'',
'',
'',
NULL,
'',
NULL,
'',
'',
NULL,
NULL,
NULL,
NULL,
NULL,
'0',
NULL,
NULL,
NULL,
'2',
'${caseType}' -- 1:事件,2:部件
);
loit-build-component/loit-build-deploy-env/src/main/resources/template/langfang/smallTypeScript.ftl
0 → 100644
浏览文件 @
b406ce95
INSERT INTO `base_base_casetype`(
`obj_code`,
`obj_name`,
`parent_id`,
`all_code`,
`icon`,
`discript`,
`major_depart`,
`is_system`,
`sort`,
`person_name`,
`phone`,
`remarks`,
`create_by`,
`create_date`,
`update_by`,
`update_date`,
`del_flag`,
`verison`,
`is_use`,
`business_type_id`,
`level`,
`case_type`
)
VALUES (
'${smallTypeCode}', -- ⼩类编码,自己取一个
'${smallTypeName}', -- 修改你的⼩类
'${bigTypeCode}', -- 大类的 id
'',
'',
'',
NULL,
'',
NULL,
'',
'',
NULL,
NULL,
NULL,
NULL,
NULL,
'0',
NULL,
NULL,
NULL,
'3',
'${caseType}' -- 1:事件,2:部件
);
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论