Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
chnmuseum-party
Project
Project
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
liqin
chnmuseum-party
Commits
12f2edff
Commit
12f2edff
authored
4 years ago
by
yangtianyou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
展板播放记录统计
parent
819f410b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
523 additions
and
262 deletions
+523
-262
TBoardStatisticMapper.java
...senergy/chnmuseum/party/mapper/TBoardStatisticMapper.java
+32
-7
TBoardPlayTrend.java
...a/cn/wisenergy/chnmuseum/party/model/TBoardPlayTrend.java
+1
-1
TBoardSurvey.java
...java/cn/wisenergy/chnmuseum/party/model/TBoardSurvey.java
+59
-0
TDistrictBoardStatistic.java
...energy/chnmuseum/party/model/TDistrictBoardStatistic.java
+5
-0
TBoardStatisticService.java
...nergy/chnmuseum/party/service/TBoardStatisticService.java
+18
-4
TBoardStatisticServiceImpl.java
...museum/party/service/impl/TBoardStatisticServiceImpl.java
+49
-2
TBoardPlayRankController.java
...museum/party/web/controller/TBoardPlayRankController.java
+177
-177
TBoardStatisticController.java
...useum/party/web/controller/TBoardStatisticController.java
+70
-8
TBoardPlayRankMapper.xml
src/main/resources/mapper/TBoardPlayRankMapper.xml
+0
-22
TBoardPlayTrendMapper.xml
src/main/resources/mapper/TBoardPlayTrendMapper.xml
+0
-20
TBoardStatisticMapper.xml
src/main/resources/mapper/TBoardStatisticMapper.xml
+112
-0
TDistrictBoardStatisticMapper.xml
src/main/resources/mapper/TDistrictBoardStatisticMapper.xml
+0
-21
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/mapper/TBoardStatisticMapper.java
View file @
12f2edff
package
cn
.
wisenergy
.
chnmuseum
.
party
.
mapper
;
import
cn.wisenergy.chnmuseum.party.model.TBoardPlayRank
;
import
cn.wisenergy.chnmuseum.party.model.TBoardPlayTrend
;
import
cn.wisenergy.chnmuseum.party.model.TDistrictBoardStatistic
;
import
cn.wisenergy.chnmuseum.party.model.*
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.wisenergy.chnmuseum.party.model.TBoardStatistic
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
org.mapstruct.Mapper
;
import
java.util.List
;
import
java.util.Map
;
/**
* <pre>
...
...
@@ -27,8 +25,35 @@ public interface TBoardStatisticMapper extends BaseMapper<TBoardStatistic> {
public
List
<
TBoardPlayTrend
>
getBoardTrendPageList
(
Page
<
TBoardPlayTrend
>
page
,
TBoardPlayTrend
trend
);
public
List
<
TDistrictBoardStatistic
>
getBoardDistrictPageList
(
Page
<
TDistrictBoardStatistic
>
page
,
TDistrictBoardStatistic
trend
);
public
List
<
TDistrictBoardStatistic
>
getBoardDistrictPageList
(
Page
<
TDistrictBoardStatistic
>
page
,
TDistrictBoardStatistic
district
);
/**
* 获取展板播放总量
* @param survey
* @return
*/
Integer
getBoardPlayTotal
(
TBoardSurvey
survey
);
/**
* 获取展板总量
* @param survey
* @return
*/
Integer
getBoardTotal
(
TBoardSurvey
survey
);
/**
* 获取播放展板的机构总量
* @param survey
* @return
*/
Integer
getOrganTotal
(
TBoardSurvey
survey
);
/**
* 获取互动总量
* @param survey
* @return
*/
Integer
getInteractionTotal
(
TBoardSurvey
survey
);
List
<
Map
>
getInteractionFrequency
(
Page
page
,
@Param
(
"frequencyDate"
)
String
frequencyDate
);
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/model/TBoardPlayTrend.java
View file @
12f2edff
...
...
@@ -47,7 +47,7 @@ public class TBoardPlayTrend implements Serializable {
@TableField
(
"play_number"
)
private
Integer
playNumber
;
@ApiModelProperty
(
"
播放时间 yyyy 统计周期为年 yyyyMM 统计周期为月
"
)
@ApiModelProperty
(
"
统计时间 yyyy:统计周期为年 yyyyMM:统计周期为月,默认统计当月yyyyMM
"
)
@TableField
(
exist
=
false
)
private
String
playDate
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/model/TBoardSurvey.java
0 → 100644
View file @
12f2edff
package
cn
.
wisenergy
.
chnmuseum
.
party
.
model
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Add
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Update
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* <p>
* 展板统计概览
* </p>
*
* @author Danny Lee
* @since 2021-03-26
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
false
)
@ApiModel
(
value
=
"展板统计概览"
,
description
=
"展板统计概览"
)
public
class
TBoardSurvey
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"统计时间 年:yyyy 或 月: yyyyMM"
)
private
String
statisticDate
;
@ApiModelProperty
(
"地区"
)
private
String
areaId
;
@ApiModelProperty
(
"机构id"
)
private
String
organId
;
@ApiModelProperty
(
"展板总播放量"
)
private
Integer
playCnt
;
@ApiModelProperty
(
"组织单位量"
)
private
Integer
orgCnt
;
@ApiModelProperty
(
"展板数量"
)
private
Integer
boardCnt
;
@ApiModelProperty
(
"互动总量"
)
private
Integer
interactionCnt
;
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/model/TDistrictBoardStatistic.java
View file @
12f2edff
...
...
@@ -42,6 +42,11 @@ public class TDistrictBoardStatistic implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"播放次数"
)
@TableField
(
"play_date"
)
private
String
playDate
;
@ApiModelProperty
(
"播放次数"
)
@TableField
(
"play_number"
)
private
Integer
playNumber
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/service/TBoardStatisticService.java
View file @
12f2edff
package
cn
.
wisenergy
.
chnmuseum
.
party
.
service
;
import
cn.wisenergy.chnmuseum.party.model.TBoardPlayRank
;
import
cn.wisenergy.chnmuseum.party.model.TBoardPlayTrend
;
import
cn.wisenergy.chnmuseum.party.model.TBoardStatistic
;
import
cn.wisenergy.chnmuseum.party.model.TDistrictBoardStatistic
;
import
cn.wisenergy.chnmuseum.party.model.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -50,5 +48,21 @@ public interface TBoardStatisticService extends IService<TBoardStatistic> {
*/
Page
<
TDistrictBoardStatistic
>
getBoardDistrictPageList
(
Page
<
TDistrictBoardStatistic
>
page
,
TDistrictBoardStatistic
district
);
/**
* 获取展板统计概览
* @param survey
* @return
*/
TBoardSurvey
getBoardSurvey
(
@Param
(
"survey"
)
TBoardSurvey
survey
);
/**
* 获取互动频次统计
* @param page
* @param frequencyDate
* @return
*/
Page
getInteractionFrequency
(
Page
page
,
String
frequencyDate
);
List
getBoardProvincePlayTotalList
(
String
organId
);
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/service/impl/TBoardStatisticServiceImpl.java
View file @
12f2edff
...
...
@@ -6,6 +6,7 @@ import cn.wisenergy.chnmuseum.party.common.util.RedisUtil;
import
cn.wisenergy.chnmuseum.party.core.annotations.RedisLock
;
import
cn.wisenergy.chnmuseum.party.model.*
;
import
cn.wisenergy.chnmuseum.party.mapper.TBoardStatisticMapper
;
import
cn.wisenergy.chnmuseum.party.service.TAreaService
;
import
cn.wisenergy.chnmuseum.party.service.TBoardStatisticService
;
import
cn.wisenergy.chnmuseum.party.service.TUserService
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -43,6 +44,9 @@ public class TBoardStatisticServiceImpl extends ServiceImpl<TBoardStatisticMappe
@Autowired
private
TUserService
userService
;
@Autowired
private
TAreaService
areaService
;
@Autowired
private
RedisUtil
redisUtil
;
@Autowired
...
...
@@ -86,8 +90,9 @@ public class TBoardStatisticServiceImpl extends ServiceImpl<TBoardStatisticMappe
}
@Override
public
Page
<
TBoardPlayTrend
>
getBoardTrendPageList
(
Page
<
TBoardPlayTrend
>
page
,
TBoardPlayTrend
rank
)
{
page
.
setRecords
(
boardStatisticMapper
.
getBoardTrendPageList
(
page
,
rank
));
public
Page
<
TBoardPlayTrend
>
getBoardTrendPageList
(
Page
<
TBoardPlayTrend
>
page
,
TBoardPlayTrend
trend
)
{
page
.
setRecords
(
boardStatisticMapper
.
getBoardTrendPageList
(
page
,
trend
));
return
page
;
}
...
...
@@ -98,6 +103,48 @@ public class TBoardStatisticServiceImpl extends ServiceImpl<TBoardStatisticMappe
return
page
;
}
@Override
public
TBoardSurvey
getBoardSurvey
(
TBoardSurvey
survey
){
// 获取展板播放量
survey
.
setPlayCnt
(
boardStatisticMapper
.
getBoardPlayTotal
(
survey
));
// 获取展板总数
survey
.
setBoardCnt
(
boardStatisticMapper
.
getBoardTotal
(
survey
));
// 获取播放展板的机构总数
survey
.
setOrgCnt
(
boardStatisticMapper
.
getOrganTotal
(
survey
));
// 获取互动总数
survey
.
setInteractionCnt
(
boardStatisticMapper
.
getInteractionTotal
(
survey
));
return
survey
;
}
@Override
public
Page
getInteractionFrequency
(
Page
page
,
String
frequencyDate
){
page
.
setRecords
(
boardStatisticMapper
.
getInteractionFrequency
(
page
,
frequencyDate
));
return
page
;
}
@Override
public
List
getBoardProvincePlayTotalList
(
String
organId
){
// 获取省份信息
QueryWrapper
qw
=
new
QueryWrapper
();
qw
.
eq
(
"type"
,
"P"
);
List
<
TArea
>
provlist
=
areaService
.
list
(
qw
);
// 遍历省份,统计各省播放量
TBoardSurvey
survey
=
new
TBoardSurvey
();
String
dateStr
=
DateUtil
.
getCurrentDate
(
"yyyyMM"
);
survey
.
setStatisticDate
(
dateStr
);
survey
.
setOrganId
(
organId
);
List
list
=
new
ArrayList
();
// 根据省份查询播放量
for
(
TArea
prov
:
provlist
){
Map
map
=
new
HashMap
();
survey
.
setAreaId
(
prov
.
getId
().
toString
().
substring
(
0
,
2
));
Integer
cnt
=
boardStatisticMapper
.
getBoardPlayTotal
(
survey
);
map
.
put
(
"name"
,
prov
.
getName
());
map
.
put
(
"value"
,
cnt
==
null
?
0
:
cnt
);
list
.
add
(
map
);
}
return
list
;
}
/**
* 更新展板统计信息
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/TBoardPlayRankController.java
View file @
12f2edff
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/TBoardStatisticController.java
View file @
12f2edff
package
cn
.
wisenergy
.
chnmuseum
.
party
.
web
.
controller
;
import
cn.wisenergy.chnmuseum.party.common.util.DateUtil
;
import
cn.wisenergy.chnmuseum.party.model.TBoardPlayRank
;
import
cn.wisenergy.chnmuseum.party.model.TBoardPlayTrend
;
import
cn.wisenergy.chnmuseum.party.model.TDistrictBoardStatistic
;
import
cn.wisenergy.chnmuseum.party.model.*
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
cn.wisenergy.chnmuseum.party.web.controller.base.BaseController
;
import
cn.wisenergy.chnmuseum.party.model.TBoardStatistic
;
import
cn.wisenergy.chnmuseum.party.service.TBoardStatisticService
;
import
cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Add
;
...
...
@@ -28,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.validation.constraints.NotNull
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -48,7 +47,19 @@ public class TBoardStatisticController extends BaseController {
@Resource
private
TBoardStatisticService
tBoardStatisticService
;
// @ApiImplicitParams(value = {
// @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
// @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
// })
@PostMapping
(
"/getBoardSurvey"
)
@RequiresPermissions
(
"t:board:statistic:survey"
)
@ApiOperation
(
value
=
"获取展板统计概况"
,
notes
=
"获取展板统计概况"
)
public
Map
<
String
,
Object
>
getBoardSurvey
(
TBoardSurvey
survey
)
{
TBoardSurvey
result
=
this
.
tBoardStatisticService
.
getBoardSurvey
(
survey
);
return
getResult
(
result
);
}
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"_index"
,
value
=
"分页起始偏移量"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
...
...
@@ -74,15 +85,23 @@ public class TBoardStatisticController extends BaseController {
@RequiresPermissions
(
"t:board:statistic:trendPage"
)
@ApiOperation
(
value
=
"获取展板播放趋势"
,
notes
=
"获取展板播放趋势"
)
public
Map
<
String
,
Object
>
getBoardTrendPageList
(
TBoardPlayTrend
trend
)
{
// 如果查询日志为空,则默认当月
if
(
StringUtils
.
isEmpty
(
trend
.
getPlayDate
())){
t
hrow
new
RuntimeException
(
"统计周期时间不能为空"
);
t
rend
.
setPlayDate
(
DateUtil
.
getCurrentDate
(
"yyyyMM"
)
);
}
Page
<
TBoardPlayTrend
>
page
=
this
.
tBoardStatisticService
.
getBoardTrendPageList
(
getPage
(),
trend
);
for
(
TBoardPlayTrend
tBoardStatistic
:
page
.
getRecords
())
{
// 处理数据为展板趋势图
Map
map
=
new
HashMap
();
List
dateList
=
new
ArrayList
();
List
cntList
=
new
ArrayList
();
for
(
TBoardPlayTrend
t
:
page
.
getRecords
())
{
dateList
.
add
(
t
.
getPlayDate
());
cntList
.
add
(
t
.
getPlayNumber
());
}
return
getResult
(
page
);
map
.
put
(
"dateList"
,
dateList
);
map
.
put
(
"cntList"
,
cntList
);
return
getResult
(
map
);
}
...
...
@@ -101,6 +120,49 @@ public class TBoardStatisticController extends BaseController {
}
return
getResult
(
page
);
}
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"_index"
,
value
=
"分页起始偏移量"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"_size"
,
value
=
"返回条数"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"organId"
,
value
=
"统计机构"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@PostMapping
(
"/getBoardProvincePlayTotalList"
)
@RequiresPermissions
(
"t:board:statistic:provPlayList"
)
@ApiOperation
(
value
=
"获取省级展板播放统计"
,
notes
=
"获取省级展板播放统计"
)
public
Map
<
String
,
Object
>
getBoardProvincePlayTotalList
(
String
organId
)
{
List
list
=
this
.
tBoardStatisticService
.
getBoardProvincePlayTotalList
(
organId
);
return
getResult
(
list
);
}
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"_index"
,
value
=
"分页起始偏移量"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"_size"
,
value
=
"返回条数"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"frequencyDate"
,
value
=
"互动统计时间 年:yyyy 月:yyyyMM,默认当月"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@PostMapping
(
"/getInteractionFrequencyPageList"
)
@RequiresPermissions
(
"t:board:statistic:districtPage"
)
@ApiOperation
(
value
=
"获取互动频次统计信息"
,
notes
=
"获取互动频次统计信息"
)
public
Map
<
String
,
Object
>
getInteractionFrequencyPageList
(
String
frequencyDate
)
{
if
(
StringUtils
.
isEmpty
(
frequencyDate
)){
frequencyDate
=
DateUtil
.
getCurrentDate
(
"yyyyMM"
);
}
Page
page
=
this
.
tBoardStatisticService
.
getInteractionFrequency
(
getPage
(),
frequencyDate
);
//
Map
map
=
new
HashMap
();
List
organList
=
new
ArrayList
<>();
List
cntList
=
new
ArrayList
();
for
(
Object
o
:
page
.
getRecords
()){
Map
m
=
(
HashMap
)
o
;
organList
.
add
(
m
.
get
(
"organName"
));
cntList
.
add
(
m
.
get
(
"frequencyCnt"
));
}
map
.
put
(
"organList"
,
organList
);
map
.
put
(
"cntList"
,
cntList
);
map
.
put
(
"page"
,
page
);
return
getResult
(
map
);
}
//
// @PostMapping("/batchSave")
// @RequiresPermissions("t:board:statistic:batch:save")
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/TBoardPlayRankMapper.xml
deleted
100644 → 0
View file @
819f410b
<?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=
"cn.wisenergy.chnmuseum.party.mapper.TBoardPlayRankMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"cn.wisenergy.chnmuseum.party.model.TBoardPlayRank"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"board_id"
property=
"boardId"
/>
<result
column=
"board_name"
property=
"boardName"
/>
<result
column=
"play_number"
property=
"playNumber"
/>
<result
column=
"year"
property=
"year"
/>
<result
column=
"month"
property=
"month"
/>
<result
column=
"organ_id"
property=
"organId"
/>
<result
column=
"play_date"
property=
"playDate"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, board_id, board_name, play_number, year, month, organ_id, play_date
</sql>
</mapper>
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/TBoardPlayTrendMapper.xml
deleted
100644 → 0
View file @
819f410b
<?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=
"cn.wisenergy.chnmuseum.party.mapper.TBoardPlayTrendMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"cn.wisenergy.chnmuseum.party.model.TBoardPlayTrend"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"board_id"
property=
"boardId"
/>
<result
column=
"board_name"
property=
"boardName"
/>
<result
column=
"play_number"
property=
"playNumber"
/>
<result
column=
"data_time"
property=
"dataTime"
/>
<result
column=
"organ_id"
property=
"organId"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, board_id, board_name, play_number, data_time, organ_id
</sql>
</mapper>
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/TBoardStatisticMapper.xml
View file @
12f2edff
...
...
@@ -74,9 +74,121 @@
<select
id=
"getBoardDistrictPageList"
resultMap=
"districtMap"
>
SELECT a.name area_name,sum(play_number) play_number,count(board_id) board_cnt from t_board_statistic s
left join t_area a on s.area_id = a.id
<where>
<if
test=
"district.playDate != null and district.playDate.length() == 4"
>
left(play_date,4) = ${district.playDate}
</if>
<if
test=
"district.playDate != null and district.playDate.length() == 6"
>
left(play_date,6) = ${district.playDate}
</if>
<if
test=
"district.playDate != null and district.playDate.length() == 6"
>
play_date = ${district.playDate}
</if>
</where>
GROUP BY area_id
order by sum(play_number) desc,count(board_id) desc
</select>
<!-- 获取展板播放总量 -->
<select
id=
"getBoardPlayTotal"
parameterType=
"cn.wisenergy.chnmuseum.party.model.TBoardSurvey"
resultType=
"java.lang.Integer"
>
SELECT sum(play_number) play_number
from t_board_statistic s
<where>
<if
test=
"statisticDate != null and statisticDate.length() == 4"
>
and left(play_date,4) = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 6"
>
and left(play_date,6) = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 8"
>
and play_date = ${statisticDate}
</if>
<if
test=
"areaId != null"
>
and area_id like concat(#{areaId}, '%')
</if>
<if
test=
"organId != null"
>
and organ_id = #{organId}
</if>
</where>
</select>
<!-- 获取展板总量 -->
<select
id=
"getBoardTotal"
resultType=
"java.lang.Integer"
>
SELECT count( a.board_id )
FROM
( SELECT board_id
FROM t_board_statistic s
<where>
<if
test=
"statisticDate != null and statisticDate.length() == 4"
>
left(play_date,4) = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 6"
>
left(play_date,6) = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 8"
>
play_date = ${statisticDate}
</if>
</where>
GROUP BY board_id ) a
</select>
<!-- 获取播放展板的机构总量 -->
<select
id=
"getOrganTotal"
resultType=
"java.lang.Integer"
>
SELECT
count( a.organ_id )
FROM
( SELECT organ_id FROM t_board_statistic
<where>
<if
test=
"statisticDate != null and statisticDate.length() == 4"
>
left(play_date,4) = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 6"
>
left(play_date,6) = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 8"
>
play_date = ${statisticDate}
</if>
</where>
GROUP BY organ_id ) a
</select>
<!-- 获取互动总量 -->
<select
id=
"getInteractionTotal"
resultType=
"java.lang.Integer"
>
select count(id) from t_interaction
<where>
<if
test=
"statisticDate != null and statisticDate.length() == 4"
>
DATE_FORMAT(create_time,'%Y') = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 6"
>
DATE_FORMAT(create_time,'%Y%m') = ${statisticDate}
</if>
<if
test=
"statisticDate != null and statisticDate.length() == 8"
>
DATE_FORMAT(create_time,'%Y%m%d') = ${statisticDate}
</if>
</where>
</select>
<!-- 互动频次统计 -->
<select
id=
"getInteractionFrequency"
resultType=
"java.util.HashMap"
>
<if
test=
"frequencyDate != null and frequencyDate.length() == 4"
>
SELECT o.name organName,count(i.organ_id) frequencyCnt
from t_interaction i
left join t_organ o on i.organ_id = o.id
<where>
DATE_FORMAT(i.create_time,'%Y') = ${frequencyDate}
</where>
group by i.organ_id
</if>
<if
test=
"frequencyDate != null and frequencyDate.length() == 6"
>
SELECT o.name organName,count(i.organ_id) frequencyCnt
from t_interaction i
left join t_organ o on i.organ_id = o.id
<where>
DATE_FORMAT(i.create_time,'%Y%m') = ${frequencyDate}
</where>
group by i.organ_id
</if>
</select>
</mapper>
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/TDistrictBoardStatisticMapper.xml
deleted
100644 → 0
View file @
819f410b
<?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=
"cn.wisenergy.chnmuseum.party.mapper.TDistrictBoardStatisticMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"cn.wisenergy.chnmuseum.party.model.TDistrictBoardStatistic"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"board_id"
property=
"boardId"
/>
<result
column=
"board_name"
property=
"boardName"
/>
<result
column=
"play_number"
property=
"playNumber"
/>
<result
column=
"year"
property=
"year"
/>
<result
column=
"month"
property=
"month"
/>
<result
column=
"organ_id"
property=
"organId"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, board_id, board_name, play_number, year, month, organ_id
</sql>
</mapper>
This diff is collapsed.
Click to expand it.
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