Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
kmr-h5-java
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b7b44628
authored
2017-12-03 13:42:22 +0800
by
joe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加分享次数
1 parent
3d76e1df
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
0 deletions
kmr_dp_HDP/src/main/java/com/example/controller/ScoreLogInfoController.java
kmr_dp_HDP/src/main/java/com/example/mapper/ShareLogMapper.java
kmr_dp_HDP/src/main/java/com/example/models/ShareLog.java
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoService.java
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoServiceImpl.java
kmr_dp_HDP/src/main/resources/mappers/ShareLogMapper.xml
kmr_dp_HDP/src/main/java/com/example/controller/ScoreLogInfoController.java
View file @
b7b4462
This diff is collapsed.
Click to expand it.
kmr_dp_HDP/src/main/java/com/example/mapper/ShareLogMapper.java
0 → 100644
View file @
b7b4462
package
com
.
example
.
mapper
;
import
org.apache.ibatis.annotations.Param
;
import
com.example.models.ShareLog
;
/**
* Created by JA on 17/7/17.
*/
public
interface
ShareLogMapper
{
boolean
create
(
ShareLog
shareLog
);
long
countByDay
(
@Param
(
"openid"
)
String
openid
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
);
}
kmr_dp_HDP/src/main/java/com/example/models/ShareLog.java
0 → 100644
View file @
b7b4462
package
com
.
example
.
models
;
import
java.util.Date
;
/**
* Created by JA on 17/7/17.
*/
public
class
ShareLog
{
private
Long
id
;
private
String
openid
;
Date
shareTime
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
Date
getShareTime
()
{
return
shareTime
;
}
public
void
setShareTime
(
Date
shareTime
)
{
this
.
shareTime
=
shareTime
;
}
}
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoService.java
View file @
b7b4462
...
...
@@ -16,6 +16,11 @@ public interface ScoreLogInfoService {
Map
<
String
,
Object
>
getMyRanking
(
String
openid
);
long
countToDay
(
String
openid
);
long
shareToday
(
String
openid
);
long
countSum
(
String
openid
);
long
saveShare
(
String
openid
);
}
...
...
kmr_dp_HDP/src/main/java/com/example/service/ScoreLogInfoServiceImpl.java
View file @
b7b4462
...
...
@@ -2,8 +2,11 @@ package com.example.service;
import
com.example.mapper.ConfigInfoMapper
;
import
com.example.mapper.ScoreLogInfoMapper
;
import
com.example.mapper.ShareLogMapper
;
import
com.example.models.ConfigInfo
;
import
com.example.models.ScoreLogInfo
;
import
com.example.models.ShareLog
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -25,6 +28,9 @@ public class ScoreLogInfoServiceImpl implements ScoreLogInfoService {
@Autowired
private
ConfigInfoMapper
configInfoMapper
;
@Autowired
private
ShareLogMapper
shareLogMapper
;
@Override
public
String
save
(
ScoreLogInfo
scoreLogInfo
)
{
...
...
@@ -78,11 +84,29 @@ public class ScoreLogInfoServiceImpl implements ScoreLogInfoService {
String
endDate
=
format
+
" 23:59:59"
;
return
this
.
scoreLogInfoMapper
.
countByDay
(
openid
,
startDate
,
endDate
);
}
@Override
public
long
shareToday
(
String
openid
)
{
Date
date
=
new
Date
();
String
format
=
sdf
.
format
(
date
);
String
startDate
=
format
+
" 00:00:00"
;
String
endDate
=
format
+
" 23:59:59"
;
return
this
.
shareLogMapper
.
countByDay
(
openid
,
startDate
,
endDate
);
}
@Override
public
long
countSum
(
String
openid
)
{
return
this
.
scoreLogInfoMapper
.
countSum
(
openid
);
}
@Override
public
long
saveShare
(
String
openid
)
{
ShareLog
shareLog
=
new
ShareLog
();
shareLog
.
setOpenid
(
openid
);
shareLog
.
setShareTime
(
new
Date
());
shareLogMapper
.
create
(
shareLog
);
return
0
;
}
}
...
...
kmr_dp_HDP/src/main/resources/mappers/ShareLogMapper.xml
0 → 100644
View file @
b7b4462
<?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.example.mapper.ShareLogMapper"
>
<insert
id=
"create"
>
insert into `t_kmr_share_log` (
`openid`,
`share_time`
)
values(
#{openid},
#{share_time}
);
</insert>
<select
id=
"countByDay"
resultType=
"long"
>
select count(*) c
from `t_kmr_share_log`
where share_time BETWEEN #{startDate} and #{endDate}
and openid= #{openid};
</select>
</mapper>
\ No newline at end of file
Please
register
or
sign in
to post a comment