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
a8bfaf25
Commit
a8bfaf25
authored
Jan 13, 2018
by
李丛阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善 ftl
parent
94b2ca18
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
controller.ftl
src/main/resources/templates/codeftl/controller.ftl
+10
-2
repository.ftl
src/main/resources/templates/codeftl/repository.ftl
+4
-1
serviceimpl.ftl
src/main/resources/templates/codeftl/serviceimpl.ftl
+12
-8
No files found.
src/main/resources/templates/codeftl/controller.ftl
View file @
a8bfaf25
...
@@ -13,6 +13,12 @@ import org.rcisoft.core.result.Result;
...
@@ -13,6 +13,12 @@ import org.rcisoft.core.result.Result;
import
org
.
rcisoft
.
core
.
result
.
ResultServiceEnums
;
import
org
.
rcisoft
.
core
.
result
.
ResultServiceEnums
;
import
org
.
rcisoft
.
core
.
model
.
PersistModel
;
import
org
.
rcisoft
.
core
.
model
.
PersistModel
;
import
org
.
rcisoft
.
core
.
constant
.
MessageConstant
;
import
org
.
rcisoft
.
core
.
constant
.
MessageConstant
;
import
org
.
rcisoft
.
common
.
controller
.
PaginationController
;
import
org
.
rcisoft
.
core
.
util
.
UserUtil
;
import
org
.
rcisoft
.
common
.
model
.
GridModel
;
import
org
.
rcisoft
.
core
.
exception
.
ServiceException
;
import
javax
.
validation
.
Valid
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
entity
.${
table
.
entityName
};
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
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.${
table
.
entityName
}
Service
;
...
@@ -36,6 +42,7 @@ public class ${table.entityName}Controller extends PaginationController<${table.
...
@@ -36,6 +42,7 @@ public class ${table.entityName}Controller extends PaginationController<${table.
public
Result
add
(@
Valid
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
},
BindingResult
bindingResult
)
{
public
Result
add
(@
Valid
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
},
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
if
(
bindingResult
.
hasErrors
())
{
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
bindingResult
.
getFieldError
().
getDefaultMessage
());
}
}
${
table
.
entityName
?
uncap_first
}.
setToken
(
getToken
());
${
table
.
entityName
?
uncap_first
}.
setToken
(
getToken
());
PersistModel
data
=
${
table
.
entityName
?
uncap_first
}
ServiceImpl
.
save
(${
table
.
entityName
?
uncap_first
});
PersistModel
data
=
${
table
.
entityName
?
uncap_first
}
ServiceImpl
.
save
(${
table
.
entityName
?
uncap_first
});
...
@@ -49,7 +56,7 @@ public class ${table.entityName}Controller extends PaginationController<${table.
...
@@ -49,7 +56,7 @@ public class ${table.entityName}Controller extends PaginationController<${table.
@
ApiImplicitParams
({@
ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
false
,
dataType
=
"varchar"
)})
@
ApiImplicitParams
({@
ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
false
,
dataType
=
"varchar"
)})
@
DeleteMapping
(
"/{id:
\\
d+}"
)
@
DeleteMapping
(
"/{id:
\\
d+}"
)
public
Result
delete
(@
PathVariable
String
id
)
{
public
Result
delete
(@
PathVariable
String
id
)
{
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}
=
new
${
table
.
entityName
?
uncap_first
}();
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}
=
new
${
table
.
entityName
}();
${
table
.
entityName
?
uncap_first
}.
setBusinessId
(
id
);
${
table
.
entityName
?
uncap_first
}.
setBusinessId
(
id
);
${
table
.
entityName
?
uncap_first
}.
setToken
(
getToken
());
${
table
.
entityName
?
uncap_first
}.
setToken
(
getToken
());
PersistModel
data
=
${
table
.
entityName
?
uncap_first
}
ServiceImpl
.
remove
(${
table
.
entityName
?
uncap_first
});
PersistModel
data
=
${
table
.
entityName
?
uncap_first
}
ServiceImpl
.
remove
(${
table
.
entityName
?
uncap_first
});
...
@@ -62,9 +69,10 @@ public class ${table.entityName}Controller extends PaginationController<${table.
...
@@ -62,9 +69,10 @@ public class ${table.entityName}Controller extends PaginationController<${table.
@
ApiOperation
(
value
=
"修改${table.tableRemark!}"
,
notes
=
"修改${table.tableRemark!}"
)
@
ApiOperation
(
value
=
"修改${table.tableRemark!}"
,
notes
=
"修改${table.tableRemark!}"
)
@
ApiImplicitParams
({@
ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@
ApiImplicitParams
({@
ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@
PutMapping
(
"/{id:
\\
d+}"
)
@
PutMapping
(
"/{id:
\\
d+}"
)
public
Result
update
(
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}
)
{
public
Result
update
(
@
Valid
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
},
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
if
(
bindingResult
.
hasErrors
())
{
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
.
getCode
(),
bindingResult
.
getFieldError
().
getDefaultMessage
());
}
}
${
table
.
entityName
?
uncap_first
}.
setToken
(
getToken
());
${
table
.
entityName
?
uncap_first
}.
setToken
(
getToken
());
PersistModel
data
=
${
table
.
entityName
?
uncap_first
}
ServiceImpl
.
merge
(${
table
.
entityName
?
uncap_first
});
PersistModel
data
=
${
table
.
entityName
?
uncap_first
}
ServiceImpl
.
merge
(${
table
.
entityName
?
uncap_first
});
...
...
src/main/resources/templates/codeftl/repository.ftl
View file @
a8bfaf25
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
dao
;
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
dao
;
import
org
.
rcisoft
.
core
.
base
.
BaseMapper
import
org
.
rcisoft
.
core
.
base
.
BaseMapper
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
entity
.${
table
.
entityName
};
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
entity
.${
table
.
entityName
};
import
org
.
apache
.
ibatis
.
annotations
.
ResultMap
;
import
org
.
apache
.
ibatis
.
annotations
.
Select
;
import
org
.
springframework
.
stereotype
.
Repository
;
import
java
.
util
.
List
;
import
java
.
util
.
List
;
...
...
src/main/resources/templates/codeftl/serviceimpl.ftl
View file @
a8bfaf25
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.
impl
;
package
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.
impl
;
import
org
.
rcisoft
.
core
.
util
.
UserUtil
;
import
org
.
rcisoft
.
core
.
util
.
UserUtil
;
import
org
.
rcisoft
.
core
.
aop
.
PageUtil
;
import
org
.
rcisoft
.
core
.
model
.
PersistModel
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
dao
.${
table
.
entityName
}
Repository
;
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
}.
entity
.${
table
.
entityName
};
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.${
table
.
entityName
}
Service
;
import
org
.
rcisoft
.
business
.${
table
.
entityName
?
lower_case
}.
service
.${
table
.
entityName
}
Service
;
...
@@ -12,6 +14,8 @@ import org.springframework.transaction.annotation.Isolation;
...
@@ -12,6 +14,8 @@ import org.springframework.transaction.annotation.Isolation;
import
org
.
springframework
.
transaction
.
annotation
.
Propagation
;
import
org
.
springframework
.
transaction
.
annotation
.
Propagation
;
import
org
.
springframework
.
transaction
.
annotation
.
Transactional
;
import
org
.
springframework
.
transaction
.
annotation
.
Transactional
;
import
java
.
util
.
List
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
/**
/**
...
@@ -33,11 +37,11 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
...
@@ -33,11 +37,11 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
*/
*/
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Override
@
Override
PersistModel
save
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
public
PersistModel
save
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
${
table
.
entityName
?
uncap_first
}.
setCommonBusinessId
();
${
table
.
entityName
?
uncap_first
}.
setCommonBusinessId
();
//
增加操作
//
增加操作
UserUtil
.
setCurrentPersistOperation
(${
table
.
entityName
?
uncap_first
});
UserUtil
.
setCurrentPersistOperation
(${
table
.
entityName
?
uncap_first
});
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
insertSelective
(${
table
.
entityName
?
uncap_first
}
Repository
);
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
insertSelective
(${
table
.
entityName
?
uncap_first
});
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"新增了ID为"
+
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"新增了ID为"
+
${
table
.
entityName
?
uncap_first
}.
getBusinessId
()+
"的信息"
);
${
table
.
entityName
?
uncap_first
}.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
return
new
PersistModel
(
line
);
...
@@ -45,12 +49,12 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
...
@@ -45,12 +49,12 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
/**
/**
*
逻辑删除
*
逻辑删除
*
@
param
id
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*
@
return
*/
*/
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Override
@
Override
PersistModel
remove
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
public
PersistModel
remove
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
UserUtil
.
setCurrentMergeOperation
(${
table
.
entityName
?
uncap_first
});
UserUtil
.
setCurrentMergeOperation
(${
table
.
entityName
?
uncap_first
});
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
logicalDelete
(${
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为"
+
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"逻辑删除了ID为"
+
...
@@ -65,7 +69,7 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
...
@@ -65,7 +69,7 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
*/
*/
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@
Override
@
Override
PersistModel
merge
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
public
PersistModel
merge
(${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
UserUtil
.
setCurrentMergeOperation
(${
table
.
entityName
?
uncap_first
});
UserUtil
.
setCurrentMergeOperation
(${
table
.
entityName
?
uncap_first
});
int
line
=
${
table
.
entityName
?
uncap_first
}
Repository
.
updateByPrimaryKeySelective
(${
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为"
+
log
.
info
(
UserUtil
.
getUserInfoProp
(${
table
.
entityName
?
uncap_first
}.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"修改了ID为"
+
...
@@ -78,16 +82,16 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
...
@@ -78,16 +82,16 @@ public class ${table.entityName}ServiceImpl implements ${table.entityName}Servic
*
@
param
id
*
@
param
id
*
@
return
*
@
return
*/
*/
${
table
.
entityName
}
findById
(
String
id
){
public
${
table
.
entityName
}
findById
(
String
id
){
return
${
table
.
entityName
?
uncap_first
}
Repository
.
selectByPrimaryKey
(
id
);
return
${
table
.
entityName
?
uncap_first
}
Repository
.
selectByPrimaryKey
(
id
);
}
}
/**
/**
*
分页查询
${
table
.
entityName
?
uncap_first
}
*
分页查询
${
table
.
entityName
?
uncap_first
}
*
@
param
id
*
@
param
${
table
.
entityName
?
uncap_first
}
*
@
return
*
@
return
*/
*/
List
<${
table
.
entityName
}>
findAllByPagination
(
PageUtil
<${
table
.
entityName
}>
paginationUtility
,
public
List
<${
table
.
entityName
}>
findAllByPagination
(
PageUtil
<${
table
.
entityName
}>
paginationUtility
,
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
${
table
.
entityName
}
${
table
.
entityName
?
uncap_first
}){
return
${
table
.
entityName
?
uncap_first
}
Repository
.
query
${
table
.
entityName
}
s
(${
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