Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
remit
Overview
Overview
Details
Activity
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
gechengyang
remit
Commits
fb073d85
Commit
fb073d85
authored
Dec 17, 2018
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交模板化代码
parent
12ade8bd
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
19 additions
and
123 deletions
+19
-123
CpdController.java
...n/java/com/brilliance/remit/controller/CpdController.java
+4
-3
RemitController.java
...java/com/brilliance/remit/controller/RemitController.java
+0
-42
CntService.java
src/main/java/com/brilliance/remit/service/CntService.java
+1
-2
CpdService.java
src/main/java/com/brilliance/remit/service/CpdService.java
+1
-1
RemitService.java
src/main/java/com/brilliance/remit/service/RemitService.java
+0
-7
CntServiceImpl.java
...java/com/brilliance/remit/service/imp/CntServiceImpl.java
+1
-1
CpdServiceImp.java
.../java/com/brilliance/remit/service/imp/CpdServiceImp.java
+5
-7
RemitServiceImp.java
...ava/com/brilliance/remit/service/imp/RemitServiceImp.java
+0
-52
controller.vm
src/main/resources/controller.vm
+3
-2
serviceImp.vm
src/main/resources/serviceImp.vm
+4
-6
No files found.
src/main/java/com/brilliance/remit/controller/CpdController.java
View file @
fb073d85
...
@@ -20,8 +20,9 @@ import com.brilliance.remit.service.CpdService;
...
@@ -20,8 +20,9 @@ import com.brilliance.remit.service.CpdService;
/**
/**
This java was generated by Auto Generator.
This java was generated by Auto Generator.
created at time 2018-12-17 17:
14:05
created at time 2018-12-17 17:
38:42
**/
**/
@RequestMapping
(
"cpd"
)
@Controller
@Controller
public
class
CpdController
{
public
class
CpdController
{
@Autowired
@Autowired
...
@@ -30,8 +31,8 @@ public class CpdController {
...
@@ -30,8 +31,8 @@ public class CpdController {
private
static
final
Log
log
=
LogFactory
.
getLog
(
CpdController
.
class
);
private
static
final
Log
log
=
LogFactory
.
getLog
(
CpdController
.
class
);
@ResponseBody
@ResponseBody
@RequestMapping
(
value
=
"/
cpd
"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/
test
"
,
method
=
RequestMethod
.
POST
)
public
Object
login
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
public
Object
test
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
/**
/**
you can do business hanle here.
you can do business hanle here.
**/
**/
...
...
src/main/java/com/brilliance/remit/controller/RemitController.java
deleted
100644 → 0
View file @
12ade8bd
package
com
.
brilliance
.
remit
.
controller
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.brilliance.remit.common.response.ErrorCodes
;
import
com.brilliance.remit.common.response.ResultUtil
;
import
com.brilliance.remit.service.RemitService
;
@Controller
public
class
RemitController
{
@Autowired
private
RemitService
remitService
;
private
static
final
Log
log
=
LogFactory
.
getLog
(
RemitController
.
class
);
@ResponseBody
@RequestMapping
(
value
=
"/test"
,
method
=
RequestMethod
.
GET
)
public
Object
login
(
HttpServletRequest
request
,
HttpSession
session
)
{
remitService
.
save
();
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
"ok"
,
null
);
}
@ResponseBody
@RequestMapping
(
value
=
"/tet1"
,
method
=
RequestMethod
.
GET
)
public
Object
login
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
System
.
out
.
println
(
dataMap
);
remitService
.
save
();
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
"ok"
,
null
);
}
}
src/main/java/com/brilliance/remit/service/CntService.java
View file @
fb073d85
package
com
.
brilliance
.
remit
.
service
;
package
com
.
brilliance
.
remit
.
service
;
public
interface
CntService
{
public
interface
CntService
{
int
getCntIn
r
(
String
nam
);
int
counte
r
(
String
nam
);
}
}
src/main/java/com/brilliance/remit/service/CpdService.java
View file @
fb073d85
...
@@ -2,7 +2,7 @@ package com.brilliance.remit.service;
...
@@ -2,7 +2,7 @@ package com.brilliance.remit.service;
/**
/**
This java was generated by Auto Generator.
This java was generated by Auto Generator.
created at time 2018-12-17 17:
14:05
created at time 2018-12-17 17:
38:41
**/
**/
public
interface
CpdService
{
public
interface
CpdService
{
...
...
src/main/java/com/brilliance/remit/service/RemitService.java
deleted
100644 → 0
View file @
12ade8bd
package
com
.
brilliance
.
remit
.
service
;
public
interface
RemitService
{
public
boolean
save
();
}
src/main/java/com/brilliance/remit/service/imp/CntServiceImpl.java
View file @
fb073d85
...
@@ -16,7 +16,7 @@ public class CntServiceImpl implements CntService {
...
@@ -16,7 +16,7 @@ public class CntServiceImpl implements CntService {
private
CouMapper
couMapper
;
private
CouMapper
couMapper
;
@Override
@Override
public
synchronized
int
getCntIn
r
(
String
nam
)
{
public
synchronized
int
counte
r
(
String
nam
)
{
Cou
cnt
=
couMapper
.
selectByPrimaryKey
(
nam
);
Cou
cnt
=
couMapper
.
selectByPrimaryKey
(
nam
);
if
(
cnt
==
null
)
{
if
(
cnt
==
null
)
{
cnt
=
new
Cou
();
cnt
=
new
Cou
();
...
...
src/main/java/com/brilliance/remit/service/imp/CpdServiceImp.java
View file @
fb073d85
...
@@ -14,9 +14,10 @@ import org.apache.commons.logging.Log;
...
@@ -14,9 +14,10 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
com.brilliance.remit.service.CpdService
;
import
com.brilliance.remit.service.CpdService
;
import
com.brilliance.remit.db.dao.CpdMapper
;
import
com.brilliance.remit.db.dao.CpdMapper
;
import
com.brilliance.remit.service.CntService
;
/**
/**
This java was generated by Auto Generator.
This java was generated by Auto Generator.
created at time 2018-12-17 17:
14:05
created at time 2018-12-17 17:
38:41
**/
**/
@Service
(
"cpdService"
)
@Service
(
"cpdService"
)
...
@@ -26,25 +27,22 @@ public class CpdServiceImp implements CpdService {
...
@@ -26,25 +27,22 @@ public class CpdServiceImp implements CpdService {
@Resource
(
name
=
"txManager"
)
@Resource
(
name
=
"txManager"
)
private
DataSourceTransactionManager
transactionManager
;
private
DataSourceTransactionManager
transactionManager
;
private
CntService
cntService
=
(
CntService
)
SpringContextUtil
.
getApplicationContext
().
getBean
(
CntService
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(
CpdServiceImp
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(
CpdServiceImp
.
class
);
@Override
@Override
public
void
sample
()
{
public
void
sample
()
{
CntService
cntService
=
(
CntService
)
SpringContextUtil
.
getApplicationContext
().
getBean
(
CntService
.
class
);
// 事务操作
// 事务操作
TransactionStatus
status
=
transactionManager
.
getTransaction
(
DbUtil
.
getDbDefinition
());
TransactionStatus
status
=
transactionManager
.
getTransaction
(
DbUtil
.
getDbDefinition
());
try
{
try
{
//you can do business hanle herer
//
you can do business hanle herer
transactionManager
.
commit
(
status
);
transactionManager
.
commit
(
status
);
// get inr method
// get inr method
cntService
.
getCntIn
r
(
"XXX"
);
cntService
.
counte
r
(
"XXX"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
log
.
error
(
"error"
,
e
);
transactionManager
.
rollback
(
status
);
transactionManager
.
rollback
(
status
);
}
}
}
}
}
}
src/main/java/com/brilliance/remit/service/imp/RemitServiceImp.java
deleted
100644 → 0
View file @
12ade8bd
package
com
.
brilliance
.
remit
.
service
.
imp
;
import
javax.annotation.Resource
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.TransactionStatus
;
import
com.brilliance.remit.common.util.DbUtil
;
import
com.brilliance.remit.common.util.SpringContextUtil
;
import
com.brilliance.remit.db.dao.CpdMapper
;
import
com.brilliance.remit.db.dao.TrnMapper
;
import
com.brilliance.remit.db.model.Cpd
;
import
com.brilliance.remit.service.CntService
;
import
com.brilliance.remit.service.RemitService
;
@Service
(
"remitService"
)
public
class
RemitServiceImp
implements
RemitService
{
@Autowired
private
CpdMapper
cpdMapper
;
@Autowired
private
TrnMapper
trnMapper
;
private
static
int
i
=
10
;
@Resource
(
name
=
"txManager"
)
private
DataSourceTransactionManager
transactionManager
;
private
CntService
cntService
=
(
CntService
)
SpringContextUtil
.
getApplicationContext
().
getBean
(
CntService
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(
RemitServiceImp
.
class
);
@Override
public
boolean
save
()
{
// 事务操作
TransactionStatus
status
=
transactionManager
.
getTransaction
(
DbUtil
.
getDbDefinition
());
try
{
Cpd
cpd
=
new
Cpd
();
cpd
.
setINR
(
String
.
valueOf
(
i
));
i
++;
cpdMapper
.
insert
(
cpd
);
cntService
.
getCntInr
(
"AAA"
);
transactionManager
.
commit
(
status
);
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
transactionManager
.
rollback
(
status
);
return
false
;
}
return
true
;
}
}
src/main/resources/controller.vm
View file @
fb073d85
...
@@ -22,6 +22,7 @@ import com.brilliance.remit.service.${entity.name}Service;
...
@@ -22,6 +22,7 @@ import com.brilliance.remit.service.${entity.name}Service;
This
java
was
generated
by
Auto
Generator
.
This
java
was
generated
by
Auto
Generator
.
created
at
time
${
entity
.
date
}
created
at
time
${
entity
.
date
}
**/
**/
@
RequestMapping
(
"${entity.lowerName}"
)
@
Controller
@
Controller
public
class
${
entity
.
name
}
Controller
{
public
class
${
entity
.
name
}
Controller
{
@
Autowired
@
Autowired
...
@@ -30,8 +31,8 @@ public class ${entity.name}Controller {
...
@@ -30,8 +31,8 @@ public class ${entity.name}Controller {
private
static
final
Log
log
=
LogFactory
.
getLog
(${
entity
.
name
}
Controller
.
class
);
private
static
final
Log
log
=
LogFactory
.
getLog
(${
entity
.
name
}
Controller
.
class
);
@
ResponseBody
@
ResponseBody
@
RequestMapping
(
value
=
"/
${entity.lowerName}
"
,
method
=
RequestMethod
.
POST
)
@
RequestMapping
(
value
=
"/
test
"
,
method
=
RequestMethod
.
POST
)
public
Object
login
(@
RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
public
Object
test
(@
RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
/**
/**
you
can
do
business
hanle
here
.
you
can
do
business
hanle
here
.
**/
**/
...
...
src/main/resources/serviceImp.vm
View file @
fb073d85
...
@@ -14,6 +14,7 @@ import org.apache.commons.logging.Log;
...
@@ -14,6 +14,7 @@ import org.apache.commons.logging.Log;
import
org
.
apache
.
commons
.
logging
.
LogFactory
;
import
org
.
apache
.
commons
.
logging
.
LogFactory
;
import
com
.
brilliance
.
remit
.
service
.${
entity
.
name
}
Service
;
import
com
.
brilliance
.
remit
.
service
.${
entity
.
name
}
Service
;
import
com
.
brilliance
.
remit
.
db
.
dao
.${
entity
.
name
}
Mapper
;
import
com
.
brilliance
.
remit
.
db
.
dao
.${
entity
.
name
}
Mapper
;
import
com
.
brilliance
.
remit
.
service
.
CntService
;
/**
/**
This
java
was
generated
by
Auto
Generator
.
This
java
was
generated
by
Auto
Generator
.
created
at
time
${
entity
.
date
}
created
at
time
${
entity
.
date
}
...
@@ -26,25 +27,22 @@ public class ${entity.name}ServiceImp implements ${entity.name}Service {
...
@@ -26,25 +27,22 @@ public class ${entity.name}ServiceImp implements ${entity.name}Service {
@
Resource
(
name
=
"txManager"
)
@
Resource
(
name
=
"txManager"
)
private
DataSourceTransactionManager
transactionManager
;
private
DataSourceTransactionManager
transactionManager
;
private
CntService
cntService
=
(
CntService
)
SpringContextUtil
.
getApplicationContext
().
getBean
(
CntService
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(${
entity
.
name
}
ServiceImp
.
class
);
private
static
Log
log
=
LogFactory
.
getLog
(${
entity
.
name
}
ServiceImp
.
class
);
@
Override
@
Override
public
void
sample
()
{
public
void
sample
()
{
CntService
cntService
=
(
CntService
)
SpringContextUtil
.
getApplicationContext
().
getBean
(
CntService
.
class
);
//
事务操作
//
事务操作
TransactionStatus
status
=
transactionManager
.
getTransaction
(
DbUtil
.
getDbDefinition
());
TransactionStatus
status
=
transactionManager
.
getTransaction
(
DbUtil
.
getDbDefinition
());
try
{
try
{
//
you
can
do
business
hanle
herer
//
you
can
do
business
hanle
herer
transactionManager
.
commit
(
status
);
transactionManager
.
commit
(
status
);
//
get
inr
method
//
get
inr
method
cntService
.
getCntIn
r
(
"XXX"
);
cntService
.
counte
r
(
"XXX"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"error"
,
e
);
log
.
error
(
"error"
,
e
);
transactionManager
.
rollback
(
status
);
transactionManager
.
rollback
(
status
);
}
}
}
}
}
}
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