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
Springboot Plus
Commits
9d902228
Commit
9d902228
authored
Mar 13, 2018
by
xiandafu
Browse files
Merge branch 'codegen'
parents
e93e6c35
bfade3f9
Changes
22
Show whitespace changes
Inline
Side-by-side
admin-console/src/main/java/com/ibeetl/admin/console/dao/CmsBlogDao.java
deleted
100644 → 0
View file @
e93e6c35
package
com.ibeetl.admin.console.dao
;
import
java.util.List
;
import
org.beetl.sql.core.annotatoin.SqlResource
;
import
org.beetl.sql.core.mapper.BaseMapper
;
import
org.beetl.sql.core.engine.PageQuery
;
import
com.ibeetl.admin.console.entity.*
;
/**
* CmsBlog Dao
*/
@SqlResource
(
"console.cmsBlog"
)
public
interface
CmsBlogDao
extends
BaseMapper
<
CmsBlog
>{
public
PageQuery
<
CmsBlog
>
queryByCondition
(
PageQuery
query
);
public
void
batchDelCmsBlogByIds
(
List
<
Long
>
ids
);
}
\ No newline at end of file
admin-console/src/main/java/com/ibeetl/admin/console/entity/CmsBlog.java
deleted
100644 → 0
View file @
e93e6c35
package
com.ibeetl.admin.console.entity
;
import
java.util.Date
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Null
;
import
org.beetl.sql.core.annotatoin.AutoID
;
import
org.beetl.sql.core.annotatoin.SeqID
;
import
com.ibeetl.admin.core.util.ValidateConfig
;
import
org.beetl.sql.core.TailBean
;
import
java.math.*
;
import
com.ibeetl.admin.core.entity.BaseEntity
;
/*
*
* gen by Spring Boot2 Admin 2018-02-24
*/
public
class
CmsBlog
extends
BaseEntity
{
@NotNull
(
message
=
"ID不能为空"
,
groups
=
ValidateConfig
.
UPDATE
.
class
)
@SeqID
(
name
=
ORACLE_CORE_SEQ_NAME
)
@AutoID
private
Integer
id
;
private
String
title
;
private
String
content
;
private
Date
createTime
;
private
Integer
createUserId
;
private
String
type
;
public
CmsBlog
()
{
}
public
Integer
getId
(){
return
id
;
}
public
void
setId
(
Integer
id
){
this
.
id
=
id
;
}
public
String
getTitle
(){
return
title
;
}
public
void
setTitle
(
String
title
){
this
.
title
=
title
;
}
public
String
getContent
(){
return
content
;
}
public
void
setContent
(
String
content
){
this
.
content
=
content
;
}
public
Date
getCreateTime
(){
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
){
this
.
createTime
=
createTime
;
}
public
Integer
getCreateUserId
(){
return
createUserId
;
}
public
void
setCreateUserId
(
Integer
createUserId
){
this
.
createUserId
=
createUserId
;
}
public
String
getType
(){
return
type
;
}
public
void
setType
(
String
type
){
this
.
type
=
type
;
}
}
admin-console/src/main/java/com/ibeetl/admin/console/service/CmsBlogService.java
deleted
100644 → 0
View file @
e93e6c35
package
com.ibeetl.admin.console.service
;
import
java.util.List
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.ibeetl.admin.core.util.PlatformException
;
import
com.ibeetl.admin.console.dao.CmsBlogDao
;
import
com.ibeetl.admin.console.entity.CmsBlog
;
import
com.ibeetl.admin.core.service.BaseService
;
/**
* CmsBlog Service
*/
@Service
@Transactional
public
class
CmsBlogService
extends
BaseService
<
CmsBlog
>{
@Autowired
private
CmsBlogDao
cmsBlogDao
;
public
PageQuery
<
CmsBlog
>
queryByCondition
(
PageQuery
query
){
PageQuery
ret
=
cmsBlogDao
.
queryByCondition
(
query
);
queryListAfter
(
ret
.
getList
());
return
ret
;
}
public
void
batchDelCmsBlog
(
List
<
Long
>
ids
){
try
{
cmsBlogDao
.
batchDelCmsBlogByIds
(
ids
);
}
catch
(
Exception
e
)
{
throw
new
PlatformException
(
"批量删除CmsBlog失败"
,
e
);
}
}
}
\ No newline at end of file
admin-console/src/main/java/com/ibeetl/admin/console/web/CmsBlogController.java
deleted
100644 → 0
View file @
e93e6c35
package
com.ibeetl.admin.console.web
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
com.ibeetl.admin.core.util.*
;
import
com.ibeetl.admin.console.entity.*
;
import
com.ibeetl.admin.console.service.*
;
import
com.ibeetl.admin.console.web.query.*
;
/**
* CmsBlog 接口
*/
@Controller
public
class
CmsBlogController
{
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
());
private
static
final
String
MODEL
=
"/admin/cmsBlog"
;
@Autowired
private
CmsBlogService
cmsBlogService
;
/* 页面 */
@GetMapping
(
MODEL
+
"/index.do"
)
@Function
(
"cmsBlog.query"
)
@ResponseBody
public
ModelAndView
index
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/cmsBlog/index.html"
)
;
view
.
addObject
(
"search"
,
CmsBlogQuery
.
class
.
getName
());
return
view
;
}
@GetMapping
(
MODEL
+
"/edit.do"
)
@Function
(
"cmsBlog.edit"
)
@ResponseBody
public
ModelAndView
edit
(
Integer
id
)
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/cmsBlog/edit.html"
);
CmsBlog
cmsBlog
=
cmsBlogService
.
queryById
(
id
);
view
.
addObject
(
"cmsBlog"
,
cmsBlog
);
return
view
;
}
@GetMapping
(
MODEL
+
"/add.do"
)
@Function
(
"cmsBlog.add"
)
@ResponseBody
public
ModelAndView
add
()
{
ModelAndView
view
=
new
ModelAndView
(
"/admin/cmsBlog/add.html"
);
return
view
;
}
/* ajax json */
@PostMapping
(
MODEL
+
"/list.json"
)
@Function
(
"cmsBlog.query"
)
@ResponseBody
public
JsonResult
<
PageQuery
>
list
(
CmsBlogQuery
condtion
)
{
PageQuery
page
=
condtion
.
getPageQuery
();
cmsBlogService
.
queryByCondition
(
page
);
return
JsonResult
.
success
(
page
);
}
@PostMapping
(
MODEL
+
"/add.json"
)
@Function
(
"cmsBlog.add"
)
@ResponseBody
public
JsonResult
add
(
@Validated
(
ValidateConfig
.
ADD
.
class
)
CmsBlog
cmsBlog
)
{
cmsBlogService
.
save
(
cmsBlog
);
return
new
JsonResult
().
success
();
}
@PostMapping
(
MODEL
+
"/update.json"
)
@Function
(
"cmsBlog.update"
)
@ResponseBody
public
JsonResult
<
String
>
update
(
@Validated
(
ValidateConfig
.
UPDATE
.
class
)
CmsBlog
cmsBlog
)
{
boolean
success
=
cmsBlogService
.
update
(
cmsBlog
);
if
(
success
)
{
return
new
JsonResult
().
success
();
}
else
{
return
JsonResult
.
failMessage
(
"保存失败"
);
}
}
@GetMapping
(
MODEL
+
"/view.json"
)
@Function
(
"cmsBlog.query"
)
@ResponseBody
public
JsonResult
<
CmsBlog
>
queryInfo
(
Integer
id
)
{
CmsBlog
cmsBlog
=
cmsBlogService
.
queryById
(
id
);
return
JsonResult
.
success
(
cmsBlog
);
}
@PostMapping
(
MODEL
+
"/delete.json"
)
@Function
(
"cmsBlog.delete"
)
@ResponseBody
public
JsonResult
delete
(
String
ids
)
{
if
(
ids
.
endsWith
(
","
))
{
ids
=
StringUtils
.
substringBeforeLast
(
ids
,
","
);
}
List
<
Long
>
idList
=
ConvertUtil
.
str2longs
(
ids
);
cmsBlogService
.
batchDelCmsBlog
(
idList
);
return
new
JsonResult
().
success
();
}
}
admin-console/src/main/java/com/ibeetl/admin/console/web/DictConsoleController.java
View file @
9d902228
...
...
@@ -158,6 +158,7 @@ public class DictConsoleController{
Context
context
=
new
Context
();
context
.
putVar
(
"dicts"
,
dicts
);
JxlsHelper
.
getInstance
().
processTemplate
(
is
,
os
,
context
);
os
.
close
();
//下载参考FileSystemContorller
return
JsonResult
.
success
(
item
.
getPath
());
}
catch
(
IOException
e
)
{
...
...
admin-console/src/main/resources/sql/console/blog.md
deleted
100644 → 0
View file @
e93e6c35
queryByCondition
===
select
@pageTag(){
t.*
@}
from cms_blog t
where 1=1
@//数据权限,该sql语句功能点
and #function("blog.query")#
batchDelCmsBlogByIds
===
*
批量逻辑删除
update cms_blog set del_flag = 1 where id in( #join(ids)#)
admin-console/src/main/resources/sql/console/cmsBlog.md
deleted
100644 → 0
View file @
e93e6c35
queryByCondition
===
select
@pageTag(){
t.*
@}
from cms_blog t
where 1=1
@//数据权限,该sql语句功能点
and #function("cmsBlog.query")#
batchDelCmsBlogByIds
===
*
批量逻辑删除
update cms_blog set del_flag = 1 where id in( #join(ids)#)
admin-core/src/main/java/com/ibeetl/admin/core/gen/JavaCodeGen.java
View file @
9d902228
...
...
@@ -72,6 +72,7 @@ class JavaEntityGen implements AutoGen{
map
.
put
(
"name"
,
attr
.
getName
());
map
.
put
(
"methodName"
,
BaseTarget
.
upperFirst
(
attr
.
getName
()));
map
.
put
(
"isId"
,
attr
.
isId
());
map
.
put
(
"dictType"
,
attr
.
getDictType
());
attrs
.
add
(
map
);
}
...
...
admin-core/src/main/java/com/ibeetl/admin/core/gen/model/Attribute.java
View file @
9d902228
...
...
@@ -7,6 +7,8 @@ public class Attribute {
private
String
displayName
;
private
boolean
isId
;
private
boolean
showInQuery
=
false
;
//数据字典
private
String
dictType
;
private
String
comment
;
...
...
@@ -58,5 +60,11 @@ public class Attribute {
public
void
setComment
(
String
comment
)
{
this
.
comment
=
comment
;
}
public
String
getDictType
()
{
return
dictType
;
}
public
void
setDictType
(
String
dictType
)
{
this
.
dictType
=
dictType
;
}
}
admin-core/src/main/java/com/ibeetl/admin/core/gen/model/Entity.java
View file @
9d902228
...
...
@@ -14,6 +14,9 @@ public class Entity {
Attribute
nameAttribute
;
String
comment
;
String
system
;
boolean
includeExcel
=
false
;
boolean
attachment
=
false
;
public
String
getName
()
{
return
name
;
}
...
...
@@ -90,5 +93,17 @@ public class Entity {
}
return
newList
;
}
public
boolean
isIncludeExcel
()
{
return
includeExcel
;
}
public
void
setIncludeExcel
(
boolean
includeExcel
)
{
this
.
includeExcel
=
includeExcel
;
}
public
boolean
isAttachment
()
{
return
attachment
;
}
public
void
setAttachment
(
boolean
attachment
)
{
this
.
attachment
=
attachment
;
}
}
admin-core/src/main/java/com/ibeetl/admin/core/web/CoreCodeGenController.java
View file @
9d902228
...
...
@@ -132,14 +132,6 @@ public class CoreCodeGenController {
copy
(
resource
,
"btsql-ext.properties"
);
copy
(
resource
,
"banner.txt"
);
//修改application.properties的配置,改成手工添加
// Properties ps = new Properties();
// ps.load(new FileReader(config));
//// String str = ps.getProperty("beetlsql.basePackag");
// ps.put("beetlsql.basePackag", "ibeetl.com,"+basePackage);
// ps.store(new FileWriter(config), "");
//
return
JsonResult
.
success
();
}
...
...
@@ -319,22 +311,22 @@ public class CoreCodeGenController {
entity
.
setCode
(
info
.
getCode
());
entity
.
setDisplayName
(
info
.
getDisplayName
());
entity
.
setSystem
(
info
.
getSystem
());
entity
.
setAttachment
(
data
.
entity
.
isAttachment
());
entity
.
setIncludeExcel
(
data
.
entity
.
isIncludeExcel
());
for
(
int
i
=
0
;
i
<
entity
.
getList
().
size
();
i
++)
{
Attribute
attr
=
entity
.
getList
().
get
(
i
);
attr
.
setDisplayName
(
info
.
getList
().
get
(
i
).
getDisplayName
());
attr
.
setShowInQuery
(
info
.
getList
().
get
(
i
).
isShowInQuery
());
attr
.
setDictType
(
info
.
getList
().
get
(
i
).
getDictType
());
if
(
attr
.
getName
().
equals
(
data
.
getNameAttr
()))
{
entity
.
setNameAttribute
(
attr
);
}
}
if
(
StringUtils
.
isEmpty
(
entity
.
getCode
())
||
StringUtils
.
isEmpty
(
entity
.
getSystem
()))
{
throw
new
PlatformException
(
"code,system不能为空"
);
}
return
entity
;
}
...
...
@@ -432,6 +424,7 @@ class EntityInfo {
String
basePackage
;
String
nameAttr
;
public
Entity
getEntity
()
{
return
entity
;
}
...
...
@@ -464,4 +457,6 @@ class EntityInfo {
this
.
nameAttr
=
nameAttr
;
}
}
admin-core/src/main/resources/codeTemplate/html/add.html
View file @
9d902228
...
...
@@ -16,17 +16,25 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
${item.displayName}
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"${item.name}"
class=
"layui-input"
>
@if(isEmpty(item.dictType)){
<input
type=
"text"
name=
"${item.name}"
class=
"layui-input"
>
@}else{
<layui:simpleDictSelect
style=
'layui-input-inline'
type=
"${item.dictType}"
id=
"${item.name}"
name=
"${item.name}"
value=
""
/>
@}
</div>
</div>
@}
</div>
</div>
@}
@if(entity.attachment){
<div
class=
"layui-row"
>
<!-- 业务对象得有一个字段保存附件id,假设是attachmentId -->
<layui:attachment
name=
"attachmentId"
batchFileUUID=
"\${uuid()}"
bizType=
"entity.name"
isNew=
"true"
/>
</div>
@}
<layui:submitButtons
id=
"addButton"
/>
</form>
<!--#} -->
...
...
admin-core/src/main/resources/codeTemplate/html/edit.html
View file @
9d902228
...
...
@@ -15,16 +15,26 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
${item.displayName}
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"${item.name}"
value=
"\${${entity.code}.${item.name}}"
@if(isEmpty(item.dictType)){
<input
type=
"text"
id=
"${item.name}"
name=
"${item.name}"
value=
"\${${entity.code}.${item.name}}"
class=
"layui-input"
>
@}else{
<layui:simpleDictSelect
style=
'layui-input-inline'
type=
"${item.dictType}"
id=
"${item.name}"
name=
"${item.name}"
value=
"\${${entity.code}.${item.name}}"
/>
@}
</div>
</div>
@}
</div>
</div>
@}
<input
type=
"hidden"
name=
"${entity.idAttribute.name}"
value=
\${${entity.code}.${entity.idAttribute.name}}
/>
@if(entity.attachment){
<div
class=
"layui-row"
>
<layui:attachment
name=
"attachmentId"
batchFileUUID=
"\${${entity.code}.attachmentId}"
isNew=
"false"
bizId=
"\${${entity.code}.${entity.idAttribute.name}}"
bizType=
"${entity.name}"
/>
</div>
@}
<input
type=
"hidden"
name=
"${entity.idAttribute.name}"
value=
\${${entity.code}.${entity.idAttribute.name}}
/>
<layui:submitButtons
id=
"updateButton"
/>
</form>
<!--#} -->
...
...
admin-core/src/main/resources/codeTemplate/html/index.html
View file @
9d902228
...
...
@@ -2,12 +2,16 @@
<layui:searchForm
formId=
"searchForm"
condition=
"\${search}"
>
</layui:searchForm>
<div
class=
"layui-btn-group"
>
<div
class=
"layui-btn-group"
>
<layui:accessButton
function=
"${entity.code}.add"
action=
"add"
>
增加
</layui:accessButton>
<layui:accessButton
function=
"${entity.code}.edit"
action=
"edit"
>
编辑
</layui:accessButton>
<layui:accessButton
function=
"${entity.code}.del"
action=
"del"
>
删除
</layui:accessButton>
@if(entity.includeExcel){
<layui:accessButton
function=
"${entity.code}.exportDocument"
action=
"exportDocument"
>
导出
</layui:accessButton>
<layui:accessButton
function=
"${entity.code}.importDocument"
action=
"importDocument"
>
导入
</layui:accessButton>
@}
</div>
</div>
<table
id=
"${entity.code}Table"
lay-filter=
"${entity.code}Table"
></table>
<!--#} -->
<script>
...
...
admin-core/src/main/resources/codeTemplate/java/controller.java
View file @
9d902228
package
${
package
};
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.beetl.sql.core.engine.PageQuery
;
import
org.jxls.common.Context
;
import
org.jxls.reader.ReaderBuilder
;
import
org.jxls.reader.ReaderConfig
;
import
org.jxls.reader.XLSReadMessage
;
import
org.jxls.reader.XLSReadStatus
;
import
org.jxls.reader.XLSReader
;
import
org.jxls.util.JxlsHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.ibeetl.admin.console.web.dto.DictExcelImportData
;
import
com.ibeetl.admin.console.web.query.UserQuery
;
import
com.ibeetl.admin.core.annotation.Function
;
import
com.ibeetl.admin.core.annotation.Query
;
import
com.ibeetl.admin.core.entity.CoreDict
;
import
com.ibeetl.admin.core.entity.CoreUser
;
import
com.ibeetl.admin.core.file.FileItem
;
import
com.ibeetl.admin.core.file.FileService
;
import
com.ibeetl.admin.core.web.JsonResult
;
import
com.ibeetl.admin.core.util.*
;
import
${
basePackage
}.
entity
.*;
...
...
@@ -37,6 +60,8 @@ public class ${entity.name}Controller{
\
@Autowired
private
$
{
entity
.
name
}
Service
$
{
service
};
\
@Autowired
FileService
fileService
;
/* 页面 */
\
@GetMapping
(
MODEL
+
"/index.do"
)
...
...
@@ -121,4 +146,57 @@ public class ${entity.name}Controller{
return
new
JsonResult
().
success
();
}
@if
(
entity
.
includeExcel
){
\
@PostMapping
(
MODEL
+
"/excel/export.json"
)
\
@Function
(
"${entity.code}.export"
)
\
@ResponseBody
public
JsonResult
<
String
>
export
(
HttpServletResponse
response
,
$
{
entity
.
name
}
Query
condtion
)
{
/**
* 1)需要用你自己编写一个的excel模板
* 2)通常excel导出需要关联更多数据,因此${service}.queryByCondition方法经常不符合需求,需要重写一个为模板导出的查询
* 3)参考ConsoleDictController来实现模板导入导出
*/
String
excelTemplate
=
"excelTemplates/${target.urlBase}/${entity.code}/你的excel模板文件名字.xls"
;
PageQuery
<
$
{
entity
.
name
}>
page
=
condtion
.
getPageQuery
();
//取出全部符合条件的
page
.
setPageSize
(
Integer
.
MAX_VALUE
);
page
.
setPageNumber
(
1
);
page
.
setTotalRow
(
Integer
.
MAX_VALUE
);
//本次导出需要的数据
List
<
$
{
entity
.
name
}>
list
=
$
{
service
}.
queryByCondition
(
page
).
getList
();
try
(
InputStream
is
=
Thread
.
currentThread
().
getContextClassLoader
().
getResourceAsStream
(
excelTemplate
))
{
if
(
is
==
null
)
{
throw
new
PlatformException
(
"模板资源不存在:"
+
excelTemplate
);
}
FileItem
item
=
fileService
.
createFileTemp
(
"${entity.displayName}_"
+
DateUtil
.
now
(
"yyyyMMddHHmmss"
)+
".xls"
);
OutputStream
os
=
item
.
openOutpuStream
();
Context
context
=
new
Context
();
context
.
putVar
(
"list"
,
list
);
JxlsHelper
.
getInstance
().
processTemplate
(
is
,
os
,
context
);
os
.
close
();
//下载参考FileSystemContorller
return
JsonResult
.
success
(
item
.
getPath
());
}
catch
(
IOException
e
)
{
throw
new
PlatformException
(
e
.
getMessage
());
}
}
\
@PostMapping
(
MODEL
+
"/excel/import.do"
)
\
@Function
(
"${entity.code}.import"
)
\
@ResponseBody
public
JsonResult
importExcel
(
\
@RequestParam
(
"file"
)
MultipartFile
file
)
throws
Exception
{
if
(
file
.
isEmpty
())
{
return
JsonResult
.
fail
();
}
InputStream
ins
=
file
.
getInputStream
();
/*解析模板并导入到数据库里,参考DictConsoleContorller,使用jxls reader读取excel数据*/
ins
.
close
();
return
JsonResult
.
success
();
}
@
}
}
admin-core/src/main/resources/codeTemplate/java/pojo.java
View file @
9d902228
...
...
@@ -13,6 +13,8 @@ import com.ibeetl.admin.core.util.ValidateConfig;
import
org.beetl.sql.core.TailBean
;
import
java.math.*
;
import
com.ibeetl.admin.core.annotation.Dict
;
import
com.ibeetl.admin.core.entity.BaseEntity
;
/*
...
...
@@ -30,6 +32,10 @@ public class ${className} extends BaseEntity{
\
@SeqID
(
name
=
ORACLE_CORE_SEQ_NAME
)
\
@AutoID
@
}
@if
(
isNotEmpty
(
attr
.
dictType
))
{
\
@Dict
(
type
=
"${attr.dictType}"
)
@
}
private
$
{
attr
.
type
}
$
{
attr
.
name
}
;
@
}
...
...
admin-core/src/main/resources/codeTemplate/java/query.java
View file @
9d902228
...
...
@@ -8,11 +8,15 @@ import java.util.Date;
*${entity.displayName}查询
*/
public
class
${
entity
.
name
}
Query
extends
PageParam
{
@for
(
attr
in
attrs
)
{
@for
(
attr
in
attrs
)
{
@if
(
isNotEmpty
(
attr
.
dictType
))
{
\
@Query
(
name
=
"${attr.displayName}"
,
display
=
true
,
type
=
Query
.
TYPE_DICT
,
dict
=
"${attr.dictType}"
)
@
}
else
{
\
@Query
(
name
=
"${attr.displayName}"
,
display
=
true
)
@
}
private
$
{
attr
.
javaType
}
$
{
attr
.
name
};
@
}
@for
(
attr
in
attrs
)
{
@
}
@for
(
attr
in
attrs
)
{
public
$
{
attr
.
javaType
}
get
$
{
upperFirst
(
attr
.
name
)}(){
return
$
{
attr
.
name
};
}
...
...
admin-core/src/main/resources/codeTemplate/js/edit.js
View file @
9d902228
admin-core/src/main/resources/codeTemplate/js/entityApi.js
View file @
9d902228
...
...
@@ -12,6 +12,15 @@ layui.define([], function(exports) {
callback
();
})
}
@
if
(
entity
.
includeExcel
){
,
exportExcel
:
function
(
form
,
callback
){
var
formPara
=
form
.
serializeJson
();
Common
.
post
(
"
/${target.urlBase}/${entity.code}/excel/export.json
"
,
formPara
,
function
(
fileId
)
{
callback
(
fileId
);
})
}
@}
};
exports
(
'
${entity.code}Api
'
,
api
);
...
...
admin-core/src/main/resources/codeTemplate/js/index.js
View file @
9d902228
...
...
@@ -27,7 +27,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
},
@
for
(
attr
in
entity
.
list
){
{
field
:
'
${
attr.name}
'
,
field
:
'
${
isEmpty(attr.dictType)?attr.name:(attr.name+"Text")}
'
,
$
{
isNotEmpty
(
attr
.
dictType
)?
"
//数据字典类型为
"
+
attr
.
dictType
}
title
:
'
${attr.displayName}
'
,
@
if
(
attrLP
.
first
){
fixed
:
'
left
'
,
...
...
@@ -37,7 +37,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
return
Common
.
getDate
(
d
.
$
{
attr
.
name
});
},
@}
width
:
100
,
width
:
100
}
$
{
!
attrLP
.
last
?
"
,
"
}
@}
...
...
@@ -69,6 +69,27 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
delView
.
delBatch
();
});
}
@
if
(
entity
.
includeExcel
){
,
exportDocument
:
function
()
{
layui
.
use
([
'
${entity.code}Api
'
],
function
()
{
var
$
{
entity
.
code
}
Api
=
layui
.
$
{
entity
.
code
}
Api
Common
.
openConfirm
(
"
确认要导出这些${entity.displayName}数据?
"
,
function
()
{
$
{
entity
.
code
}
Api
.
exportExcel
(
$
(
"
#searchForm
"
),
function
(
fileId
)
{
Lib
.
download
(
fileId
);
})
})
});
},
importDocument
:
function
(){
var
uploadUrl
=
Common
.
ctxPath
+
"
/${target.urlBase}/${entity.code}/excel/import.do
"
;
//模板,
var
templatePath
=
"
/${target.urlBase}/${entity.code}/${entity.code}_upload_template.xls
"
;
//公共的简单上传文件处理
var
url
=
"
/core/file/simpleUpload.do?uploadUrl=
"
+
uploadUrl
+
"
&templatePath=
"
+
templatePath
;
Common
.
openDlg
(
url
,
"
${entity.displayName}管理>上传
"
);
}
@}
};
$
(
'
.ext-toolbar
'
).
on
(
'
click
'
,
function
()
{
var
type
=
$
(
this
).
data
(
'
type
'
);
...
...
Prev
1
2
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