Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tron-explore
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
张建华@五瓣科技
tron-explore
Commits
843cc04b
Commit
843cc04b
authored
Dec 03, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合约事件功能模块开发
parent
fd5a0cdc
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1348 additions
and
7 deletions
+1348
-7
ContractEventRepository.java
...a/com/wuban/tron/explore/dao/ContractEventRepository.java
+48
-0
TronAccount.java
src/main/java/com/wuban/tron/explore/domain/TronAccount.java
+2
-2
TronActivePermission.java
...a/com/wuban/tron/explore/domain/TronActivePermission.java
+2
-2
TronKeys.java
src/main/java/com/wuban/tron/explore/domain/TronKeys.java
+1
-1
TronOwnerPermission.java
...va/com/wuban/tron/explore/domain/TronOwnerPermission.java
+2
-2
ContractEvent.java
...ain/java/com/wuban/tron/explore/entity/ContractEvent.java
+77
-0
ContractEventExample.java
...ban/tron/explore/entity/example/ContractEventExample.java
+816
-0
ContractEventService.java
.../com/wuban/tron/explore/service/ContractEventService.java
+31
-0
ContractEventServiceImpl.java
...n/tron/explore/service/impl/ContractEventServiceImpl.java
+74
-0
ContractEventMapper.xml
src/main/resources/mapper/ContractEventMapper.xml
+249
-0
ContractEventServiceImplTest.java
...on/explore/service/impl/ContractEventServiceImplTest.java
+37
-0
TronServiceImplTest.java
.../wuban/tron/explore/service/impl/TronServiceImplTest.java
+9
-0
No files found.
src/main/java/com/wuban/tron/explore/dao/ContractEventRepository.java
0 → 100644
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
dao
;
import
com.wuban.tron.explore.entity.ContractEvent
;
import
com.wuban.tron.explore.entity.example.ContractEventExample
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* <core>合约事件DAO</core>
*
* @author sky
* @date 2020/12/3
*/
@Repository
public
interface
ContractEventRepository
{
/**
* 添加合约事件信息
*
* @param record
* @return
*/
int
insert
(
@Param
(
"record"
)
ContractEvent
record
);
/**
* 批量添加合约事件信息
* @param records
* @return
*/
int
batchInsert
(
@Param
(
"records"
)
List
<
ContractEvent
>
records
);
/**
* 根据条件检索记录数
* @param example
* @return
*/
int
countByExample
(
@Param
(
"example"
)
ContractEventExample
example
);
/**
* 根据条件删除记录
*
* @param example
*/
void
deleteByExample
(
@Param
(
"example"
)
ContractEventExample
example
);
}
src/main/java/com/wuban/tron/explore/domain/TronAccount.java
View file @
843cc04b
...
@@ -19,7 +19,7 @@ public class TronAccount {
...
@@ -19,7 +19,7 @@ public class TronAccount {
/* private Long create_time;
/* private Long create_time;
private Long latest_opration_time;
private Long latest_opration_time;
private Long latest_consume_free_time;
private Long latest_consume_free_time;
private ActivePermission active_permission;
private
Tron
ActivePermission active_permission;
private OwnerPermission owner_permission;*/
private
Tron
OwnerPermission owner_permission;*/
}
}
src/main/java/com/wuban/tron/explore/domain/ActivePermission.java
→
src/main/java/com/wuban/tron/explore/domain/
Tron
ActivePermission.java
View file @
843cc04b
...
@@ -11,13 +11,13 @@ import java.util.List;
...
@@ -11,13 +11,13 @@ import java.util.List;
* @date 2020/11/02
* @date 2020/11/02
*/
*/
@Data
@Data
public
class
ActivePermission
{
public
class
Tron
ActivePermission
{
private
String
type
;
private
String
type
;
private
Integer
id
;
private
Integer
id
;
private
String
permission_name
;
private
String
permission_name
;
private
Integer
threshold
;
private
Integer
threshold
;
private
String
operations
;
private
String
operations
;
private
List
<
Keys
>
keys
;
private
List
<
Tron
Keys
>
keys
;
}
}
src/main/java/com/wuban/tron/explore/domain/Keys.java
→
src/main/java/com/wuban/tron/explore/domain/
Tron
Keys.java
View file @
843cc04b
...
@@ -9,7 +9,7 @@ import lombok.Data;
...
@@ -9,7 +9,7 @@ import lombok.Data;
* @date 2020/11/02
* @date 2020/11/02
*/
*/
@Data
@Data
public
class
Keys
{
public
class
Tron
Keys
{
private
String
address
;
private
String
address
;
private
Integer
weight
;
private
Integer
weight
;
}
}
src/main/java/com/wuban/tron/explore/domain/OwnerPermission.java
→
src/main/java/com/wuban/tron/explore/domain/
Tron
OwnerPermission.java
View file @
843cc04b
...
@@ -11,10 +11,10 @@ import java.util.List;
...
@@ -11,10 +11,10 @@ import java.util.List;
* @date 2020/11/02
* @date 2020/11/02
*/
*/
@Data
@Data
public
class
OwnerPermission
{
public
class
Tron
OwnerPermission
{
private
String
permission_name
;
private
String
permission_name
;
private
Integer
threshold
;
private
Integer
threshold
;
private
List
<
Keys
>
keys
;
private
List
<
Tron
Keys
>
keys
;
}
}
src/main/java/com/wuban/tron/explore/entity/ContractEvent.java
0 → 100644
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
entity
;
import
lombok.AccessLevel
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 合约事件
* @author sky
* @date 2020-12-03
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
(
access
=
AccessLevel
.
PRIVATE
)
public
class
ContractEvent
{
/**
*
*/
private
Long
id
;
/**
*
*/
private
String
callerContractAddress
;
/**
*
*/
private
String
result
;
/**
*
*/
private
String
transactionId
;
/**
*
*/
private
String
resultType
;
/**
*
*/
private
Long
blockTimestamp
;
/**
*
*/
private
Integer
blockNumber
;
/**
*
*/
private
String
eventName
;
/**
*
*/
private
String
contractAddress
;
/**
*
*/
private
Integer
eventIndex
;
public
static
ContractEvent
getInstance
()
{
return
ContractEvent
.
builder
()
.
id
(
0L
)
.
callerContractAddress
(
""
)
.
result
(
""
)
.
transactionId
(
""
)
.
resultType
(
""
)
.
blockTimestamp
(
0L
)
.
blockNumber
(
0
)
.
eventName
(
""
)
.
contractAddress
(
""
)
.
eventIndex
(
0
)
.
build
();
}
}
\ No newline at end of file
src/main/java/com/wuban/tron/explore/entity/example/ContractEventExample.java
0 → 100644
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
entity
.
example
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 合约事件 查询条件example类
* @author sky
* @date 2020-12-03
*/
public
class
ContractEventExample
{
protected
String
orderByClause
;
protected
boolean
distinct
;
protected
List
<
Criteria
>
oredCriteria
;
public
ContractEventExample
()
{
oredCriteria
=
new
ArrayList
<>();
}
public
void
setOrderByClause
(
String
orderByClause
)
{
this
.
orderByClause
=
orderByClause
;
}
public
String
getOrderByClause
()
{
return
orderByClause
;
}
public
void
setDistinct
(
boolean
distinct
)
{
this
.
distinct
=
distinct
;
}
public
boolean
isDistinct
()
{
return
distinct
;
}
public
List
<
Criteria
>
getOredCriteria
()
{
return
oredCriteria
;
}
public
void
or
(
Criteria
criteria
)
{
oredCriteria
.
add
(
criteria
);
}
public
Criteria
or
()
{
Criteria
criteria
=
createCriteriaInternal
();
oredCriteria
.
add
(
criteria
);
return
criteria
;
}
public
Criteria
createCriteria
()
{
Criteria
criteria
=
createCriteriaInternal
();
if
(
oredCriteria
.
size
()
==
0
)
{
oredCriteria
.
add
(
criteria
);
}
return
criteria
;
}
protected
Criteria
createCriteriaInternal
()
{
Criteria
criteria
=
new
Criteria
();
return
criteria
;
}
public
void
clear
()
{
oredCriteria
.
clear
();
orderByClause
=
null
;
distinct
=
false
;
}
protected
abstract
static
class
GeneratedCriteria
{
protected
List
<
Criterion
>
criteria
;
protected
GeneratedCriteria
()
{
super
();
criteria
=
new
ArrayList
<
Criterion
>();
}
public
boolean
isValid
()
{
return
criteria
.
size
()
>
0
;
}
public
List
<
Criterion
>
getAllCriteria
()
{
return
criteria
;
}
public
List
<
Criterion
>
getCriteria
()
{
return
criteria
;
}
protected
void
addCriterion
(
String
condition
)
{
if
(
condition
==
null
)
{
throw
new
RuntimeException
(
"Value for condition cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
));
}
protected
void
addCriterion
(
String
condition
,
Object
value
,
String
property
)
{
if
(
value
==
null
)
{
throw
new
RuntimeException
(
"Value for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value
));
}
protected
void
addCriterion
(
String
condition
,
Object
value1
,
Object
value2
,
String
property
)
{
if
(
value1
==
null
||
value2
==
null
)
{
throw
new
RuntimeException
(
"Between values for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value1
,
value2
));
}
public
Criteria
andIdIsNull
()
{
addCriterion
(
"id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIsNotNull
()
{
addCriterion
(
"id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdEqualTo
(
Long
value
)
{
addCriterion
(
"id ="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"id <>"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id not in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id not between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThan
(
Long
value
)
{
addCriterion
(
"id >"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id >="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThan
(
Long
value
)
{
addCriterion
(
"id <"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id <="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressIsNull
()
{
addCriterion
(
"caller_contract_address is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressIsNotNull
()
{
addCriterion
(
"caller_contract_address is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressEqualTo
(
String
value
)
{
addCriterion
(
"caller_contract_address ="
,
value
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressNotEqualTo
(
String
value
)
{
addCriterion
(
"caller_contract_address <>"
,
value
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressIn
(
List
<
String
>
values
)
{
addCriterion
(
"caller_contract_address in"
,
values
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"caller_contract_address not in"
,
values
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"caller_contract_address between"
,
value1
,
value2
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"caller_contract_address not between"
,
value1
,
value2
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressLike
(
String
value
)
{
addCriterion
(
"caller_contract_address like"
,
value
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCallerContractAddressNotLike
(
String
value
)
{
addCriterion
(
"caller_contract_address not like"
,
value
,
"callerContractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultIsNull
()
{
addCriterion
(
"result is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultIsNotNull
()
{
addCriterion
(
"result is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultEqualTo
(
String
value
)
{
addCriterion
(
"result ="
,
value
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultNotEqualTo
(
String
value
)
{
addCriterion
(
"result <>"
,
value
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultIn
(
List
<
String
>
values
)
{
addCriterion
(
"result in"
,
values
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"result not in"
,
values
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"result between"
,
value1
,
value2
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"result not between"
,
value1
,
value2
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultLike
(
String
value
)
{
addCriterion
(
"result like"
,
value
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultNotLike
(
String
value
)
{
addCriterion
(
"result not like"
,
value
,
"result"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdIsNull
()
{
addCriterion
(
"transaction_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdIsNotNull
()
{
addCriterion
(
"transaction_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdEqualTo
(
String
value
)
{
addCriterion
(
"transaction_id ="
,
value
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdNotEqualTo
(
String
value
)
{
addCriterion
(
"transaction_id <>"
,
value
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdIn
(
List
<
String
>
values
)
{
addCriterion
(
"transaction_id in"
,
values
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"transaction_id not in"
,
values
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"transaction_id between"
,
value1
,
value2
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"transaction_id not between"
,
value1
,
value2
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdLike
(
String
value
)
{
addCriterion
(
"transaction_id like"
,
value
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTransactionIdNotLike
(
String
value
)
{
addCriterion
(
"transaction_id not like"
,
value
,
"transactionId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeIsNull
()
{
addCriterion
(
"result_type is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeIsNotNull
()
{
addCriterion
(
"result_type is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeEqualTo
(
String
value
)
{
addCriterion
(
"result_type ="
,
value
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeNotEqualTo
(
String
value
)
{
addCriterion
(
"result_type <>"
,
value
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeIn
(
List
<
String
>
values
)
{
addCriterion
(
"result_type in"
,
values
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"result_type not in"
,
values
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"result_type between"
,
value1
,
value2
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"result_type not between"
,
value1
,
value2
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeLike
(
String
value
)
{
addCriterion
(
"result_type like"
,
value
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResultTypeNotLike
(
String
value
)
{
addCriterion
(
"result_type not like"
,
value
,
"resultType"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampIsNull
()
{
addCriterion
(
"block_timestamp is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampIsNotNull
()
{
addCriterion
(
"block_timestamp is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampEqualTo
(
Long
value
)
{
addCriterion
(
"block_timestamp ="
,
value
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampNotEqualTo
(
Long
value
)
{
addCriterion
(
"block_timestamp <>"
,
value
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampIn
(
List
<
Long
>
values
)
{
addCriterion
(
"block_timestamp in"
,
values
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"block_timestamp not in"
,
values
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"block_timestamp between"
,
value1
,
value2
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"block_timestamp not between"
,
value1
,
value2
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampGreaterThan
(
Long
value
)
{
addCriterion
(
"block_timestamp >"
,
value
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"block_timestamp >="
,
value
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampLessThan
(
Long
value
)
{
addCriterion
(
"block_timestamp <"
,
value
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockTimestampLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"block_timestamp <="
,
value
,
"blockTimestamp"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberIsNull
()
{
addCriterion
(
"block_number is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberIsNotNull
()
{
addCriterion
(
"block_number is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberEqualTo
(
Integer
value
)
{
addCriterion
(
"block_number ="
,
value
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberNotEqualTo
(
Integer
value
)
{
addCriterion
(
"block_number <>"
,
value
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"block_number in"
,
values
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"block_number not in"
,
values
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"block_number between"
,
value1
,
value2
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"block_number not between"
,
value1
,
value2
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberGreaterThan
(
Integer
value
)
{
addCriterion
(
"block_number >"
,
value
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"block_number >="
,
value
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberLessThan
(
Integer
value
)
{
addCriterion
(
"block_number <"
,
value
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andBlockNumberLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"block_number <="
,
value
,
"blockNumber"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameIsNull
()
{
addCriterion
(
"event_name is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameIsNotNull
()
{
addCriterion
(
"event_name is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameEqualTo
(
String
value
)
{
addCriterion
(
"event_name ="
,
value
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameNotEqualTo
(
String
value
)
{
addCriterion
(
"event_name <>"
,
value
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameIn
(
List
<
String
>
values
)
{
addCriterion
(
"event_name in"
,
values
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"event_name not in"
,
values
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"event_name between"
,
value1
,
value2
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"event_name not between"
,
value1
,
value2
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameLike
(
String
value
)
{
addCriterion
(
"event_name like"
,
value
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventNameNotLike
(
String
value
)
{
addCriterion
(
"event_name not like"
,
value
,
"eventName"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressIsNull
()
{
addCriterion
(
"contract_address is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressIsNotNull
()
{
addCriterion
(
"contract_address is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressEqualTo
(
String
value
)
{
addCriterion
(
"contract_address ="
,
value
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressNotEqualTo
(
String
value
)
{
addCriterion
(
"contract_address <>"
,
value
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressIn
(
List
<
String
>
values
)
{
addCriterion
(
"contract_address in"
,
values
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"contract_address not in"
,
values
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"contract_address between"
,
value1
,
value2
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"contract_address not between"
,
value1
,
value2
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressLike
(
String
value
)
{
addCriterion
(
"contract_address like"
,
value
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andContractAddressNotLike
(
String
value
)
{
addCriterion
(
"contract_address not like"
,
value
,
"contractAddress"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexIsNull
()
{
addCriterion
(
"event_index is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexIsNotNull
()
{
addCriterion
(
"event_index is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexEqualTo
(
Integer
value
)
{
addCriterion
(
"event_index ="
,
value
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexNotEqualTo
(
Integer
value
)
{
addCriterion
(
"event_index <>"
,
value
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"event_index in"
,
values
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"event_index not in"
,
values
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"event_index between"
,
value1
,
value2
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"event_index not between"
,
value1
,
value2
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexGreaterThan
(
Integer
value
)
{
addCriterion
(
"event_index >"
,
value
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"event_index >="
,
value
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexLessThan
(
Integer
value
)
{
addCriterion
(
"event_index <"
,
value
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andEventIndexLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"event_index <="
,
value
,
"eventIndex"
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldIsNull
(
final
String
fieldName
)
{
addCriterion
(
fieldName
+
" is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldIsNotNull
(
final
String
fieldName
)
{
addCriterion
(
fieldName
+
" is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldEqualTo
(
final
String
fieldName
,
final
Object
fieldValue
)
{
addCriterion
(
fieldName
+
" = "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldNotEqualTo
(
final
String
fieldName
,
final
Object
fieldValue
)
{
addCriterion
(
fieldName
+
" <> "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldIn
(
final
String
fieldName
,
final
List
<
Object
>
values
)
{
addCriterion
(
fieldName
+
" in "
,
values
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldNotIn
(
final
String
fieldName
,
final
List
<
Object
>
values
)
{
addCriterion
(
fieldName
+
" not in "
,
values
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldBetween
(
final
String
fieldName
,
final
Object
fieldValue1
,
final
Object
fieldValue2
)
{
addCriterion
(
fieldName
+
" between "
,
fieldValue1
,
fieldValue2
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldNotBetween
(
final
String
fieldName
,
final
Object
fieldValue1
,
final
Object
fieldValue2
)
{
addCriterion
(
fieldName
+
" not between "
,
fieldValue1
,
fieldValue2
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldGreaterThan
(
final
String
fieldName
,
final
Object
fieldValue
)
{
addCriterion
(
fieldName
+
" > "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldGreaterThanOrEqualTo
(
final
String
fieldName
,
final
Object
fieldValue
)
{
addCriterion
(
fieldName
+
" >= "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldLessThan
(
final
String
fieldName
,
final
Object
fieldValue
)
{
addCriterion
(
fieldName
+
" < "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldLessThanOrEqualTo
(
final
String
fieldName
,
final
Object
fieldValue
)
{
addCriterion
(
fieldName
+
" <= "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldLike
(
final
String
fieldName
,
final
String
fieldValue
)
{
addCriterion
(
fieldName
+
" like "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
public
Criteria
andFieldNotLike
(
final
String
fieldName
,
final
String
fieldValue
)
{
addCriterion
(
fieldName
+
" not like "
,
fieldValue
,
fieldName
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
protected
Criteria
()
{
super
();
}
}
public
static
class
Criterion
{
private
String
condition
;
private
Object
value
;
private
Object
secondValue
;
private
boolean
noValue
;
private
boolean
singleValue
;
private
boolean
betweenValue
;
private
boolean
listValue
;
private
String
typeHandler
;
public
String
getCondition
()
{
return
condition
;
}
public
Object
getValue
()
{
return
value
;
}
public
Object
getSecondValue
()
{
return
secondValue
;
}
public
boolean
isNoValue
()
{
return
noValue
;
}
public
boolean
isSingleValue
()
{
return
singleValue
;
}
public
boolean
isBetweenValue
()
{
return
betweenValue
;
}
public
boolean
isListValue
()
{
return
listValue
;
}
public
String
getTypeHandler
()
{
return
typeHandler
;
}
protected
Criterion
(
String
condition
)
{
super
();
this
.
condition
=
condition
;
this
.
typeHandler
=
null
;
this
.
noValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
typeHandler
=
typeHandler
;
if
(
value
instanceof
List
<?>)
{
this
.
listValue
=
true
;
}
else
{
this
.
singleValue
=
true
;
}
}
protected
Criterion
(
String
condition
,
Object
value
)
{
this
(
condition
,
value
,
null
);
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
secondValue
=
secondValue
;
this
.
typeHandler
=
typeHandler
;
this
.
betweenValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
)
{
this
(
condition
,
value
,
secondValue
,
null
);
}
}
}
src/main/java/com/wuban/tron/explore/service/ContractEventService.java
0 → 100644
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
service
;
import
com.wuban.tron.explore.domain.TronTransEvent
;
import
com.wuban.tron.explore.entity.ContractEvent
;
import
java.util.List
;
/**
* <core>合约事件服务接口</core>
*
* @author sky
* @date 2020/12/3
*/
public
interface
ContractEventService
{
/**
* 添加合约事件信息
* @param record
* @return
*/
int
insert
(
ContractEvent
record
);
/**
* 批量添加合约事件信息
* @param list
* @return
*/
int
batchInsert
(
List
<
TronTransEvent
>
list
);
}
src/main/java/com/wuban/tron/explore/service/impl/ContractEventServiceImpl.java
0 → 100644
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.google.gson.JsonObject
;
import
com.wuban.tron.explore.dao.ContractEventRepository
;
import
com.wuban.tron.explore.domain.TronTransEvent
;
import
com.wuban.tron.explore.entity.ContractEvent
;
import
com.wuban.tron.explore.entity.example.ContractEventExample
;
import
com.wuban.tron.explore.service.ContractEventService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* <core>合约事件服务接口实现类</core>
*
* @author sky
* @date 2020/12/3
*/
@Service
@RequiredArgsConstructor
(
onConstructor_
=
@Autowired
)
public
class
ContractEventServiceImpl
implements
ContractEventService
{
private
final
ContractEventRepository
contractEventRepository
;
@Override
public
int
insert
(
ContractEvent
record
)
{
return
this
.
contractEventRepository
.
insert
(
record
);
}
@Override
public
int
batchInsert
(
List
<
TronTransEvent
>
records
)
{
List
<
ContractEvent
>
list
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
records
))
{
/*
根据合约地址查询表(tron_contract_event)中是否存在记录,如果存在删除记录
*/
String
contractAddress
=
records
.
get
(
0
).
getContract_address
();
ContractEventExample
example
=
new
ContractEventExample
();
example
.
createCriteria
().
andContractAddressEqualTo
(
contractAddress
);
int
count
=
this
.
contractEventRepository
.
countByExample
(
example
);
if
(
count
!=
0
)
{
this
.
contractEventRepository
.
deleteByExample
(
example
);
}
records
.
forEach
(
o
->
{
ContractEvent
event
=
new
ContractEvent
();
event
.
setBlockNumber
(
o
.
getBlock_number
());
event
.
setBlockTimestamp
(
o
.
getBlock_timestamp
());
event
.
setCallerContractAddress
(
o
.
getCaller_contract_address
());
event
.
setContractAddress
(
o
.
getContract_address
());
event
.
setEventIndex
(
o
.
getEvent_index
());
event
.
setEventName
(
o
.
getEvent_name
());
event
.
setTransactionId
(
o
.
getTransaction_id
());
String
result
=
JSON
.
toJSONString
(
o
.
getResult
());
String
resultType
=
JSON
.
toJSONString
(
o
.
getResult_type
());
event
.
setResult
(
result
);
event
.
setResultType
(
resultType
);
list
.
add
(
event
);
});
}
return
this
.
contractEventRepository
.
batchInsert
(
list
);
}
}
src/main/resources/mapper/ContractEventMapper.xml
0 → 100644
View file @
843cc04b
<?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=
"com.wuban.tron.explore.dao.ContractEventRepository"
>
<!-- CodeBuilder Generated-->
<resultMap
id=
"ContractEventMap"
type=
"com.wuban.tron.explore.entity.ContractEvent"
>
<result
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"caller_contract_address"
property=
"callerContractAddress"
jdbcType=
"VARCHAR"
/>
<result
column=
"result"
property=
"result"
jdbcType=
"VARCHAR"
/>
<result
column=
"transaction_id"
property=
"transactionId"
jdbcType=
"VARCHAR"
/>
<result
column=
"result_type"
property=
"resultType"
jdbcType=
"VARCHAR"
/>
<result
column=
"block_timestamp"
property=
"blockTimestamp"
jdbcType=
"BIGINT"
/>
<result
column=
"block_number"
property=
"blockNumber"
jdbcType=
"INTEGER"
/>
<result
column=
"event_name"
property=
"eventName"
jdbcType=
"VARCHAR"
/>
<result
column=
"contract_address"
property=
"contractAddress"
jdbcType=
"VARCHAR"
/>
<result
column=
"event_index"
property=
"eventIndex"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
suffix=
")"
prefixOverrides=
"and"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
collection=
"criterion.value"
item=
"listItem"
open=
"("
close=
")"
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Table_Name"
>
tron_contract_event
</sql>
<sql
id=
"Base_Column_List_Without_Id"
>
id , caller_contract_address , result , transaction_id , result_type , block_timestamp , block_number , event_name , contract_address , event_index
</sql>
<sql
id=
"Base_Column_List"
>
<include
refid=
"Base_Column_List_Without_Id"
/>
</sql>
<sql
id=
"Insert_Columns"
>
<if
test=
"record.id != null"
>
id,
</if>
<if
test=
"record.callerContractAddress != null"
>
caller_contract_address,
</if>
<if
test=
"record.result != null"
>
result,
</if>
<if
test=
"record.transactionId != null"
>
transaction_id,
</if>
<if
test=
"record.resultType != null"
>
result_type,
</if>
<if
test=
"record.blockTimestamp != null"
>
block_timestamp,
</if>
<if
test=
"record.blockNumber != null"
>
block_number,
</if>
<if
test=
"record.eventName != null"
>
event_name,
</if>
<if
test=
"record.contractAddress != null"
>
contract_address,
</if>
<if
test=
"record.eventIndex != null"
>
event_index,
</if>
</sql>
<sql
id=
"Insert_Values"
>
<if
test=
"record.id != null"
>
#{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.callerContractAddress != null"
>
#{record.callerContractAddress,jdbcType=VARCHAR},
</if>
<if
test=
"record.result != null"
>
#{record.result,jdbcType=VARCHAR},
</if>
<if
test=
"record.transactionId != null"
>
#{record.transactionId,jdbcType=VARCHAR},
</if>
<if
test=
"record.resultType != null"
>
#{record.resultType,jdbcType=VARCHAR},
</if>
<if
test=
"record.blockTimestamp != null"
>
#{record.blockTimestamp,jdbcType=BIGINT},
</if>
<if
test=
"record.blockNumber != null"
>
#{record.blockNumber,jdbcType=INTEGER},
</if>
<if
test=
"record.eventName != null"
>
#{record.eventName,jdbcType=VARCHAR},
</if>
<if
test=
"record.contractAddress != null"
>
#{record.contractAddress,jdbcType=VARCHAR},
</if>
<if
test=
"record.eventIndex != null"
>
#{record.eventIndex,jdbcType=INTEGER},
</if>
</sql>
<sql
id=
"Batch_Insert_Values"
>
#{record.id,jdbcType=BIGINT},
#{record.callerContractAddress,jdbcType=VARCHAR},
#{record.result,jdbcType=VARCHAR},
#{record.transactionId,jdbcType=VARCHAR},
#{record.resultType,jdbcType=VARCHAR},
#{record.blockTimestamp,jdbcType=BIGINT},
#{record.blockNumber,jdbcType=INTEGER},
#{record.eventName,jdbcType=VARCHAR},
#{record.contractAddress,jdbcType=VARCHAR},
#{record.eventIndex,jdbcType=INTEGER},
</sql>
<sql
id=
"Batch_Insert_Values_On_DuplicateKey"
>
<include
refid=
"Batch_Insert_Values"
/>
</sql>
<sql
id=
"Update_Set_From_Bean"
>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT} ,
</if>
<if
test=
"record.callerContractAddress != null"
>
caller_contract_address = #{record.callerContractAddress,jdbcType=VARCHAR} ,
</if>
<if
test=
"record.result != null"
>
result = #{record.result,jdbcType=VARCHAR} ,
</if>
<if
test=
"record.transactionId != null"
>
transaction_id = #{record.transactionId,jdbcType=VARCHAR} ,
</if>
<if
test=
"record.resultType != null"
>
result_type = #{record.resultType,jdbcType=VARCHAR} ,
</if>
<if
test=
"record.blockTimestamp != null"
>
block_timestamp = #{record.blockTimestamp,jdbcType=BIGINT} ,
</if>
<if
test=
"record.blockNumber != null"
>
block_number = #{record.blockNumber,jdbcType=INTEGER} ,
</if>
<if
test=
"record.eventName != null"
>
event_name = #{record.eventName,jdbcType=VARCHAR} ,
</if>
<if
test=
"record.contractAddress != null"
>
contract_address = #{record.contractAddress,jdbcType=VARCHAR} ,
</if>
<if
test=
"record.eventIndex != null"
>
event_index = #{record.eventIndex,jdbcType=INTEGER} ,
</if>
</sql>
<!-- insert -->
<insert
id=
"insert"
parameterType=
"java.util.Map"
>
insert into
<include
refid=
"Table_Name"
/>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<include
refid=
"Insert_Columns"
/>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<include
refid=
"Insert_Values"
/>
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"java.util.Map"
>
insert into
<include
refid=
"Table_Name"
/>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<include
refid=
"Base_Column_List_Without_Id"
/>
</trim>
values
<foreach
collection=
"records"
item=
"record"
index=
"index"
separator=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<include
refid=
"Batch_Insert_Values"
/>
</trim>
</foreach>
</insert>
<insert
id=
"batchInsertOnDuplicateKey"
parameterType=
"java.util.Map"
>
insert into
<include
refid=
"Table_Name"
/>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<include
refid=
"Base_Column_List"
/>
</trim>
values
<foreach
collection=
"records"
item=
"record"
index=
"index"
separator=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<include
refid=
"Batch_Insert_Values_On_DuplicateKey"
/>
</trim>
</foreach>
ON DUPLICATE KEY UPDATE
id = VALUES(id) , caller_contract_address = VALUES(caller_contract_address) , result = VALUES(result) , transaction_id = VALUES(transaction_id) , result_type = VALUES(result_type) , block_timestamp = VALUES(block_timestamp) , block_number = VALUES(block_number) , event_name = VALUES(event_name) , contract_address = VALUES(contract_address) , event_index = VALUES(event_index)
</insert>
<!-- end insert -->
<!-- delete -->
<delete
id=
"deleteById"
parameterType=
"java.util.Map"
>
delete from
<include
refid=
"Table_Name"
/>
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"java.util.Map"
>
delete from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<delete
id=
"deleteIn"
parameterType=
"java.util.Map"
>
delete from
<include
refid=
"Table_Name"
/>
where id in
<foreach
collection=
"records"
item=
"record"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{record.id,jdbcType=BIGINT}
</foreach>
</delete>
<!-- end delete -->
<!-- update -->
<update
id=
"updateById"
parameterType=
"java.util.Map"
>
update
<include
refid=
"Table_Name"
/>
<set>
<include
refid=
"Update_Set_From_Bean"
/>
</set>
where id = #{record.id,jdbcType=BIGINT}
</update>
<update
id=
"updateByExample"
parameterType=
"java.util.Map"
>
update
<include
refid=
"Table_Name"
/>
<set>
<include
refid=
"Update_Set_From_Bean"
/>
</set>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</update>
<update
id=
"batchUpdate"
parameterType=
"java.util.Map"
>
<foreach
collection=
"records"
item=
"record"
index=
"index"
open=
""
close=
""
separator=
";"
>
update
<include
refid=
"Table_Name"
/>
<set>
<include
refid=
"Update_Set_From_Bean"
/>
</set>
where id=#{record.id,jdbcType=BIGINT}
</foreach>
</update>
<!-- end update -->
<!-- select -->
<select
id=
"selectById"
resultMap=
"ContractEventMap"
parameterType=
"java.util.Map"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"Table_Name"
/>
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"selectByExample"
resultMap=
"ContractEventMap"
parameterType=
"java.util.Map"
>
select
<if
test=
"example != null and example.distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"example != null and example.orderByClause != null"
>
order by ${example.orderByClause}
</if>
</select>
<select
id=
"selectOneByExample"
resultMap=
"ContractEventMap"
parameterType=
"java.util.Map"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
limit 1
</select>
<select
id=
"selectIn"
resultMap=
"ContractEventMap"
parameterType=
"java.util.Map"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"Table_Name"
/>
where id IN
<foreach
collection=
"records"
item=
"record"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{record.id,jdbcType=BIGINT}
</foreach>
</select>
<select
id=
"countByExample"
resultType=
"java.lang.Integer"
parameterType=
"java.util.Map"
>
select count(*) as total from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<select
id=
"countByPager"
resultType=
"java.lang.Integer"
parameterType=
"java.util.Map"
>
select count(*) as total from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<select
id=
"selectByPager"
resultMap=
"ContractEventMap"
parameterType=
"java.util.Map"
>
select
<include
refid=
"Base_Column_List"
/>
from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"pager.sortItem != null and pager.sortItem != '' "
>
order by ${pager.sortItem} ${pager.sortType}
</if>
limit #{pager.startIndex} , #{pager.pageSize}
</select>
<!-- end select -->
<!-- My Custom Interfaces -->
</mapper>
src/test/java/com/wuban/tron/explore/service/impl/ContractEventServiceImplTest.java
0 → 100644
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
service
.
impl
;
import
com.wuban.tron.explore.BaseTest
;
import
com.wuban.tron.explore.domain.TronTransEvent
;
import
com.wuban.tron.explore.service.ContractEventService
;
import
com.wuban.tron.explore.service.TronService
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
class
ContractEventServiceImplTest
extends
BaseTest
{
@Autowired
private
TronService
tronService
;
@Autowired
private
ContractEventService
contractEventService
;
@BeforeEach
void
setUp
()
{
}
@Test
void
insert
()
{
}
@Test
void
batchInsert
()
{
List
<
TronTransEvent
>
data
=
this
.
tronService
.
getContractEvent
(
"TMypW2w7P2y8QzV8i9BAE31yzQukp63tbo"
);
this
.
contractEventService
.
batchInsert
(
data
);
}
}
\ No newline at end of file
src/test/java/com/wuban/tron/explore/service/impl/TronServiceImplTest.java
View file @
843cc04b
package
com
.
wuban
.
tron
.
explore
.
service
.
impl
;
package
com
.
wuban
.
tron
.
explore
.
service
.
impl
;
import
com.wuban.tron.explore.domain.*
;
import
com.wuban.tron.explore.domain.*
;
import
com.wuban.tron.explore.entity.ContractEvent
;
import
com.wuban.tron.explore.service.ContractEventService
;
import
com.wuban.tron.explore.service.TronService
;
import
com.wuban.tron.explore.service.TronService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.platform.commons.util.StringUtils
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.util.CollectionUtils
;
import
org.tron.common.utils.ByteArray
;
import
org.tron.common.utils.ByteArray
;
import
org.tron.walletserver.WalletApi
;
import
org.tron.walletserver.WalletApi
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
...
@@ -21,6 +27,9 @@ class TronServiceImplTest {
...
@@ -21,6 +27,9 @@ class TronServiceImplTest {
@Autowired
@Autowired
private
TronService
tronService
;
private
TronService
tronService
;
@Autowired
private
ContractEventService
contractEventService
;
@Test
@Test
void
getBlockByNum
()
{
void
getBlockByNum
()
{
TronResponseData
data
=
this
.
tronService
.
getBlockByNum
(
850000L
);
TronResponseData
data
=
this
.
tronService
.
getBlockByNum
(
850000L
);
...
...
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