Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projectArtifacture
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yangzhaojun
projectArtifacture
Commits
94b2ca18
Commit
94b2ca18
authored
Jan 12, 2018
by
李丛阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freemarker
parent
5a3c63ac
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
282 additions
and
1 deletion
+282
-1
QuartzConfig.java
src/main/java/org/rcisoft/config/QuartzConfig.java
+44
-0
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+1
-1
ZipCompress.java
src/main/java/org/rcisoft/core/util/ZipCompress.java
+63
-0
repository.ftl
src/main/resources/templates/codeftl/repository.ftl
+26
-0
service.ftl
src/main/resources/templates/codeftl/service.ftl
+53
-0
serviceimpl.ftl
src/main/resources/templates/codeftl/serviceimpl.ftl
+95
-0
No files found.
src/main/java/org/rcisoft/config/QuartzConfig.java
0 → 100644
View file @
94b2ca18
package
org
.
rcisoft
.
config
;
import
org.quartz.Scheduler
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.quartz.SchedulerFactoryBean
;
import
static
com
.
sun
.
tools
.
doclint
.
Entity
.
ge
;
/**
* Created by lcy on 18/1/11.
*/
@Configuration
public
class
QuartzConfig
{
/**
* attention:
* Details:定义quartz调度工厂
*/
@Bean
(
name
=
"schedulerFactory"
)
public
SchedulerFactoryBean
schedulerFactory
()
{
SchedulerFactoryBean
bean
=
new
SchedulerFactoryBean
();
// 用于quartz集群,QuartzScheduler 启动时更新己存在的Job
bean
.
setOverwriteExistingJobs
(
true
);
// 延时启动,应用启动1秒后
bean
.
setStartupDelay
(
1
);
// 注册触发器
//bean.setTriggers(cronJobTrigger);
return
bean
;
}
@Bean
(
name
=
"scheduler"
)
public
Scheduler
schedulerFactory
(
SchedulerFactoryBean
bean
)
{
return
bean
.
getScheduler
();
}
}
\ No newline at end of file
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
94b2ca18
...
...
@@ -24,7 +24,7 @@ public enum ResultServiceEnums {
LOGIN_HEADER_ERROR
(
19
,
"不合法的Authorization header"
),
PARAMER_ERROR
(
20
,
"参数错误"
),
PARAME
TE
R_ERROR
(
20
,
"参数错误"
),
UPLOAD_FILE_ERROR
(
26
,
"上传图片失败"
),
...
...
src/main/java/org/rcisoft/core/util/ZipCompress.java
0 → 100644
View file @
94b2ca18
package
org
.
rcisoft
.
core
.
util
;
import
org.apache.tools.ant.Project
;
import
org.apache.tools.ant.taskdefs.Zip
;
import
org.apache.tools.ant.types.FileSet
;
import
java.io.File
;
import
java.io.Serializable
;
/**
* Created by lcy on 17/7/6.
*
* 压缩
*/
public
class
ZipCompress
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2522528934048955246L
;
public
ZipCompress
()
{
}
/**
* 执行压缩操作
* @param srcPathName 需要被压缩的文件/文件夹
*/
public
static
void
compressExe
(
String
srcPathName
,
String
dest
)
{
File
srcdir
=
new
File
(
srcPathName
);
if
(!
srcdir
.
exists
()){
throw
new
RuntimeException
(
srcPathName
+
"不存在!"
);
}
File
zipFile
=
new
File
(
dest
);
Project
prj
=
new
Project
();
Zip
zip
=
new
Zip
();
zip
.
setProject
(
prj
);
zip
.
setDestFile
(
zipFile
);
FileSet
fileSet
=
new
FileSet
();
fileSet
.
setProject
(
prj
);
fileSet
.
setDir
(
srcdir
);
//fileSet.setIncludes("**/*.java"); //包括哪些文件或文件夹 eg:zip.setIncludes("*.java");
fileSet
.
setExcludes
(
".DS_Store"
);
//排除哪些文件或文件夹
zip
.
addFileset
(
fileSet
);
zip
.
execute
();
}
/**
* @param args
*/
public
static
void
main
(
String
[]
args
)
{
// TODO Auto-generated method stub
ZipCompress
book
=
new
ZipCompress
();
try
{
book
.
compressExe
(
"/working/virtualDirectory/projectFiles/family/upload/codegenerate/0d76004eccb54b03ab9a07de145f520e/20170706224325/"
,
"/working/ZipTestCompressing.zip"
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
src/main/resources/templates/codeftl/repository.ftl
0 → 100644
View file @
94b2ca18
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
dao
;
import
org
.
rcisoft
.
core
.
base
.
BaseMapper
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
entity
.${
table
.
entityName
};
import
java
.
util
.
List
;
/**
*
Created
with
${
author
}
on
${.
now
}.
*/
@
Repository
public
interface
${
table
.
entityName
}
Repository
extends
BaseMapper
<${
table
.
entityName
}>
{
/**
*
分页查询
${
table
.
entityName
?
uncap_first
}
*
*/
@
Select
(
"<script>select * from ${table.tableName} where 1=1 "
+
"<if test=
\"
delFlag !=null and delFlag != ''
\"
>and del_flag = ${r'#{delFlag}'} </if>' "
+
"<if test=
\"
flag !=null and flag != ''
\"
>and flag = ${r'#{flag}'} </if>' "
+
"</script>"
)
@
ResultMap
(
value
=
"BaseResultMap"
)
List
<${
table
.
entityName
}>
query
${
table
.
entityName
}
s
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
});
}
src/main/resources/templates/codeftl/service.ftl
0 → 100755
View file @
94b2ca18
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
entity
.${
table
.
entityName
};
import
org
.
rcisoft
.
core
.
model
.
PersistModel
;
import
org
.
rcisoft
.
core
.
aop
.
PageUtil
;
import
java
.
util
.
List
;
/**
*
Created
by
${
author
}
on
${.
now
}.
*/
public
interface
${
table
.
entityName
}
Service
{
/**
*
保存
${
table
.
tableRemark
!}
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*/
PersistModel
save
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
});
/**
*
逻辑删除
${
table
.
tableRemark
!}
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*/
PersistModel
remove
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
});
/**
*
修改
${
table
.
tableRemark
!}
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*/
PersistModel
merge
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
});
/**
*
根据
id
查询
${
table
.
tableRemark
!}
*
@
param
id
*
@
return
*/
${
table
.
entityName
}
findById
(
String
id
);
/**
*
分页查询
${
table
.
tableRemark
!}
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*/
List
<${
table
.
entityName
}>
findAllByPagination
(
PageUtil
<${
table
.
entityName
}>
paginationUtility
,
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
});
}
src/main/resources/templates/codeftl/serviceimpl.ftl
0 → 100755
View file @
94b2ca18
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.
impl
;
import
org
.
rcisoft
.
core
.
util
.
UserUtil
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
dao
.${
table
.
entityName
}
Repository
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
entity
.${
table
.
entityName
};
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.${
table
.
entityName
}
Service
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
stereotype
.
Service
;
import
org
.
springframework
.
transaction
.
annotation
.
Isolation
;
import
org
.
springframework
.
transaction
.
annotation
.
Propagation
;
import
org
.
springframework
.
transaction
.
annotation
.
Transactional
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
/**
*
Created
by
${
author
}
on
${.
now
}.
*/
@
Service
@
Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@
Slf4j
public
class
${
table
.
entityName
}
ServiceImpl
implements
${
table
.
entityName
}
Service
{
@
Autowired
private
${
table
.
entityName
}
Repository
${
table
.
entityName
?
uncap_first
}
Repository
;
/**
*
保存
${
table
.
entityName
?
uncap_first
}
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*/
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Override
PersistModel
save
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
${
table
.
entityName
?
uncap_first
}.
setCommonBusinessId
();
//
增加操作
UserUtil
.
setCurrentPersistOperation
(${
table
.
entityName
?
uncap_first
});
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
insertSelective
(${
table
.
entityName
?
uncap_first
}
Repository
);
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"新增了ID为"
+
${
table
.
entityName
?
uncap_first
}.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
}
/**
*
逻辑删除
*
@
param
id
*
@
return
*/
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Override
PersistModel
remove
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
UserUtil
.
setCurrentMergeOperation
(${
table
.
entityName
?
uncap_first
});
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
logicalDelete
(${
table
.
entityName
?
uncap_first
});
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"逻辑删除了ID为"
+
${
table
.
entityName
?
uncap_first
}.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
}
/**
*
修改
${
table
.
entityName
?
uncap_first
}
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*/
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Override
PersistModel
merge
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
UserUtil
.
setCurrentMergeOperation
(${
table
.
entityName
?
uncap_first
});
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
updateByPrimaryKeySelective
(${
table
.
entityName
?
uncap_first
});
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"修改了ID为"
+
${
table
.
entityName
?
uncap_first
}.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
}
/**
*
根据
id
查询
${
table
.
entityName
?
uncap_first
}
*
@
param
id
*
@
return
*/
${
table
.
entityName
}
findById
(
String
id
){
return
${
table
.
entityName
?
uncap_first
}
Repository
.
selectByPrimaryKey
(
id
);
}
/**
*
分页查询
${
table
.
entityName
?
uncap_first
}
*
@
param
id
*
@
return
*/
List
<${
table
.
entityName
}>
findAllByPagination
(
PageUtil
<${
table
.
entityName
}>
paginationUtility
,
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
return
${
table
.
entityName
?
uncap_first
}
Repository
.
query
${
table
.
entityName
}
s
(${
table
.
entityName
?
uncap_first
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment