Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JeeSpringCloud
Commits
05beecd0
Commit
05beecd0
authored
Nov 12, 2018
by
Huang
Browse files
no commit message
parent
bc5dd330
Changes
368
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 368+
files are displayed.
Plain diff
Email patch
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/service/GenTemplateService.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:23:35
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: GenTemplateService.java
package
com.jeespring.modules.gen.service
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.service.AbstractService
;
import
com.jeespring.modules.gen.dao.GenTemplateDao
;
import
com.jeespring.modules.gen.entity.GenTemplate
;
import
org.apache.commons.lang3.StringEscapeUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
@org
.
springframework
.
stereotype
.
Service
@Transactional
(
readOnly
=
true
)
public
class
GenTemplateService
extends
AbstractService
{
public
GenTemplateService
()
{
}
public
GenTemplate
get
(
String
id
)
{
return
genTemplateDao
.
get
(
id
);
}
public
Page
find
(
Page
page
,
GenTemplate
genTemplate
)
{
genTemplate
.
setPage
(
page
);
page
.
setList
(
genTemplateDao
.
findList
(
genTemplate
));
return
page
;
}
@Transactional
(
readOnly
=
false
)
public
void
save
(
GenTemplate
genTemplate
)
{
if
(
genTemplate
.
getContent
()
!=
null
)
{
genTemplate
.
setContent
(
StringEscapeUtils
.
unescapeHtml4
(
genTemplate
.
getContent
()));
}
if
(
StringUtils
.
isBlank
(
genTemplate
.
getId
()))
{
genTemplate
.
preInsert
();
genTemplateDao
.
insert
(
genTemplate
);
}
else
{
genTemplate
.
preUpdate
();
genTemplateDao
.
update
(
genTemplate
);
}
}
@Transactional
(
readOnly
=
false
)
public
void
delete
(
GenTemplate
genTemplate
)
{
genTemplateDao
.
delete
(
genTemplate
);
}
@Autowired
private
GenTemplateDao
genTemplateDao
;
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/template/FreemarkerHelper.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:23:12
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: FreemarkerHelper.java
package
com.jeespring.modules.gen.template
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
java.io.StringWriter
;
import
java.util.Map
;
public
class
FreemarkerHelper
{
public
FreemarkerHelper
()
{
}
public
String
parseTemplate
(
String
tplName
,
String
encoding
,
Map
paras
)
{
try
{
StringWriter
swriter
=
new
StringWriter
();
Template
mytpl
=
null
;
mytpl
=
_tplConfig
.
getTemplate
(
tplName
,
encoding
);
mytpl
.
process
(
paras
,
swriter
);
return
swriter
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
e
.
toString
();
}
}
public
String
parseTemplate
(
String
tplName
,
Map
paras
)
{
return
parseTemplate
(
tplName
,
"utf-8"
,
paras
);
}
private
static
Configuration
_tplConfig
;
static
{
_tplConfig
=
new
Configuration
();
_tplConfig
.
setClassForTemplateLoading
(
FreemarkerHelper
.
class
,
"/"
);
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/template/findList.ftl
0 → 100644
View file @
05beecd0
SELECT
<#assign columnField>
<#list table.columnList as c>
a.$
{
c
.name
}
AS "$
{
c
.javaFieldId
}
",
</#list>
<#list table.columnList as c>
<#if c.showType?? && c.showType == "userselect">
<#list c.javaFieldAttrs as a>
u$
{
c_index
+
1
}
.$
{
a
[
1
]}
AS "$
{
c
.simpleJavaField
}
.$
{
a
[
0
]}
",
</#list>
<#elseif c.showType?? && c.showType == "officeselect">
<#list c.javaFieldAttrs as a>
o$
{
c_index
+
1
}
.$
{
a
[
1
]}
AS "$
{
c
.simpleJavaField
}
.$
{
a
[
0
]}
",
</#list>
<#elseif c.showType?? && c.showType == "areaselect">
<#list c.javaFieldAttrs as a>
a$
{
c_index
+
1
}
.$
{
a
[
1
]}
AS "$
{
c
.simpleJavaField
}
.$
{
a
[
0
]}
",
</#list>
</#if>
<#-- 父表关联字段 -->
<#if table.parentExists && table.parentTableFk == c.name>
<#list c.javaFieldAttrs as a>
b.$
{
a
[
1
]}
AS "$
{
c
.simpleJavaField
}
.$
{
a
[
0
]}
",
</#list>
</#if>
</#list>
</#assign>
${
columnField
?
substring
(0,
columnField?last_index_of(","))
}
FROM $
{
table
.name
}
a
<#-- 关联父表 -->
<#if table.parentExists>
LEFT JOIN $
{
table
.parent.name
}
b ON b.id = a.$
{
table
.parentTableFk
}
</#if>
<#-- 关联系统表 -->
<#list table.columnList as c>
<#if c.showType?? && c.showType == "userselect">
LEFT JOIN sys_user u$
{
c_index
+
1
}
ON u$
{
c_index
+
1
}
.id = a.$
{
c
.name
}
<#elseif c.showType?? && c.showType == "officeselect">
LEFT JOIN sys_office o$
{
c_index
+
1
}
ON o$
{
c_index
+
1
}
.id = a.$
{
c
.name
}
<#elseif c.showType?? && c.showType == "areaselect">
LEFT JOIN sys_area a$
{
c_index
+
1
}
ON a$
{
c_index
+
1
}
.id = a.$
{
c
.name
}
</#if>
</#list>
<where>
<#if table.delFlagExists>a.del_flag = $
{
"#"
}{
DEL
_
FLAG
_
NORMAL
}
</#if>
<#list table.columnList as c>
<#if (c.isQuery?? && c.isQuery == "1") || (table.parentExists && table.parentTableFk == c.name)>
<#if c.queryType ?? && c.queryType == 'between'>
<if test="begin$
{
c
.simpleJavaField
?
cap_first
}
!= null and end$
{
c
.simpleJavaField
?
cap_first
}
!= null <#if c.simpleJavaField != c.javaFieldId>and begin$
{
c
.javaFieldId
?
cap_first
}
!= null and end$
{
c
.javaFieldId
?
cap_first
}
!= null </#if>and begin$
{
c
.javaFieldId
?
cap_first
}
!= '' and end$
{
c
.javaFieldId
?
cap_first
}
!= ''">
<#else>
<if test="$
{
c
.simpleJavaField
}
!= null<#if c.simpleJavaField != c.javaFieldId> and $
{
c
.javaFieldId
}
!= null</#if> and $
{
c
.javaFieldId
}
!= ''">
</#if>
<#if c.queryType ?? && c.queryType == 'between'>
AND a.$
{
c
.name
}
BETWEEN $
{
"#"
}{
begin
$
{
c
.simpleJavaField
?
cap_first
}}
AND $
{
"#"
}{
end
$
{
c
.simpleJavaField
?
cap_first
}}
<#elseif c.queryType ?? && c.queryType == 'like'>
AND a.$
{
c
.name
}
LIKE
<if test="dbName == 'oracle'">'%'||$
{
"#"
}{
$
{
c
.javaFieldId
}}
||'%'</if>
<if test="dbName == 'mssql'">'%'+$
{
"#"
}{
$
{
c
.javaFieldId
}}
+'%'</if>
<if test="dbName == 'mysql'">concat('%',$
{
"#"
}{
$
{
c
.javaFieldId
}}
,'%')</if>
<#elseif c.queryType ?? && c.queryType == 'left_like'>
AND a.$
{
c
.name
}
LIKE
<if test="dbName == 'oracle'">'%'||$
{
"#"
}{
$
{
c
.javaFieldId
}}
</if>
<if test="dbName == 'mssql'">'%'+$
{
"#"
}{
$
{
c
.javaFieldId
}}
</if>
<if test="dbName == 'mysql'">concat('%',$
{
"#"
}{
$
{
c
.javaFieldId
}}
)</if>
<#elseif c.queryType ?? && c.queryType == 'right_like'>
AND a.$
{
c
.name
}
LIKE
<if test="dbName == 'oracle'">$
{
"#"
}{
$
{
c
.javaFieldId
}}
||'%'</if>
<if test="dbName == 'mssql'">$
{
"#"
}{
$
{
c
.javaFieldId
}}
+'%'</if>
<if test="dbName == 'mysql'">concat($
{
"#"
}{
$
{
c
.javaFieldId
}}
,'%')</if>
<#else>
AND a.$
{
c
.name
}
$
{
c
.queryType
}
$
{
"#"
}{
$
{
c
.javaFieldId
}}
</#if>
</if>
</#if>
</#list>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY $
{
"$"
}{
page
.orderBy
}
</when>
<otherwise>
<#if table.parentExists>
<#if table.createDateExists>
ORDER BY a.create_date ASC
</#if>
<#else>
<#if table.updateDateExists>
ORDER BY a.update_date DESC
</#if>
</#if>
</otherwise>
</choose>
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/template/mapper.xml
0 → 100644
View file @
05beecd0
<?xml version="1.0" encoding="utf-8"?>
<template>
<name>
mapper
</name>
<filePath>
src/main/resources/mappings/${lastPackageName}/${moduleName}/${subModuleName}
</filePath>
<fileName>
${ClassName}Dao.xml
</fileName>
<content>
<![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"${packageName}.${moduleName}.dao<#if subModuleName != "
"
>
.${subModuleName}
<
/#if>.${ClassName}Dao">
<
#-- 输出字段列 -->
<sql
id=
"${className}Columns"
>
<
#assign columnField>
<
#list table.columnList as c>
a.${c.name} AS "${c.javaFieldId}",
<
/#list>
<
#list table.columnList as c>
<
#if c.showType??
&&
c.showType == "userselect">
<
#list c.javaFieldAttrs as a>
u${c_index + 1}.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
<
/#list>
<
#elseif c.showType??
&&
c.showType == "officeselect">
<
#list c.javaFieldAttrs as a>
o${c_index + 1}.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
<
/#list>
<
#elseif c.showType??
&&
c.showType == "areaselect">
<
#list c.javaFieldAttrs as a>
a${c_index + 1}.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
<
/#list>
<
/#if>
<
#-- 父表关联字段 -->
<
#if table.parentExists
&&
table.parentTableFk == c.name>
<
#list c.javaFieldAttrs as a>
b.${a[1]} AS "${c.simpleJavaField}.${a[0]}",
<
/#list>
<
/#if>
<
/#list>
<
/#assign>
${columnField?substring(0, columnField?last_index_of(","))}
</sql>
<
#-- 输出字段关联表 -->
<sql
id=
"${className}Joins"
>
<
#-- 关联父表 -->
<
#if table.parentExists>
LEFT JOIN ${table.parent.name} b ON b.id = a.${table.parentTableFk}
<
/#if>
<
#-- 关联系统表 -->
<
#list table.columnList as c>
<
#if c.showType??
&&
c.showType == "userselect">
LEFT JOIN sys_user u${c_index + 1} ON u${c_index + 1}.id = a.${c.name}
<
#elseif c.showType??
&&
c.showType == "officeselect">
LEFT JOIN sys_office o${c_index + 1} ON o${c_index + 1}.id = a.${c.name}
<
#elseif c.showType??
&&
c.showType == "areaselect">
LEFT JOIN sys_area a${c_index + 1} ON a${c_index + 1}.id = a.${c.name}
<
/#if>
<
/#list>
</sql>
<select
id=
"get"
resultType=
"${ClassName}"
>
SELECT
<include
refid=
"${className}Columns"
/>
FROM ${table.name} a
<include
refid=
"${className}Joins"
/>
WHERE a.id = ${"#"}{id}
</select>
<select
id=
"findList"
resultType=
"${ClassName}"
>
SELECT
<include
refid=
"${className}Columns"
/>
FROM ${table.name} a
<include
refid=
"${className}Joins"
/>
<where>
<
#if table.delFlagExists>a.del_flag = ${"#"}{DEL_FLAG_NORMAL}
<
/#if>
<
#list table.columnList as c>
<
#if (c.isQuery??
&&
c.isQuery == "1") || (table.parentExists
&&
table.parentTableFk == c.name)>
<
#if c.queryType ??
&&
c.queryType == 'between'>
<if
test=
"begin${c.simpleJavaField?cap_first} != null and end${c.simpleJavaField?cap_first} != null <#if c.simpleJavaField != c.javaFieldId>and begin${c.javaFieldId?cap_first} != null and end${c.javaFieldId?cap_first} != null </#if>and begin${c.javaFieldId?cap_first} != '' and end${c.javaFieldId?cap_first} != ''"
>
<
#else>
<if
test=
"${c.simpleJavaField} != null<#if c.simpleJavaField != c.javaFieldId> and ${c.javaFieldId} != null</#if> and ${c.javaFieldId} != ''"
>
<
/#if>
<
#if c.queryType ??
&&
c.queryType == 'between'>
AND a.${c.name} BETWEEN ${"#"}{begin${c.simpleJavaField?cap_first}} AND ${"#"}{end${c.simpleJavaField?cap_first}}
<
#elseif c.queryType ??
&&
c.queryType == 'like'>
AND a.${c.name} LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||${"#"}{${c.javaFieldId}}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+${"#"}{${c.javaFieldId}}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
concat('%',${"#"}{${c.javaFieldId}},'%')
</if>
<
#elseif c.queryType ??
&&
c.queryType == 'left_like'>
AND a.${c.name} LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||${"#"}{${c.javaFieldId}}
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+${"#"}{${c.javaFieldId}}
</if>
<if
test=
"dbName == 'mysql'"
>
concat('%',${"#"}{${c.javaFieldId}})
</if>
<
#elseif c.queryType ??
&&
c.queryType == 'right_like'>
AND a.${c.name} LIKE
<if
test=
"dbName == 'oracle'"
>
${"#"}{${c.javaFieldId}}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
${"#"}{${c.javaFieldId}}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
concat(${"#"}{${c.javaFieldId}},'%')
</if>
<
#else>
AND a.${c.name} ${c.queryType} ${"#"}{${c.javaFieldId}}
<
/#if>
</if>
<
/#if>
<
/#list>
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${"$"}{page.orderBy}
</when>
<otherwise>
<
#if table.parentExists>
<
#if table.createDateExists>
ORDER BY a.create_date ASC
<
/#if>
<
#else>
<
#if table.updateDateExists>
ORDER BY a.update_date DESC
<
/#if>
<
/#if>
</otherwise>
</choose>
</select>
<select
id=
"findAllList"
resultType=
"${ClassName}"
>
SELECT
<include
refid=
"${className}Columns"
/>
FROM ${table.name} a
<include
refid=
"${className}Joins"
/>
<where>
<
#if table.delFlagExists>a.del_flag = ${"#"}{DEL_FLAG_NORMAL}
<
/#if>
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${"$"}{page.orderBy}
</when>
<otherwise>
<
#if table.parentExists>
<
#if table.createDateExists>
ORDER BY a.create_date ASC
<
/#if>
<
#else>
<
#if table.updateDateExists>
ORDER BY a.update_date DESC
<
/#if>
<
/#if>
</otherwise>
</choose>
</select>
<insert
id=
"insert"
>
INSERT INTO ${table.name}(
<
#assign insertField>
<
#list table.columnList as c>
<
#if c.isInsert??
&&
c.isInsert == "1">
${c.name},
<
/#if>
<
/#list>
<
/#assign>
${insertField?substring(0, insertField?last_index_of(","))}
) VALUES (
<
#assign insertJavaField>
<
#list table.columnList as c>
<
#if c.isInsert??
&&
c.isInsert == "1">
${"#"}{${c.javaFieldId}},
<
/#if>
<
/#list>
<
/#assign>
${insertJavaField?substring(0, insertJavaField?last_index_of(","))}
)
</insert>
<update
id=
"update"
>
UPDATE ${table.name} SET
<
#assign updateField>
<
#list table.columnList as c>
<
#if c.isEdit??
&&
c.isEdit == "1">
${c.name} = ${"#"}{${c.javaFieldId}},
<
/#if>
<
/#list>
<
/#assign>
${updateField?substring(0, updateField?last_index_of(","))}
WHERE id = ${"#"}{id}
</update>
<update
id=
"delete"
>
<
#if table.delFlagExists>
UPDATE ${table.name} SET
del_flag = ${"#"}{DEL_FLAG_DELETE}
<
#else>
DELETE FROM ${table.name}
<
/#if>
<
#if table.parentExists>
<
#list table.columnList as c>
<
#if table.parentTableFk == c.name>
<choose>
<when
test=
"id !=null and id != ''"
>
WHERE id = ${"#"}{id}
</when>
<otherwise>
WHERE ${table.parentTableFk} = ${"#"}{${c.javaFieldId}}
</otherwise>
</choose>
<
/#if>
<
/#list>
<
#else>
WHERE id = ${"#"}{id}
<
/#if>
</update>
</mapper>
]]>
</content>
</template>
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/template/viewList.ftl
0 → 100644
View file @
05beecd0
<%@
page contentType="text/html;charset=UTF-8" %>
<%@
include file="/webpage/include/taglib.jsp"%>
<
html
>
<
head
>
<title>$
{
functionNameSimple
}
管理</title>
<meta name="decorator" content="default"/>
<script type="text/javascript">
$(document).ready(function()
{
<#
list
table
.columnList
as
c
>
<#
if
c
.isQuery
??
&&
c
.isQuery
==
"1"
>
<#
if
c
.showType
==
"dateselect"
&&
c
.queryType
==
"between"
>
laydate
({
elem
:
'#
begin
$
{
c
.simpleJavaField
?
cap_first
}
'
,
//目标元素。由于
laydate
.js
封装了一个轻量级的选择器引擎,因此
elem
还允许你传入
class
、
tag
但必须按照这种方式
'#
id
.class
'
event
:
'
focus
'
//响应事件。如果没有传入
event
,则按照默认的
click
})
;
laydate
({
elem
:
'#
end
$
{
c
.simpleJavaField
?
cap_first
}
'
,
//目标元素。由于
laydate
.js
封装了一个轻量级的选择器引擎,因此
elem
还允许你传入
class
、
tag
但必须按照这种方式
'#
id
.class
'
event
:
'
focus
'
//响应事件。如果没有传入
event
,则按照默认的
click
})
;
<#
elseif
c
.showType
==
"dateselect"
>
laydate
({
elem
:
'#$
{
c
.javaFieldId
}
'
,
//目标元素。由于
laydate
.js
封装了一个轻量级的选择器引擎,因此
elem
还允许你传入
class
、
tag
但必须按照这种方式
'#
id
.class
'
event
:
'
focus
'
//响应事件。如果没有传入
event
,则按照默认的
click
})
;
</#
if
>
</#
if
>
</#
list
>
}
);
function page(n,s)
{
$
(
"#pageNo"
)
.val
(
n
)
;
$
(
"#pageSize"
)
.val
(
s
)
;
$
(
"#searchForm"
)
.submit
()
;
return
false
;
}
</script>
</
head
>
<
body
>
<ul class="nav nav-tabs">
<li class="active"><a href="$
{
r
"${ctx}"
}
/$
{
urlPrefix
}
/">$
{
functionNameSimple
}
列表</a></li>
<shiro:hasPermission name="$
{
permissionPrefix
}
:edit"><li><a href="$
{
r
"${ctx}"
}
/$
{
urlPrefix
}
/form">$
{
functionNameSimple
}
添加</a></li></shiro:hasPermission>
</ul>
<div class="wrapper wrapper-content">
<sys:message content="$
{
r
"${message}"
}
"/>
<div class="row">
<div class="col-sm-12">
<div style="float:right">
<form id="searchForm" modelAttribute="$
{
className
}
" action="$
{
r
"${ctx}"
}
/$
{
urlPrefix
}
/" method="post" class="form-inline">
<input id="pageNo" name="pageNo" type="hidden" value="$
{
r
"${page.pageNo}"
}
"/>
<input id="pageSize" name="pageSize" type="hidden" value="$
{
r
"${page.pageSize}"
}
"/>
<div class="form-group">
<#list table.columnList as c>
<#if c.isQuery?? && c.isQuery == "1">
<span>$
{
c
.comments
}
:</span>
<#if c.showType == "input" || c.showType == "textarea">
<input id="$
{
c
.javaFieldId
}
" name="$
{
c
.javaFieldId
}
" type="text" <#if c.dataLength != "0"> maxlength="$
{
c
.dataLength
}
"</#if> class=" form-control input-sm"/>
<#elseif c.showType == "select">
<form:select path="$
{
c
.javaFieldId
}
" class="form-control m-b">
<form:option value="" label=""/>
<form:options items="$
{
"$"
}{
fns
:
getDictList
(
'$
{
c
.dictType
}
'
)}
" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
<#elseif c.showType == "checkbox">
<form:checkboxes path="$
{
c
.javaFieldId
}
" items="$
{
"$"
}{
fns
:
getDictList
(
'$
{
c
.dictType
}
'
)}
" itemLabel="label" itemValue="value" htmlEscape="false"/>
<#elseif c.showType == "radiobox">
<form:radiobuttons class="i-checks" path="$
{
c
.javaFieldId
}
" items="$
{
"$"
}{
fns
:
getDictList
(
'$
{
c
.dictType
}
'
)}
" itemLabel="label" itemValue="value" htmlEscape="false"/>
<#elseif c.showType == "dateselect" && c.queryType == "between">
<input id="begin$
{
c
.simpleJavaField
?
cap_first
}
" name="begin$
{
c
.simpleJavaField
?
cap_first
}
" type="text" maxlength="20" class="laydate-icon form-control layer-date input-sm"
value="<fmt:formatDate value="$
{
"$"
}{
$
{
className
}
.begin
$
{
c
.simpleJavaField
?
cap_first
}}
" pattern="yyyy-MM-dd HH:mm:ss"/>"/> -
<input id="end$
{
c
.simpleJavaField
?
cap_first
}
" name="end$
{
c
.simpleJavaField
?
cap_first
}
" type="text" maxlength="20" class="laydate-icon form-control layer-date input-sm"
value="<fmt:formatDate value="$
{
"$"
}{
$
{
className
}
.end
$
{
c
.simpleJavaField
?
cap_first
}}
" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<#elseif c.showType == "dateselect">
<input id="$
{
c
.javaFieldId
}
" name="$
{
c
.javaFieldId
}
" type="text" maxlength="20" class="laydate-icon form-control layer-date input-sm"
value="<fmt:formatDate value="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldId
}}
" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
<#elseif c.showType == "userselect">
<sys:treeselect id="$
{
c
.simpleJavaField
}
" name="$
{
c
.javaFieldId
}
" value="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldId
}}
" labelName="$
{
c
.javaFieldName
}
" labelValue="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldName
}}
"
title="用户" url="/sys/office/treeData?type=3" cssClass="form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "officeselect">
<sys:treeselect id="$
{
c
.simpleJavaField
}
" name="$
{
c
.javaFieldId
}
" value="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldId
}}
" labelName="$
{
c
.javaFieldName
}
" labelValue="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldName
}}
"
title="部门" url="/sys/office/treeData?type=2" cssClass="form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
<#elseif c.showType == "areaselect">
<sys:treeselect id="$
{
c
.simpleJavaField
}
" name="$
{
c
.javaFieldId
}
" value="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldId
}}
" labelName="$
{
c
.javaFieldName
}
" labelValue="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldName
}}
"
title="区域" url="/sys/area/treeData" cssClass="form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
</#if>
</#if>
</#list>
<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
</div>
</form>
</div>
</div>
</div>
<table id="contentTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
<thead>
<tr>
<#list table.columnList as c>
<#if c.isList?? && c.isList == "1">
<th>$
{
c
.comments
}
</th>
</#if>
</#list>
<shiro:hasPermission name="$
{
permissionPrefix
}
:edit"><th>操作</th></shiro:hasPermission>
</tr>
</thead>
<tbody>
<c:forEach items="$
{
r
"${page.list}"
}
" var="$
{
className
}
">
<tr>
<#assign firstListField = true>
<#list table.columnList as c>
<#if c.isList?? && c.isList == "1">
<td><#if firstListField><a href="$
{
r
"${ctx}"
}
/$
{
urlPrefix
}
/form?id=$
{
"${"
+
className
+
".id}"
}
"></#if>
<#if c.simpleJavaType == "Date">
<fmt:formatDate value="$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldId
}}
" pattern="yyyy-MM-dd HH:mm:ss"/>
<#elseif c.showType == "select" || c.showType == "checkbox" || c.showType == "radiobox">
$
{
"$"
}{
fns
:
getDictLabel
(
$
{
className
}
.$
{
c
.javaFieldId
},
'$
{
c
.dictType
}
'
,
''
)}
<#elseif c.showType == "userselect" || c.showType == "officeselect" || c.showType == "areaselect">
$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldName
}}
<#else>
$
{
"$"
}{
$
{
className
}
.$
{
c
.javaFieldId
}}
</#if>
<#if firstListField></a></#if></td>
<#assign firstListField = false>
</#if>
</#list>
<shiro:hasPermission name="$
{
permissionPrefix
}
:edit"><td>
<a href="$
{
r
"${ctx}"
}
/$
{
urlPrefix
}
/form?id=$
{
"${"
+
className
+
".id}"
}
" class="btn btn-info btn-xs" ><i class="fa fa-file-text-o"></i> 修改</a>
<a href="$
{
r
"${ctx}"
}
/$
{
urlPrefix
}
/delete?id=$
{
"${"
+
className
+
".id}"
}
" onclick="return confirmx('确认要删除该$
{
functionNameSimple
}
吗?', this.href)" class="btn btn-info btn-xs btn-danger"><i class="fa fa-trash"></i> 删除</a>
</td></shiro:hasPermission>
</tr>
</c:forEach>
</tbody>
</table>
$
{
r
"${page}"
}
</div>
</
body
>
</
html
>
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/util/GenUtils.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:23:01
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: GenUtils.java
package
com.jeespring.modules.gen.util
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.*
;
import
com.jeespring.common.mapper.JaxbMapper
;
import
com.jeespring.modules.gen.entity.*
;
import
com.jeespring.modules.sys.entity.*
;
import
com.jeespring.modules.sys.service.DictService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
import
java.io.*
;
import
java.util.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.*
;
public
class
GenUtils
{
public
GenUtils
()
{
}
public
static
void
initColumnField
(
GenTable
genTable
,
List
<
String
>
dictList
)
{
int
i
=
0
;
for
(
Iterator
iterator
=
genTable
.
getColumnList
().
iterator
();
iterator
.
hasNext
();)
{
GenTableColumn
column
=
(
GenTableColumn
)
iterator
.
next
();
if
(!
StringUtils
.
isNotBlank
(
column
.
getId
()))
{
if
(
StringUtils
.
isBlank
(
column
.
getComments
()))
{
column
.
setComments
(
column
.
getName
());
}
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"CHAR"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"VARCHAR"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"NARCHAR"
))
{
column
.
setJavaType
(
"String"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"BLOB"
)){
column
.
setJavaType
(
"byte[]"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"DATETIME"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"DATE"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"TIMESTAMP"
))
{
column
.
setJavaType
(
"java.util.Date"
);
column
.
setShowType
(
"dateselect"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"BIGINT"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"NUMBER"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"DECIMAL"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"INT"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"TINYINT"
))
{
String
[]
ss
=
StringUtils
.
split
(
StringUtils
.
substringBetween
(
column
.
getJdbcType
(),
"("
,
")"
),
","
);
if
(
ss
!=
null
&&
ss
.
length
==
2
&&
Integer
.
parseInt
(
ss
[
1
])
>
0
)
{
column
.
setJavaType
(
"Double"
);
}
else
if
(
ss
!=
null
&&
ss
.
length
==
1
&&
Integer
.
parseInt
(
ss
[
0
])
<=
10
)
{
column
.
setJavaType
(
"Integer"
);
}
else
{
column
.
setJavaType
(
"Long"
);
}
}
if
(
column
.
getJavaType
()==
null
||
""
.
equals
(
column
.
getJavaType
())){
column
.
setJavaType
(
"String"
);
}
column
.
setJavaField
(
StringUtils
.
toCamelCase
(
column
.
getName
()));
column
.
setIsPk
(
genTable
.
getPkList
().
contains
(
column
.
getName
())
?
"1"
:
"0"
);
if
(
column
.
getIsPk
()==
"1"
&&
column
.
getName
().
toLowerCase
().
contains
(
"id"
)){
column
.
setJavaField
(
"id"
);
}
column
.
setIsInsert
(
"1"
);
if
(!
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"id"
)
&&
!
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"create_by"
)
&&
!
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"create_date"
)
&&
!
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"del_flag"
))
{
column
.
setIsEdit
(
"1"
);
}
else
{
column
.
setIsEdit
(
"0"
);
}
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"name"
)
||
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"title"
)
||
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"remarks"
)
||
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"update_date"
))
{
column
.
setIsList
(
"1"
);
}
else
{
column
.
setIsList
(
"0"
);
}
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"name"
)
||
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"title"
))
{
column
.
setIsQuery
(
"1"
);
}
else
{
column
.
setIsQuery
(
"0"
);
}
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"name"
)
||
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"title"
))
{
column
.
setQueryType
(
"like"
);
}
else
{
column
.
setQueryType
(
"="
);
}
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"DATETIME"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"DATE"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"TIMESTAMP"
))
{
column
.
setQueryType
(
"between"
);
}
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"user_id"
))
{
column
.
setJavaType
(
User
.
class
.
getName
());
column
.
setJavaField
(
column
.
getJavaField
().
replaceAll
(
"Id"
,
".id|name"
));
column
.
setShowType
(
"userselect"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"office_id"
))
{
column
.
setJavaType
(
Office
.
class
.
getName
());
column
.
setJavaField
(
column
.
getJavaField
().
replaceAll
(
"Id"
,
".id|name"
));
column
.
setShowType
(
"officeselect"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"area_id"
))
{
column
.
setJavaType
(
Area
.
class
.
getName
());
column
.
setJavaField
(
column
.
getJavaField
().
replaceAll
(
"Id"
,
".id|name"
));
column
.
setShowType
(
"areaselect"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"create_by"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"update_by"
))
{
column
.
setJavaType
(
User
.
class
.
getName
());
column
.
setJavaField
((
new
StringBuilder
(
String
.
valueOf
(
column
.
getJavaField
()))).
append
(
".id"
).
toString
());
column
.
setShowType
(
"input"
);
}
else
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"create_date"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"update_date"
))
{
column
.
setShowType
(
"dateselect"
);
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"remarks"
)
||
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"content"
))
{
column
.
setShowType
(
"textarea"
);
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"parent_id"
))
{
column
.
setJavaType
(
"This"
);
column
.
setJavaField
(
"parent.id|name"
);
column
.
setShowType
(
"treeselect"
);
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"parent_ids"
))
{
column
.
setShowType
(
"input"
);
column
.
setQueryType
(
"like"
);
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
column
.
getName
(),
"del_flag"
))
{
column
.
setShowType
(
"radiobox"
);
column
.
setDictType
(
"del_flag"
);
}
else
{
if
(
column
.
getShowType
()==
""
||
column
.
getShowType
()==
null
)
{
column
.
setShowType
(
"input"
);
}
}
if
(
column
.
getName
().
toLowerCase
().
contains
(
"remark"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"TEXT"
)){
column
.
setShowType
(
"textarea"
);
}
if
(
genTable
.
getTableType
()!=
"2"
&&
(
column
.
getName
().
toLowerCase
().
contains
(
"remark"
)
||
StringUtils
.
startsWithIgnoreCase
(
column
.
getJdbcType
(),
"TEXT"
))){
column
.
setShowType
(
"text"
);
column
.
setQueryType
(
"like"
);
}
if
(
column
.
getName
().
toLowerCase
().
contains
(
"picture"
)){
column
.
setShowType
(
"fileselect"
);
}
if
(
StringUtils
.
startsWithIgnoreCase
(
column
.
getName
(),
"is_"
))
{
column
.
setShowType
(
"radiobox"
);
if
(
dictList
.
contains
(
"is_not"
)){
column
.
setDictType
(
"is_not"
);
}
if
(
dictList
.
contains
(
column
.
getName
())
||
dictList
.
contains
(
StringUtils
.
toCapitalizeCamelCase
(
column
.
getName
()))){
column
.
setDictType
(
column
.
getName
());
}
}
if
(
column
.
getName
().
toLowerCase
().
contains
(
"_type"
)){
column
.
setShowType
(
"select"
);
if
(
dictList
.
contains
(
column
.
getName
())
||
dictList
.
contains
(
StringUtils
.
toCapitalizeCamelCase
(
column
.
getName
()))){
column
.
setDictType
(
column
.
getName
());
}
}
if
(
column
.
getName
().
toLowerCase
().
contains
(
"_state"
)
||
"state"
.
equals
(
column
.
getName
().
toLowerCase
())){
column
.
setShowType
(
"select"
);
if
(
dictList
.
contains
(
column
.
getName
())
||
dictList
.
contains
(
StringUtils
.
toCapitalizeCamelCase
(
column
.
getName
()))){
column
.
setDictType
(
column
.
getName
());
}
}
if
(
column
.
getName
().
toLowerCase
().
contains
(
"name"
)){
column
.
setQueryType
(
"like"
);
}
if
(
"1"
.
equals
(
column
.
getAutoIncrement
())){
column
.
setIsInsert
(
"0"
);
}
if
(
i
>
0
&&
i
<=
8
){
column
.
setIsList
(
"1"
);
}
if
(
i
>
0
&&
i
<=
13
&&
!
column
.
getName
().
toLowerCase
().
contains
(
"picture"
)){
column
.
setIsQuery
(
"1"
);
}
i
++;
}
}
}
public
static
String
getTemplatePath
()
{
try
{
File
file
=
(
new
DefaultResourceLoader
()).
getResource
(
""
).
getFile
();
if
(
file
!=
null
)
{
return
(
new
StringBuilder
(
String
.
valueOf
(
file
.
getAbsolutePath
()))).
append
(
File
.
separator
).
append
(
StringUtils
.
replaceEach
(
GenUtils
.
class
.
getName
(),
new
String
[]{
(
new
StringBuilder
(
"util."
)).
append
(
GenUtils
.
class
.
getSimpleName
()).
toString
(),
"."
},
new
String
[]{
"template"
,
File
.
separator
})).
toString
();
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"{}"
,
e
);
}
return
""
;
}
public
static
Object
fileToObject
(
String
fileName
,
Class
clazz
)
{
try
{
String
pathName
=
(
new
StringBuilder
(
"/templates/modules/gen/"
)).
append
(
fileName
).
toString
();
Resource
resource
=
new
ClassPathResource
(
pathName
);
InputStream
is
=
resource
.
getInputStream
();
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
"UTF-8"
));
StringBuilder
sb
=
new
StringBuilder
();
do
{
String
line
=
br
.
readLine
();
if
(
line
==
null
)
{
break
;
}
sb
.
append
(
line
).
append
(
"\r\n"
);
}
while
(
true
);
if
(
is
!=
null
)
{
is
.
close
();
}
if
(
br
!=
null
)
{
br
.
close
();
}
return
JaxbMapper
.
fromXml
(
sb
.
toString
(),
clazz
);
}
catch
(
IOException
e
)
{
logger
.
warn
(
"Error file convert: {}"
,
e
.
getMessage
());
}
return
null
;
}
public
static
GenConfig
getConfig
()
{
return
(
GenConfig
)
fileToObject
(
"config.xml"
,
GenConfig
.
class
);
}
public
static
List
getTemplateList
(
GenConfig
config
,
String
category
,
boolean
isChildTable
)
{
List
templateList
=
Lists
.
newArrayList
();
if
(
config
!=
null
&&
config
.
getCategoryList
()
!=
null
&&
category
!=
null
)
{
for
(
Iterator
iterator
=
config
.
getCategoryList
().
iterator
();
iterator
.
hasNext
();)
{
GenCategory
e
=
(
GenCategory
)
iterator
.
next
();
if
(
category
.
equals
(
e
.
getValue
()))
{
List
list
=
null
;
if
(!
isChildTable
)
{
list
=
e
.
getTemplate
();
}
else
{
list
=
e
.
getChildTableTemplate
();
}
if
(
list
!=
null
)
{
for
(
Iterator
iterator1
=
list
.
iterator
();
iterator1
.
hasNext
();)
{
String
s
=
(
String
)
iterator1
.
next
();
if
(
StringUtils
.
startsWith
(
s
,
GenCategory
.
CATEGORY_REF
))
{
templateList
.
addAll
(
getTemplateList
(
config
,
StringUtils
.
replace
(
s
,
GenCategory
.
CATEGORY_REF
,
""
),
false
));
}
else
{
GenTemplate
template
=
(
GenTemplate
)
fileToObject
(
s
,
GenTemplate
.
class
);
if
(
template
!=
null
)
{
templateList
.
add
(
template
);
}
}
}
}
break
;
}
}
}
return
templateList
;
}
public
static
Map
getDataModel
(
GenScheme
genScheme
)
{
Map
model
=
Maps
.
newHashMap
();
model
.
put
(
"packageName"
,
StringUtils
.
lowerCase
(
genScheme
.
getPackageName
()));
model
.
put
(
"lastPackageName"
,
StringUtils
.
substringAfterLast
((
String
)
model
.
get
(
"packageName"
),
"."
));
model
.
put
(
"moduleName"
,
StringUtils
.
lowerCase
(
genScheme
.
getModuleName
()));
model
.
put
(
"subModuleName"
,
StringUtils
.
lowerCase
(
genScheme
.
getSubModuleName
()));
model
.
put
(
"className"
,
StringUtils
.
uncapitalize
(
genScheme
.
getGenTable
().
getClassName
()));
model
.
put
(
"ClassName"
,
StringUtils
.
capitalize
(
genScheme
.
getGenTable
().
getClassName
()));
model
.
put
(
"functionName"
,
genScheme
.
getFunctionName
());
model
.
put
(
"functionNameSimple"
,
genScheme
.
getFunctionNameSimple
());
model
.
put
(
"functionAuthor"
,
StringUtils
.
isNotBlank
(
genScheme
.
getFunctionAuthor
())
?
genScheme
.
getFunctionAuthor
()
:
UserUtils
.
getUser
().
getName
());
model
.
put
(
"functionVersion"
,
DateUtils
.
getDate
());
model
.
put
(
"urlPrefix"
,
(
new
StringBuilder
()).
append
(
model
.
get
(
"moduleName"
)).
append
(
StringUtils
.
isNotBlank
(
genScheme
.
getSubModuleName
())
?
(
new
StringBuilder
(
"/"
)).
append
(
StringUtils
.
lowerCase
(
genScheme
.
getSubModuleName
())).
toString
()
:
""
).
append
(
"/"
).
append
(
model
.
get
(
"className"
)).
toString
());
model
.
put
(
"viewPrefix"
,
model
.
get
(
"urlPrefix"
));
model
.
put
(
"permissionPrefix"
,
(
new
StringBuilder
()).
append
(
model
.
get
(
"moduleName"
)).
append
(
StringUtils
.
isNotBlank
(
genScheme
.
getSubModuleName
())
?
(
new
StringBuilder
(
":"
)).
append
(
StringUtils
.
lowerCase
(
genScheme
.
getSubModuleName
())).
toString
()
:
""
).
append
(
":"
).
append
(
model
.
get
(
"className"
)).
toString
());
model
.
put
(
"dbType"
,
Global
.
getConfig
(
"jdbc.type"
));
model
.
put
(
"table"
,
genScheme
.
getGenTable
());
return
model
;
}
public
static
String
generateToFile
(
GenTemplate
tpl
,
Map
model
,
boolean
isReplaceFile
)
{
String
fileName
=
Global
.
getProjectPath
()
+
File
.
separator
+
StringUtils
.
replaceEach
(
FreeMarkers
.
renderString
(
tpl
.
getFileName
(),
new
StringBuilder
(
String
.
valueOf
(
tpl
.
getFilePath
())).
append
(
"/"
).
toString
(),
model
),
new
String
[]
{
"//"
,
"/"
,
".."
,
"."
},
new
String
[]
{
File
.
separator
,
File
.
separator
,
"__"
,
File
.
separator
}).
replace
(
"__"
,
".."
)
+
FreeMarkers
.
renderString
(
tpl
.
getFileName
(),
tpl
.
getFileName
(),
model
);
logger
.
debug
(
" fileName === "
+
fileName
);
String
content
=
FreeMarkers
.
renderString
(
tpl
.
getFileName
(),
StringUtils
.
trimToEmpty
(
tpl
.
getContent
()),
model
);
logger
.
debug
(
" content === \r\n"
+
content
);
if
(
isReplaceFile
)
{
FileUtils
.
deleteFile
(
fileName
);
}
if
(
FileUtils
.
createFile
(
fileName
))
{
FileUtils
.
writeToFile
(
fileName
,
content
,
true
);
logger
.
debug
(
" file create === "
+
fileName
);
return
"生成成功:"
+
fileName
+
"<br/>"
;
}
logger
.
debug
(
" file extents === "
+
fileName
);
return
"文件已存在:"
+
fileName
+
"<br/>"
;
}
/*public static void main(String[] args)
{
try
{
GenConfig config = getConfig();
System.out.println(config);
System.out.println(JaxbMapper.toXml(config));
}
catch(Exception e)
{
e.printStackTrace();
}
}*/
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
GenUtils
.
class
);
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/web/CgAutoListController.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:22:29
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: CgAutoListController.java
package
com.jeespring.modules.gen.web
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.gen.entity.GenScheme
;
import
com.jeespring.modules.gen.service.*
;
import
com.jeespring.modules.gen.template.FreemarkerHelper
;
import
com.jeespring.modules.gen.util.GenUtils
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.ModelAndView
;
@Controller
@RequestMapping
(
value
={
"${adminPath}/gen/cgAutoList"
})
public
class
CgAutoListController
extends
AbstractBaseController
{
public
CgAutoListController
()
{
}
@ModelAttribute
public
GenScheme
get
(
@RequestParam
(
required
=
true
)
String
id
)
{
if
(
StringUtils
.
isNotBlank
(
id
))
{
return
genSchemeService
.
get
(
id
);
}
else
{
return
new
GenScheme
();
}
}
@RequestMapping
(
value
={
"list"
})
public
void
list
(
GenScheme
genScheme
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
long
start
=
System
.
currentTimeMillis
();
FreemarkerHelper
viewEngine
=
new
FreemarkerHelper
();
Map
model
=
GenUtils
.
getDataModel
(
genScheme
);
String
html
=
cgAutoListService
.
generateCode
(
genScheme
);
String
findListSql
=
cgAutoListService
.
generateListCode
(
genScheme
);
try
{
response
.
setContentType
(
"text/html"
);
response
.
setHeader
(
"Cache-Control"
,
"no-store"
);
PrintWriter
writer
=
response
.
getWriter
();
writer
.
println
(
html
);
writer
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
long
end
=
System
.
currentTimeMillis
();
log
.
debug
(
"动态列表生成耗时:"
+
(
end
-
start
)
+
" ms"
);
}
@RequestMapping
(
value
={
"test"
,
""
})
public
ModelAndView
list
(
GenScheme
genScheme
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
new
ModelAndView
(
"com/jeespring/modules/gen/template/viewList"
);
}
private
static
Logger
log
=
Logger
.
getLogger
(
CgAutoListController
.
class
);
@Autowired
private
GenSchemeService
genSchemeService
;
@Autowired
private
GenTableService
genTableService
;
@Autowired
private
CgAutoListService
cgAutoListService
;
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/web/GenSchemeController.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:22:40
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: GenSchemeController.java
package
com.jeespring.modules.gen.web
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.gen.entity.GenScheme
;
import
com.jeespring.modules.gen.service.GenSchemeService
;
import
com.jeespring.modules.gen.service.GenTableService
;
import
com.jeespring.modules.gen.util.GenUtils
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.service.SysConfigService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
@Controller
@RequestMapping
(
value
={
"${adminPath}/gen/genScheme"
})
public
class
GenSchemeController
extends
AbstractBaseController
{
@Autowired
private
SysConfigService
sysConfigService
;
public
GenSchemeController
()
{
}
@ModelAttribute
public
GenScheme
get
(
@RequestParam
(
required
=
true
)
String
id
)
{
if
(
StringUtils
.
isNotBlank
(
id
))
{
return
genSchemeService
.
get
(
id
);
}
else
{
return
new
GenScheme
();
}
}
@RequiresPermissions
(
value
={
"gen:genScheme:view"
})
@RequestMapping
(
value
={
"list"
,
""
})
public
String
list
(
GenScheme
genScheme
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
User
user
=
UserUtils
.
getUser
();
if
(!
user
.
isAdmin
())
{
genScheme
.
setCreateBy
(
user
);
}
Page
page
=
genSchemeService
.
find
(
new
Page
(
request
,
response
),
genScheme
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/gen/genSchemeList"
;
}
@RequiresPermissions
(
value
={
"gen:genScheme:view"
})
@RequestMapping
(
value
={
"form"
})
public
String
form
(
GenScheme
genScheme
,
Model
model
)
{
if
(
StringUtils
.
isBlank
(
genScheme
.
getPackageName
()))
{
genScheme
.
setPackageName
(
"com.jeespring.modules"
);
}
model
.
addAttribute
(
"genScheme"
,
genScheme
);
model
.
addAttribute
(
"config"
,
GenUtils
.
getConfig
());
model
.
addAttribute
(
"tableList"
,
genTableService
.
findAll
());
return
"modules/gen/genSchemeForm"
;
}
@RequiresPermissions
(
value
={
"gen:genScheme:edit"
})
@RequestMapping
(
value
={
"save"
})
public
String
save
(
GenScheme
genScheme
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genScheme/"
;
}
if
(!
beanValidator
(
model
,
genScheme
))
{
return
form
(
genScheme
,
model
);
}
else
{
String
result
=
genSchemeService
.
save
(
genScheme
);
addMessage
(
redirectAttributes
,
"操作生成方案'"
+
genScheme
.
getName
()
+
"'成功<br/>"
+
result
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genScheme/?repage"
;
}
}
@RequiresPermissions
(
value
={
"gen:genScheme:edit"
})
@RequestMapping
(
value
={
"delete"
})
public
String
delete
(
GenScheme
genScheme
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTemplate/"
;
}
this
.
genSchemeService
.
delete
(
genScheme
);
addMessage
(
redirectAttributes
,
"删除生成方案成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genScheme/?repage"
;
}
@Autowired
private
GenSchemeService
genSchemeService
;
@Autowired
private
GenTableService
genTableService
;
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/web/GenTableController.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:22:45
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: GenTableController.java
package
com.jeespring.modules.gen.web
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.gen.entity.*
;
import
com.jeespring.modules.gen.service.GenSchemeService
;
import
com.jeespring.modules.gen.service.GenTableService
;
import
com.jeespring.modules.gen.util.GenUtils
;
import
com.jeespring.modules.sys.entity.Menu
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.service.SysConfigService
;
import
com.jeespring.modules.sys.service.SystemService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
import
java.util.Iterator
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
@Controller
@RequestMapping
(
value
={
"${adminPath}/gen/genTable"
})
public
class
GenTableController
extends
AbstractBaseController
{
@Autowired
private
SystemService
systemService
;
@Autowired
private
SysConfigService
sysConfigService
;
public
GenTableController
()
{
}
public
GenTable
get
(
GenTable
genTable
)
{
if
(
StringUtils
.
isNotBlank
(
genTable
.
getId
()))
{
return
genTableService
.
get
(
genTable
.
getId
());
}
else
{
return
genTable
;
}
}
@RequiresPermissions
(
value
={
"gen:genTable:list"
})
@RequestMapping
(
value
={
"list"
,
""
})
public
String
list
(
GenTable
genTable
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
genTable
=
get
(
genTable
);
User
user
=
UserUtils
.
getUser
();
if
(!
user
.
isAdmin
())
{
genTable
.
setCreateBy
(
user
);
}
Page
page
=
genTableService
.
find
(
new
Page
(
request
,
response
),
genTable
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/gen/genTableList"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:view"
,
"gen:genTable:add"
,
"gen:genTable:edit"
},
logical
=
org
.
apache
.
shiro
.
authz
.
annotation
.
Logical
.
OR
)
@RequestMapping
(
value
={
"form"
})
public
String
form
(
GenTable
genTable
,
Model
model
)
{
genTable
=
get
(
genTable
);
model
.
addAttribute
(
"genTable"
,
genTable
);
model
.
addAttribute
(
"config"
,
GenUtils
.
getConfig
());
model
.
addAttribute
(
"tableList"
,
genTableService
.
findAll
());
return
"modules/gen/genTableForm"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:add"
,
"gen:genTable:edit"
},
logical
=
org
.
apache
.
shiro
.
authz
.
annotation
.
Logical
.
OR
)
@RequestMapping
(
value
={
"save"
})
public
String
save
(
GenTable
genTable
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTable/"
;
}
if
(!
beanValidator
(
model
,
genTable
))
{
return
form
(
genTable
,
model
);
}
if
((
StringUtils
.
isBlank
(
genTable
.
getId
()))
&&
(!
this
.
genTableService
.
checkTableName
(
genTable
.
getName
())))
{
addMessage
(
redirectAttributes
,
"添加失败!"
+
genTable
.
getName
()
+
" 记录已存在!"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
if
((
StringUtils
.
isBlank
(
genTable
.
getId
()))
&&
(!
this
.
genTableService
.
checkTableNameFromDB
(
genTable
.
getName
())))
{
addMessage
(
redirectAttributes
,
"添加失败!"
+
genTable
.
getName
()
+
"表已经在数据库中存在,请从数据库导入表单!"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
this
.
genTableService
.
save
(
genTable
);
addMessage
(
redirectAttributes
,
"保存业务表'"
+
genTable
.
getName
()
+
"'成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:importDb"
})
@RequestMapping
(
value
={
"importTableFromDB"
})
public
String
importTableFromDB
(
GenTable
genTable
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
genTable
=
get
(
genTable
);
if
(!
StringUtils
.
isBlank
(
genTable
.
getName
()))
{
if
(!
this
.
genTableService
.
checkTableName
(
genTable
.
getName
()))
{
addMessage
(
redirectAttributes
,
"下一步失败!"
+
genTable
.
getName
()
+
" 表已经添加!"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
genTable
=
this
.
genTableService
.
getTableFormDb
(
genTable
);
genTable
.
setTableType
(
"0"
);
this
.
genTableService
.
saveFromDB
(
genTable
);
addMessage
(
redirectAttributes
,
"数据库导入表单'"
+
genTable
.
getName
()
+
"'成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
List
<
GenTable
>
tableList
=
this
.
genTableService
.
findTableListFormDb
(
new
GenTable
());
model
.
addAttribute
(
"tableList"
,
tableList
);
model
.
addAttribute
(
"config"
,
GenUtils
.
getConfig
());
return
"modules/gen/importTableFromDB"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:del"
})
@RequestMapping
(
value
={
"delete"
})
public
String
delete
(
GenTable
genTable
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()
){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTable/"
;
}
genTable
=
get
(
genTable
);
this
.
genTableService
.
delete
(
genTable
);
this
.
genSchemeService
.
delete
(
this
.
genSchemeService
.
findUniqueByProperty
(
"gen_table_id"
,
genTable
.
getId
()));
addMessage
(
redirectAttributes
,
"移除业务表记录成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:del"
})
@RequestMapping
(
value
={
"deleteDb"
})
public
String
deleteDb
(
GenTable
genTable
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTable/"
;
}
genTable
=
get
(
genTable
);
this
.
genTableService
.
delete
(
genTable
);
this
.
genSchemeService
.
delete
(
this
.
genSchemeService
.
findUniqueByProperty
(
"gen_table_id"
,
genTable
.
getId
()));
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
"drop table if exists "
+
genTable
.
getName
()
+
" ;"
);
this
.
genTableService
.
buildTable
(
sql
.
toString
());
addMessage
(
redirectAttributes
,
"删除业务表记录和数据库表成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:del"
})
@RequestMapping
(
value
={
"deleteAll"
})
public
String
deleteAll
(
String
ids
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTable/"
;
}
String
[]
idArray
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
)
{
this
.
genTableService
.
delete
(
this
.
genTableService
.
get
(
id
));
}
addMessage
(
redirectAttributes
,
"删除业务表成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:synchDb"
})
@RequestMapping
(
value
={
"synchDb"
})
public
String
synchDb
(
GenTable
genTable
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTable/"
;
}
genTable
=
get
(
genTable
);
StringBuffer
sql
=
new
StringBuffer
();
List
getTableColumnList
=
genTable
.
getColumnList
();
sql
.
append
((
new
StringBuilder
(
"drop table if exists "
)).
append
(
genTable
.
getName
()).
append
(
" ;"
).
toString
());
genTableService
.
buildTable
(
sql
.
toString
());
sql
=
new
StringBuffer
();
sql
.
append
((
new
StringBuilder
(
"create table "
)).
append
(
genTable
.
getName
()).
append
(
" ("
).
toString
());
String
pk
=
""
;
for
(
Iterator
iterator
=
getTableColumnList
.
iterator
();
iterator
.
hasNext
();)
{
GenTableColumn
column
=
(
GenTableColumn
)
iterator
.
next
();
if
(
"1"
.
equals
(
column
.
getIsPk
()))
{
sql
.
append
((
new
StringBuilder
(
" "
)).
append
(
column
.
getName
()).
append
(
" "
).
append
(
column
.
getJdbcType
()).
append
(
" comment '"
).
append
(
column
.
getComments
()).
append
(
"',"
).
toString
());
pk
=
(
new
StringBuilder
(
String
.
valueOf
(
pk
))).
append
(
column
.
getName
()).
append
(
","
).
toString
();
}
else
{
sql
.
append
((
new
StringBuilder
(
" "
)).
append
(
column
.
getName
()).
append
(
" "
).
append
(
column
.
getJdbcType
()).
append
(
" comment '"
).
append
(
column
.
getComments
()).
append
(
"',"
).
toString
());
}
}
sql
.
append
(
"primary key ("
+
pk
.
substring
(
0
,
pk
.
length
()
-
1
)
+
") "
);
sql
.
append
(
") comment '"
+
genTable
.
getComments
()
+
"'"
);
this
.
genTableService
.
buildTable
(
sql
.
toString
());
this
.
genTableService
.
syncSave
(
genTable
);
addMessage
(
redirectAttributes
,
"强制同步数据库表成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
@RequiresPermissions
(
value
={
"gen:genTable:genCode"
})
@RequestMapping
(
value
={
"genCodeForm"
})
public
String
genCodeForm
(
GenScheme
genScheme
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(
StringUtils
.
isBlank
(
genScheme
.
getPackageName
()))
{
genScheme
.
setPackageName
(
"com.company.project.modules"
);
}
GenScheme
oldGenScheme
=
genSchemeService
.
findUniqueByProperty
(
"gen_table_id"
,
genScheme
.
getGenTable
().
getId
());
if
(
oldGenScheme
!=
null
)
{
genScheme
=
oldGenScheme
;
}
model
.
addAttribute
(
"genScheme"
,
genScheme
);
model
.
addAttribute
(
"config"
,
GenUtils
.
getConfig
());
model
.
addAttribute
(
"tableList"
,
genTableService
.
findAll
());
return
"modules/gen/genCodeForm"
;
}
@RequestMapping
(
value
={
"genCode"
})
public
String
genCode
(
GenScheme
genScheme
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
genScheme
.
setGenTable
(
genTableService
.
get
(
genScheme
.
getGenTable
().
getId
()));
if
(
sysConfigService
.
isDemoMode
()){
String
msg
=
"<br>"
+
genScheme
.
getGenTable
().
getName
()
+
"代码和菜单、接口已生成成功;<br/>如果启用redis:代码生成后,要退出,再登陆。<br/>菜单路径:<br/>"
+
"接口路径:"
+
"rest/list或者get或者save或者delete<br/>..."
;
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
()+
msg
);
return
"redirect:"
+
adminPath
+
"/gen/genTable/"
;
}
String
href
=
""
;
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
href
=
"/"
+
genScheme
.
getModuleName
()+
"/"
+
genScheme
.
getSubModuleName
()+
"/"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
());
}
else
{
href
=
"/"
+
genScheme
.
getModuleName
()+
"/"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
());
}
if
(
"tree"
.
equals
(
genScheme
.
getCategory
())){
href
=
href
+
"Tree"
;
}
genMenu
(
genScheme
,
href
);
String
result
=
this
.
genSchemeService
.
save
(
genScheme
);
addMessage
(
redirectAttributes
,
genScheme
.
getGenTable
().
getName
()
+
"代码和菜单、接口已生成成功;<br/>如果启用redis:代码生成后,要退出,再登陆。<br/>菜单路径:"
+
href
+
"<br/>"
+
"接口路径:"
+
"rest/"
+
href
+
"/list或者get或者save或者delete<br/>"
+
result
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTable/?repage"
;
}
public
void
genMenu
(
GenScheme
genScheme
,
String
href
){
String
paraentId
=
"158586ffb6b44175885680d1c93f05bd"
;
Menu
menu
=
new
Menu
();
List
<
Menu
>
menus
=
systemService
.
findAllMenu
();
for
(
Menu
menuItem:
menus
)
{
if
(
href
.
equals
(
menuItem
.
getHref
())){
return
;
}
}
menu
.
setHref
(
href
);
menu
.
setName
(
genScheme
.
getFunctionName
());
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menu
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":list"
);
}
else
{
menu
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":list"
);
}
menu
.
setSort
(
30
);
menu
.
setIsShow
(
"1"
);
menu
.
setDelFlag
(
"0"
);
Menu
parent
=
new
Menu
();
parent
.
setId
(
paraentId
);
parent
.
setName
(
"生成模块"
);
menu
.
setParent
(
parent
);
systemService
.
saveMenu
(
menu
);
//View
Menu
menuView
=
new
Menu
();
menuView
.
setName
(
"查看"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuView
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuView
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuView
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":view"
);
}
else
{
menuView
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":view"
);
}
menuView
.
setSort
(
30
);
menuView
.
setIsShow
(
"1"
);
menuView
.
setDelFlag
(
"0"
);
menuView
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuView
);
//edit
Menu
menuEdit
=
new
Menu
();
menuEdit
.
setName
(
"编辑"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuEdit
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuEdit
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuEdit
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":edit"
);
}
else
{
menuEdit
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":edit"
);
}
menuEdit
.
setSort
(
60
);
menuEdit
.
setIsShow
(
"1"
);
menuEdit
.
setDelFlag
(
"0"
);
menuEdit
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuEdit
);
//add
Menu
menuAdd
=
new
Menu
();
menuAdd
.
setName
(
"添加"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuAdd
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuAdd
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuAdd
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":add"
);
}
else
{
menuAdd
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":add"
);
}
menuAdd
.
setSort
(
90
);
menuAdd
.
setIsShow
(
"1"
);
menuAdd
.
setDelFlag
(
"0"
);
menuAdd
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuAdd
);
//del
Menu
menuDel
=
new
Menu
();
menuDel
.
setName
(
"删除"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuDel
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuDel
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuDel
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":del"
);
}
else
{
menuDel
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":del"
);
}
menuDel
.
setSort
(
120
);
menuDel
.
setIsShow
(
"1"
);
menuDel
.
setDelFlag
(
"0"
);
menuDel
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuDel
);
//export
Menu
menuExport
=
new
Menu
();
menuExport
.
setName
(
"导出"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuExport
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuExport
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuExport
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":export"
);
}
else
{
menuExport
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":export"
);
}
menuExport
.
setSort
(
150
);
menuExport
.
setIsShow
(
"1"
);
menuExport
.
setDelFlag
(
"0"
);
menuExport
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuExport
);
//import
Menu
menuImport
=
new
Menu
();
menuImport
.
setName
(
"导入"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuImport
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuImport
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuImport
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":import"
);
}
else
{
menuImport
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":import"
);
}
menuImport
.
setSort
(
180
);
menuImport
.
setIsShow
(
"1"
);
menuImport
.
setDelFlag
(
"0"
);
menuImport
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuImport
);
//total
Menu
menuTotal
=
new
Menu
();
menuTotal
.
setName
(
"统计"
);
for
(
Menu
menuItem:
menus
)
{
if
((
menuTotal
.
getName
().
equals
(
menuItem
.
getName
())
||
menuItem
.
getName
().
contains
(
genScheme
.
getFunctionName
()))
&&
menuItem
.
getParentId
().
equals
(
menu
.
getParentId
())){
menuTotal
=
menuItem
;
}
}
if
(
genScheme
.
getSubModuleName
()!=
null
&&
genScheme
.
getSubModuleName
().
length
()>
0
){
menuTotal
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
genScheme
.
getSubModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":total"
);
}
else
{
menuTotal
.
setPermission
(
genScheme
.
getModuleName
()+
":"
+
StringUtils
.
toCamelCase
(
genScheme
.
getGenTable
().
getName
())+
":total"
);
}
menuTotal
.
setSort
(
210
);
menuTotal
.
setIsShow
(
"1"
);
menuTotal
.
setDelFlag
(
"0"
);
menuTotal
.
setParent
(
menu
);
systemService
.
saveMenu
(
menuTotal
);
}
@Autowired
private
GenTableService
genTableService
;
@Autowired
private
GenSchemeService
genSchemeService
;
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/gen/web/GenTemplateController.java
0 → 100644
View file @
05beecd0
// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2017/5/31 16:22:52
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: GenTemplateController.java
package
com.jeespring.modules.gen.web
;
import
com.jeespring.common.config.Global
;
import
com.jeespring.common.utils.StringUtils
;
import
com.jeespring.common.persistence.Page
;
import
com.jeespring.common.web.AbstractBaseController
;
import
com.jeespring.modules.gen.entity.GenTemplate
;
import
com.jeespring.modules.gen.service.GenTemplateService
;
import
com.jeespring.modules.sys.entity.User
;
import
com.jeespring.modules.sys.service.SysConfigService
;
import
com.jeespring.modules.sys.utils.UserUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
@Controller
@RequestMapping
(
value
={
"${adminPath}/gen/genTemplate"
})
public
class
GenTemplateController
extends
AbstractBaseController
{
@Autowired
private
SysConfigService
sysConfigService
;
public
GenTemplateController
()
{
}
@ModelAttribute
public
GenTemplate
get
(
@RequestParam
(
required
=
true
)
String
id
)
{
if
(
StringUtils
.
isNotBlank
(
id
))
{
return
genTemplateService
.
get
(
id
);
}
else
{
return
new
GenTemplate
();
}
}
@RequiresPermissions
(
value
={
"gen:genTemplate:view"
})
@RequestMapping
(
value
={
"list"
,
""
})
public
String
list
(
GenTemplate
genTemplate
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
User
user
=
UserUtils
.
getUser
();
if
(!
user
.
isAdmin
())
{
genTemplate
.
setCreateBy
(
user
);
}
Page
page
=
genTemplateService
.
find
(
new
Page
(
request
,
response
),
genTemplate
);
model
.
addAttribute
(
"page"
,
page
);
return
"modules/gen/genTemplateList"
;
}
@RequiresPermissions
(
value
={
"gen:genTemplate:view"
})
@RequestMapping
(
value
={
"form"
})
public
String
form
(
GenTemplate
genTemplate
,
Model
model
)
{
model
.
addAttribute
(
"genTemplate"
,
genTemplate
);
return
"modules/gen/genTemplateForm"
;
}
@RequiresPermissions
(
value
={
"gen:genTemplate:edit"
})
@RequestMapping
(
value
={
"save"
})
public
String
save
(
GenTemplate
genTemplate
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTemplate/"
;
}
if
(!
beanValidator
(
model
,
genTemplate
))
{
return
form
(
genTemplate
,
model
);
}
this
.
genTemplateService
.
save
(
genTemplate
);
addMessage
(
redirectAttributes
,
"保存代码模板'"
+
genTemplate
.
getName
()
+
"'成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTemplate/?repage"
;
}
@RequiresPermissions
(
value
={
"gen:genTemplate:edit"
})
@RequestMapping
(
value
={
"delete"
})
public
String
delete
(
GenTemplate
genTemplate
,
RedirectAttributes
redirectAttributes
)
{
if
(
sysConfigService
.
isDemoMode
()){
addMessage
(
redirectAttributes
,
sysConfigService
.
isDemoModeDescription
());
return
"redirect:"
+
adminPath
+
"/gen/genTemplate/"
;
}
this
.
genTemplateService
.
delete
(
genTemplate
);
addMessage
(
redirectAttributes
,
"删除代码模板成功"
);
return
"redirect:"
+
this
.
adminPath
+
"/gen/genTemplate/?repage"
;
}
@Autowired
private
GenTemplateService
genTemplateService
;
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/dao/ChatHistoryDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.dao
;
import
java.util.List
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.iim.entity.ChatHistory
;
/**
* 聊天记录DAO接口
* * * * @author 黄炳桂 516821420@qq.com
* @version 2015-12-29
*/
@Mapper
public
interface
ChatHistoryDao
extends
InterfaceBaseDao
<
ChatHistory
>
{
/**
* 查询列表数据
* @param entity
* @return
*/
List
<
ChatHistory
>
findLogList
(
ChatHistory
entity
);
int
findUnReadCount
(
ChatHistory
chatHistory
);
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/dao/MailBoxDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.iim.entity.MailBox
;
/**
* 发件箱DAO接口
* * * * @author 黄炳桂 516821420@qq.com
* @version 2015-11-15
*/
@Mapper
public
interface
MailBoxDao
extends
InterfaceBaseDao
<
MailBox
>
{
int
getCount
(
MailBox
entity
);
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/dao/MailComposeDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.iim.entity.MailCompose
;
/**
* 发件箱DAO接口
* * * * @author 黄炳桂 516821420@qq.com
* @version 2015-11-15
*/
@Mapper
public
interface
MailComposeDao
extends
InterfaceBaseDao
<
MailCompose
>
{
int
getCount
(
MailCompose
entity
);
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/dao/MailDao.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.jeespring.modules.iim.entity.Mail
;
/**
* 发件箱DAO接口
* * * * @author 黄炳桂 516821420@qq.com
* @version 2015-11-15
*/
@Mapper
public
interface
MailDao
extends
InterfaceBaseDao
<
Mail
>
{
int
getCount
(
MailDao
entity
);
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/dao/MyCalendarDao.java
0 → 100644
View file @
05beecd0
/**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package
com.jeespring.modules.iim.dao
;
import
com.jeespring.common.persistence.InterfaceBaseDao
;
import
com.jeespring.modules.iim.entity.MyCalendar
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 日历DAO接口
* @author JeeSpring
* @version 2016-04-19
*/
@Mapper
public
interface
MyCalendarDao
extends
InterfaceBaseDao
<
MyCalendar
>
{
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/entity/ChatHistory.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.entity
;
import
org.hibernate.validator.constraints.Length
;
import
com.jeespring.common.utils.excel.annotation.ExcelField
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
/**
* 聊天记录Entity
* @author 黄炳桂 516821420@qq.com
* @version 2015-12-29
*/
public
class
ChatHistory
extends
AbstractBaseEntity
<
ChatHistory
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
userid1
;
// userid1 发送者id
private
String
userid2
;
// userid2 接收者id
private
String
msg
;
// msg
private
String
status
;
// status
public
ChatHistory
()
{
super
();
}
public
ChatHistory
(
String
id
){
super
(
id
);
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"userid1长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"userid1"
,
align
=
2
,
sort
=
1
)
public
String
getUserid1
()
{
return
userid1
;
}
public
void
setUserid1
(
String
userid1
)
{
this
.
userid1
=
userid1
;
}
@Length
(
min
=
0
,
max
=
64
,
message
=
"userid2长度必须介于 0 和 64 之间"
)
@ExcelField
(
title
=
"userid2"
,
align
=
2
,
sort
=
2
)
public
String
getUserid2
()
{
return
userid2
;
}
public
void
setUserid2
(
String
userid2
)
{
this
.
userid2
=
userid2
;
}
@Length
(
min
=
0
,
max
=
1024
,
message
=
"msg长度必须介于 0 和 1024 之间"
)
@ExcelField
(
title
=
"msg"
,
align
=
2
,
sort
=
3
)
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
@Length
(
min
=
0
,
max
=
45
,
message
=
"status长度必须介于 0 和 45 之间"
)
@ExcelField
(
title
=
"status"
,
align
=
2
,
sort
=
4
)
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/entity/Friend.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.iim.entity
;
public
class
Friend
{
private
String
id
;
private
String
name
;
private
String
face
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
void
setFace
(
String
face
)
{
this
.
face
=
face
;
}
public
String
getFace
()
{
return
face
;
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/entity/Group.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.iim.entity
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Group
{
private
String
name
;
private
int
nums
;
private
int
id
;
private
List
<
Friend
>
item
=
new
ArrayList
();
public
void
setItem
(
List
item
)
{
this
.
item
=
item
;
}
public
List
getItem
()
{
return
item
;
}
public
void
setNums
(
int
nums
)
{
this
.
nums
=
nums
;
}
public
int
getNums
()
{
return
nums
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getId
()
{
return
id
;
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/entity/LayJson.java
0 → 100644
View file @
05beecd0
package
com.jeespring.modules.iim.entity
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LayJson
{
private
int
status
;
private
String
msg
;
private
List
<
Group
>
data
=
new
ArrayList
();
public
void
setData
(
List
<
Group
>
data
)
{
this
.
data
=
data
;
}
public
List
<
Group
>
getData
()
{
return
data
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
int
getStatus
()
{
return
status
;
}
}
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/iim/entity/Mail.java
0 → 100644
View file @
05beecd0
/**
* * Copyright © 2015-2020 <a href="https://gitee.com/JeeHuangBingGui/JeeSpring">JeeSpring</a> All rights reserved..
*/
package
com.jeespring.modules.iim.entity
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.List
;
import
com.google.common.collect.Lists
;
import
com.jeespring.common.persistence.AbstractBaseEntity
;
/**
* 发件箱Entity
* @author 黄炳桂 516821420@qq.com
* @version 2015-11-15
*/
public
class
Mail
extends
AbstractBaseEntity
<
Mail
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
title
;
// 标题
private
String
overview
;
// 内容概要
private
String
content
;
// 内容
private
List
<
MailBox
>
mailBoxList
=
Lists
.
newArrayList
();
// 子表列表
private
List
<
MailCompose
>
mailComposeList
=
Lists
.
newArrayList
();
// 子表列表
public
Mail
()
{
super
();
}
public
Mail
(
String
id
){
super
(
id
);
}
@Length
(
min
=
0
,
max
=
128
,
message
=
"标题长度必须介于 0 和 128 之间"
)
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
@Length
(
min
=
0
,
max
=
128
,
message
=
"内容概要长度必须介于 0 和 128 之间"
)
public
String
getOverview
()
{
return
overview
;
}
public
void
setOverview
(
String
overview
)
{
this
.
overview
=
overview
;
}
@Length
(
min
=
0
,
max
=
5096
,
message
=
"内容长度必须介于 0 和 5096 之间"
)
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
List
<
MailBox
>
getMailBoxList
()
{
return
mailBoxList
;
}
public
void
setMailBoxList
(
List
<
MailBox
>
mailBoxList
)
{
this
.
mailBoxList
=
mailBoxList
;
}
public
List
<
MailCompose
>
getMailComposeList
()
{
return
mailComposeList
;
}
public
void
setMailComposeList
(
List
<
MailCompose
>
mailComposeList
)
{
this
.
mailComposeList
=
mailComposeList
;
}
}
\ No newline at end of file
Prev
1
…
8
9
10
11
12
13
14
15
16
…
19
Next
Write
Preview
Supports
Markdown
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