Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
open-platform-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7eb234b8
authored
Dec 17, 2020
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户控制台总览统计
1 parent
c8aa349f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
323 additions
and
96 deletions
src/main/java/com/glsx/controller/IndexController.java
src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
src/main/java/com/glsx/mapper/PlatformUserMapper.java
src/main/java/com/glsx/service/IndexService.java
src/main/java/com/glsx/service/impl/IndexServiceImpl.java
src/main/resources/mapper/PlatformAppDownloadMapper.xml
src/main/resources/mapper/PlatformDeviceMapper.xml
src/main/resources/mapper/PlatformUserMapper.xml
src/main/java/com/glsx/controller/IndexController.java
View file @
7eb234b
package
com
.
glsx
.
controller
;
package
com
.
glsx
.
controller
;
import
com.github.pagehelper.Page
;
import
java.util.HashMap
;
import
com.github.pagehelper.PageHelper
;
import
java.util.List
;
import
com.glsx.model.PlatformUser
;
import
java.util.Map
;
import
com.glsx.service.*
;
import
com.glsx.service.ApiCallMgrService
;
import
com.glsx.service.AppDownloadMgrService
;
import
com.glsx.service.CustomerMgrService
;
import
com.glsx.service.DeviceMgrService
;
import
com.glsx.service.IndexService
;
import
com.glsx.service.UserMgrService
;
import
com.glsx.vo.R
;
import
com.glsx.vo.R
;
import
com.glsx.vo.UserVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
org.oreframework.web.ui.Pagination
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -16,10 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
...
@@ -16,10 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author deployer name
* @author deployer name
* @version V1.0
* @version V1.0
...
@@ -52,6 +51,9 @@ public class IndexController {
...
@@ -52,6 +51,9 @@ public class IndexController {
@Autowired
@Autowired
private
AppDownloadMgrService
appDownloadMgrService
;
private
AppDownloadMgrService
appDownloadMgrService
;
@Autowired
private
IndexService
indexService
;
@RequestMapping
(
value
=
"/getStatisticData"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getStatisticData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
R
getStatisticData
()
{
public
R
getStatisticData
()
{
...
@@ -106,21 +108,32 @@ public class IndexController {
...
@@ -106,21 +108,32 @@ public class IndexController {
return
R
.
ok
().
data
(
hashMap
);
return
R
.
ok
().
data
(
hashMap
);
}
}
@RequestMapping
(
value
=
"/get
StatisticDataForUserConsole
"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/get
UcSummaryStatistic
"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
R
get
StatisticDataForUserConsole
(
String
customerName
)
{
public
R
get
UcSummaryStatistic
(
String
customerName
)
{
Map
<
String
,
Integer
>
hashMap
=
new
HashMap
<>(
);
Map
<
String
,
Integer
>
statisticMap
=
this
.
indexService
.
getUcSummaryStatistic
(
customerName
);
int
deviceCountAuth
=
deviceMgrService
.
getDeviceCountAuth
(
customerName
);
return
R
.
ok
().
data
(
statisticMap
);
}
int
userCountAuth
=
userMgrService
.
getUserCountAuth
(
customerName
);
int
apiCallCountAuth
=
appDownloadMgrService
.
getApiCallCountAuth
(
customerName
);
@RequestMapping
(
value
=
"/getUcDeviceActivationStatistic"
,
method
=
RequestMethod
.
GET
)
public
R
getUcDeviceActivationStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
this
.
indexService
.
getUcDeviceActivationStatistic
(
customerName
);
return
R
.
ok
().
data
(
statisticList
);
}
hashMap
.
put
(
"deviceCount"
,
deviceCountAuth
);
@RequestMapping
(
value
=
"/getUcUserActivityStatistic"
,
method
=
RequestMethod
.
GET
)
hashMap
.
put
(
"userCount"
,
userCountAuth
);
public
R
getUcUserActivityStatistic
(
String
customerName
)
{
hashMap
.
put
(
"apiCallCount"
,
apiCallCountAuth
);
List
<
Map
<
String
,
Integer
>>
statisticList
=
this
.
indexService
.
getUcUserActivityStatistic
(
customerName
);
return
R
.
ok
().
data
(
statisticList
);
}
return
R
.
ok
().
data
(
hashMap
);
@RequestMapping
(
value
=
"/getUcAppDownloadStatistic"
,
method
=
RequestMethod
.
GET
)
public
R
getUcAppDownloadStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
this
.
indexService
.
getUcAppDownloadStatistic
(
customerName
);
return
R
.
ok
().
data
(
statisticList
);
}
}
}
}
src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
View file @
7eb234b
package
com
.
glsx
.
mapper
;
package
com
.
glsx
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.model.PlatformAppDownload
;
import
com.glsx.model.PlatformAppDownload
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* <p>Description:
* <p>Description:
...
@@ -35,4 +37,7 @@ public interface PlatformAppDownloadMapper {
...
@@ -35,4 +37,7 @@ public interface PlatformAppDownloadMapper {
int
updateBatchSelective
(
List
<
PlatformAppDownload
>
list
);
int
updateBatchSelective
(
List
<
PlatformAppDownload
>
list
);
int
getApiCallCountAuth
(
String
customerName
);
int
getApiCallCountAuth
(
String
customerName
);
List
<
Map
<
String
,
Object
>>
getAppDownloadStatistic
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"customerName"
)
String
customerName
);
}
}
src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
View file @
7eb234b
package
com
.
glsx
.
mapper
;
package
com
.
glsx
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.model.PlatformDevice
;
import
com.glsx.model.PlatformDevice
;
import
com.glsx.vo.DeviceVo
;
import
com.glsx.vo.DeviceVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* <p>Description:
* <p>Description:
* <p>Project: shop
* <p>Project: shop
...
@@ -46,4 +46,7 @@ public interface PlatformDeviceMapper {
...
@@ -46,4 +46,7 @@ public interface PlatformDeviceMapper {
Map
<
String
,
Integer
>
getDeviceGraphData
();
Map
<
String
,
Integer
>
getDeviceGraphData
();
int
getDeviceCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
int
getDeviceCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
List
<
Map
<
String
,
Object
>>
getDeviceActivationStatistic
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"customerName"
)
String
customerName
);
}
}
src/main/java/com/glsx/mapper/PlatformUserMapper.java
View file @
7eb234b
package
com
.
glsx
.
mapper
;
package
com
.
glsx
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.model.PlatformUser
;
import
com.glsx.model.PlatformUser
;
import
com.glsx.vo.UserVo
;
import
com.glsx.vo.UserVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -40,4 +42,7 @@ public interface PlatformUserMapper {
...
@@ -40,4 +42,7 @@ public interface PlatformUserMapper {
int
getUserCount
();
int
getUserCount
();
int
getUserCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
int
getUserCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
List
<
Map
<
String
,
Object
>>
getUserActivityStatistic
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"customerName"
)
String
customerName
);
}
}
src/main/java/com/glsx/service/IndexService.java
0 → 100644
View file @
7eb234b
package
com
.
glsx
.
service
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>Description:
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
public
interface
IndexService
{
Map
<
String
,
Integer
>
getUcSummaryStatistic
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getUcDeviceActivationStatistic
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getUcUserActivityStatistic
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getUcAppDownloadStatistic
(
String
customerName
);
}
src/main/java/com/glsx/service/impl/IndexServiceImpl.java
0 → 100644
View file @
7eb234b
package
com
.
glsx
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
cn.hutool.core.date.DateUtil
;
import
com.glsx.mapper.PlatformAppDownloadMapper
;
import
com.glsx.mapper.PlatformDeviceMapper
;
import
com.glsx.mapper.PlatformUserMapper
;
import
com.glsx.service.IndexService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* <p>Description: 总览业务
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
@Service
public
class
IndexServiceImpl
implements
IndexService
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
private
PlatformDeviceMapper
deviceMapper
;
@Autowired
private
PlatformUserMapper
userMapper
;
@Autowired
private
PlatformAppDownloadMapper
appDownloadMapper
;
@Override
public
Map
<
String
,
Integer
>
getUcSummaryStatistic
(
String
customerName
)
{
Map
<
String
,
Integer
>
statisticMap
=
new
HashMap
<>();
int
deviceCount
=
this
.
deviceMapper
.
getDeviceCountAuth
(
customerName
);
int
userCount
=
this
.
userMapper
.
getUserCountAuth
(
customerName
);
int
appDownloadCount
=
this
.
appDownloadMapper
.
getApiCallCountAuth
(
customerName
);
statisticMap
.
put
(
"deviceCount"
,
deviceCount
);
statisticMap
.
put
(
"userCount"
,
userCount
);
statisticMap
.
put
(
"appDownloadCount"
,
appDownloadCount
);
return
statisticMap
;
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getUcDeviceActivationStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
;
List
<
Map
<
String
,
Object
>>
columnList
=
this
.
deviceMapper
.
getDeviceActivationStatistic
(
this
.
getStatisticStartTime
(),
this
.
getStatisticEndTime
(),
customerName
);
statisticList
=
this
.
convertColumnToMap
(
columnList
,
"activateTime"
,
"count"
);
return
statisticList
;
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getUcUserActivityStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
;
List
<
Map
<
String
,
Object
>>
columnList
=
this
.
userMapper
.
getUserActivityStatistic
(
this
.
getStatisticStartTime
(),
this
.
getStatisticEndTime
(),
customerName
);
statisticList
=
this
.
convertColumnToMap
(
columnList
,
"lastLoginTime"
,
"count"
);
return
statisticList
;
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getUcAppDownloadStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
;
List
<
Map
<
String
,
Object
>>
columnList
=
this
.
appDownloadMapper
.
getAppDownloadStatistic
(
this
.
getStatisticStartTime
(),
this
.
getStatisticEndTime
(),
customerName
);
statisticList
=
this
.
convertColumnToMap
(
columnList
,
"appDownloadTime"
,
"count"
);
return
statisticList
;
}
private
Date
getStatisticStartTime
()
{
return
DateUtil
.
beginOfDay
(
new
Date
());
}
private
Date
getStatisticEndTime
()
{
return
DateUtil
.
offsetDay
(
DateUtil
.
beginOfDay
(
new
Date
()),
-
31
);
}
private
List
<
Map
<
String
,
Integer
>>
convertColumnToMap
(
List
<
Map
<
String
,
Object
>>
columnList
,
String
key
,
String
value
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
columnMap
:
columnList
)
{
Map
<
String
,
Integer
>
statisticMap
=
new
HashMap
<>();
statisticMap
.
put
((
String
)
columnMap
.
get
(
key
),
(
Integer
)
columnMap
.
get
(
value
));
statisticList
.
add
(
statisticMap
);
}
return
statisticList
;
}
}
src/main/resources/mapper/PlatformAppDownloadMapper.xml
View file @
7eb234b
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.glsx.mapper.PlatformAppDownloadMapper"
>
<mapper
namespace=
"com.glsx.mapper.PlatformAppDownloadMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.glsx.model.PlatformAppDownload"
>
<resultMap
id=
"BaseResultMap"
type=
"com.glsx.model.PlatformAppDownload"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
<!--@Table t_platform_app_download-->
<!--@Table t_platform_app_download-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"create_by"
jdbcType=
"INTEGER"
property=
"createBy"
/>
<result
column=
"create_by"
jdbcType=
"INTEGER"
property=
"createBy"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
id, customer_id, create_time, create_by, remark
id, customer_id, create_time, create_by, remark
</sql>
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_platform_app_download
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"getApiCallCountAuth"
resultType=
"java.lang.Integer"
>
<select
id=
"getApiCallCountAuth"
resultType=
"java.lang.Integer"
>
select count(1)
select count(1)
...
@@ -30,19 +24,48 @@
...
@@ -30,19 +24,48 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
</select>
<select
id=
"getAppDownloadStatistic"
resultType=
"map"
>
select date_format(pad.create_time, '%Y-%m-%d') `appDownloadTime`,
count(pad.create_time) `count`
from t_platform_app_download pad
left join t_platform_customer pc on pc.id = pad.customer_id
<where>
pad.create_time >= #{startTime,jdbcType=TIMESTAMP}
and pad.create_time
<
#{endTime,jdbcType=TIMESTAMP}
<if
test=
"customerName != null and customerName != ''"
>
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by appDownloadTime
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_platform_app_download
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
delete from t_platform_app_download
delete
from t_platform_app_download
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</delete>
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_app_download (customer_id, create_time, create_by,
insert into t_platform_app_download (customer_id, create_time, create_by,
remark)
remark)
values (#{customerId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
values (#{customerId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR})
#{remark,jdbcType=VARCHAR})
</insert>
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_app_download
insert into t_platform_app_download
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
@@ -139,14 +162,16 @@
...
@@ -139,14 +162,16 @@
<trim
prefix=
"customer_id = case"
suffix=
"end,"
>
<trim
prefix=
"customer_id = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.customerId != null"
>
<if
test=
"item.customerId != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
when id = #{item.id,jdbcType=INTEGER}
then #{item.customerId,jdbcType=INTEGER}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
<trim
prefix=
"create_time = case"
suffix=
"end,"
>
<trim
prefix=
"create_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.createTime != null"
>
<if
test=
"item.createTime != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
when id = #{item.id,jdbcType=INTEGER}
then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
...
@@ -170,7 +195,8 @@
...
@@ -170,7 +195,8 @@
#{item.id,jdbcType=INTEGER}
#{item.id,jdbcType=INTEGER}
</foreach>
</foreach>
</update>
</update>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_app_download
insert into t_platform_app_download
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
@@ -203,7 +229,8 @@
...
@@ -203,7 +229,8 @@
remark = #{remark,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
</trim>
</trim>
</insert>
</insert>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformAppDownload"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_app_download
insert into t_platform_app_download
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
src/main/resources/mapper/PlatformDeviceMapper.xml
View file @
7eb234b
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.glsx.mapper.PlatformDeviceMapper"
>
<mapper
namespace=
"com.glsx.mapper.PlatformDeviceMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.glsx.model.PlatformDevice"
>
<resultMap
id=
"BaseResultMap"
type=
"com.glsx.model.PlatformDevice"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
<!--@Table t_platform_device-->
<!--@Table t_platform_device-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"device_sn"
jdbcType=
"VARCHAR"
property=
"deviceSn"
/>
<result
column=
"device_sn"
jdbcType=
"VARCHAR"
property=
"deviceSn"
/>
<result
column=
"device_type"
jdbcType=
"VARCHAR"
property=
"deviceType"
/>
<result
column=
"device_type"
jdbcType=
"VARCHAR"
property=
"deviceType"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"customer_name"
jdbcType=
"INTEGER"
property=
"customerName"
/>
<result
column=
"customer_name"
jdbcType=
"INTEGER"
property=
"customerName"
/>
<result
column=
"activat_time"
jdbcType=
"TIMESTAMP"
property=
"activatTime"
/>
<result
column=
"activat_time"
jdbcType=
"TIMESTAMP"
property=
"activatTime"
/>
<result
column=
"status"
jdbcType=
"TINYINT"
property=
"status"
/>
<result
column=
"status"
jdbcType=
"TINYINT"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"create_by"
jdbcType=
"INTEGER"
property=
"createBy"
/>
<result
column=
"create_by"
jdbcType=
"INTEGER"
property=
"createBy"
/>
<result
column=
"update_by"
jdbcType=
"INTEGER"
property=
"updateBy"
/>
<result
column=
"update_by"
jdbcType=
"INTEGER"
property=
"updateBy"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
id, device_sn, device_type, customer_id, activat_time, `status`, create_time, update_time,
id, device_sn, device_type, customer_id, activat_time, `status`, create_time, update_time,
create_by, update_by, remark
create_by, update_by, remark
</sql>
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_platform_device
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"getDeviceMgrList"
resultMap=
"BaseResultMap"
>
<select
id=
"getDeviceMgrList"
resultMap=
"BaseResultMap"
>
select
select a.id,
a.id,
a.device_sn,
a.device_sn,
a.device_type,
a.device_type,
b.customer_name,
b.customer_name,
...
@@ -47,23 +40,22 @@
...
@@ -47,23 +40,22 @@
left join t_platform_customer b
left join t_platform_customer b
on a.customer_id = b.id
on a.customer_id = b.id
where 1 = 1
where 1 = 1
<if
test=
"deviceVo.customerName != null and deviceVo.customerName != ''
"
>
<if
test=
"deviceVo.customerName != null and deviceVo.customerName != ''
"
>
and b.customer_name = #{deviceVo.customerName,jdbcType=VARCHAR}
and b.customer_name = #{deviceVo.customerName,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"deviceVo.deviceType != null and deviceVo.deviceType != ''
"
>
<if
test=
"deviceVo.deviceType != null and deviceVo.deviceType != ''
"
>
and a.device_type = #{deviceVo.deviceType,jdbcType=VARCHAR}
and a.device_type = #{deviceVo.deviceType,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"deviceVo.activatStartTime != null and deviceVo.activatStartTime != ''
"
>
<if
test=
"deviceVo.activatStartTime != null and deviceVo.activatStartTime != ''
"
>
and a.create_time
>
= apiCallVo.accessStartTime
and a.create_time
>
= apiCallVo.accessStartTime
</if>
</if>
<if
test=
"deviceVo.activatEndTime != null and deviceVo.activatEndTime != ''
"
>
<if
test=
"deviceVo.activatEndTime != null and deviceVo.activatEndTime != ''
"
>
and a.create_time
<
= apiCallVo.accessEndTime
and a.create_time
<
= apiCallVo.accessEndTime
</if>
</if>
</select>
</select>
<select
id=
"getDeviceTypeList"
resultType=
"java.lang.String"
>
<select
id=
"getDeviceTypeList"
resultType=
"java.lang.String"
>
select distinct
select distinct device_type
device_type
from t_platform_device
from t_platform_device
</select>
</select>
...
@@ -73,8 +65,7 @@
...
@@ -73,8 +65,7 @@
</select>
</select>
<select
id=
"getDeviceGraphData"
resultType=
"java.util.Map"
>
<select
id=
"getDeviceGraphData"
resultType=
"java.util.Map"
>
select
select device_type,
device_type,
count(id)
count(id)
from t_platform_device
from t_platform_device
group by device_type
group by device_type
...
@@ -88,23 +79,53 @@
...
@@ -88,23 +79,53 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
</select>
<select
id=
"getDeviceActivationStatistic"
resultType=
"map"
>
select date_format(pd.activat_time, '%Y-%m-%d') `activateTime`,
count(pd.activat_time) `count`
from t_platform_device pd
left join t_platform_customer pc on pc.id = pd.customer_id
<where>
pd.activat_time >= #{startTime,jdbcType=TIMESTAMP}
and pd.activat_time
<
#{endTime,jdbcType=TIMESTAMP}
<if
test=
"customerName != null and customerName != ''"
>
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by activateTime
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_platform_device
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
delete from t_platform_device
delete
from t_platform_device
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</delete>
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_device (device_sn, device_type, customer_id,
insert into t_platform_device (device_sn, device_type, customer_id,
activat_time, `status`, create_time,
activat_time, `status`, create_time,
update_time, create_by, update_by,
update_time, create_by, update_by,
remark)
remark)
values (#{deviceSn,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR}, #{customerId,jdbcType=INTEGER},
values (#{deviceSn,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR},
#{activatTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{customerId,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{updateBy,jdbcType=INTEGER},
#{activatTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
#{updateBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR})
#{remark,jdbcType=VARCHAR})
</insert>
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_device
insert into t_platform_device
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
@@ -245,7 +266,8 @@
...
@@ -245,7 +266,8 @@
</trim>
</trim>
<trim
prefix=
"activat_time = case"
suffix=
"end,"
>
<trim
prefix=
"activat_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.activatTime,jdbcType=TIMESTAMP}
when id = #{item.id,jdbcType=INTEGER}
then #{item.activatTime,jdbcType=TIMESTAMP}
</foreach>
</foreach>
</trim>
</trim>
<trim
prefix=
"`status` = case"
suffix=
"end,"
>
<trim
prefix=
"`status` = case"
suffix=
"end,"
>
...
@@ -298,21 +320,24 @@
...
@@ -298,21 +320,24 @@
<trim
prefix=
"device_type = case"
suffix=
"end,"
>
<trim
prefix=
"device_type = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.deviceType != null"
>
<if
test=
"item.deviceType != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR}
when id = #{item.id,jdbcType=INTEGER}
then #{item.deviceType,jdbcType=VARCHAR}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
<trim
prefix=
"customer_id = case"
suffix=
"end,"
>
<trim
prefix=
"customer_id = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.customerId != null"
>
<if
test=
"item.customerId != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
when id = #{item.id,jdbcType=INTEGER}
then #{item.customerId,jdbcType=INTEGER}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
<trim
prefix=
"activat_time = case"
suffix=
"end,"
>
<trim
prefix=
"activat_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.activatTime != null"
>
<if
test=
"item.activatTime != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.activatTime,jdbcType=TIMESTAMP}
when id = #{item.id,jdbcType=INTEGER}
then #{item.activatTime,jdbcType=TIMESTAMP}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
...
@@ -326,14 +351,16 @@
...
@@ -326,14 +351,16 @@
<trim
prefix=
"create_time = case"
suffix=
"end,"
>
<trim
prefix=
"create_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.createTime != null"
>
<if
test=
"item.createTime != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
when id = #{item.id,jdbcType=INTEGER}
then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
<trim
prefix=
"update_time = case"
suffix=
"end,"
>
<trim
prefix=
"update_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.updateTime != null"
>
<if
test=
"item.updateTime != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
when id = #{item.id,jdbcType=INTEGER}
then #{item.updateTime,jdbcType=TIMESTAMP}
</if>
</if>
</foreach>
</foreach>
</trim>
</trim>
...
@@ -364,20 +391,26 @@
...
@@ -364,20 +391,26 @@
#{item.id,jdbcType=INTEGER}
#{item.id,jdbcType=INTEGER}
</foreach>
</foreach>
</update>
</update>
<insert
id=
"batchInsert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"map"
useGeneratedKeys=
"true"
>
<insert
id=
"batchInsert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"map"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_device
insert into t_platform_device
(device_sn, device_type, customer_id, activat_time, `status`, create_time, update_time,
(device_sn, device_type, customer_id, activat_time, `status`, create_time,
update_time,
create_by, update_by, remark)
create_by, update_by, remark)
values
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.deviceSn,jdbcType=VARCHAR}, #{item.deviceType,jdbcType=VARCHAR}, #{item.customerId,jdbcType=INTEGER},
(#{item.deviceSn,jdbcType=VARCHAR}, #{item.deviceType,jdbcType=VARCHAR},
#{item.activatTime,jdbcType=TIMESTAMP}, #{item.status,jdbcType=TINYINT}, #{item.createTime,jdbcType=TIMESTAMP},
#{item.customerId,jdbcType=INTEGER},
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=INTEGER}, #{item.updateBy,jdbcType=INTEGER},
#{item.activatTime,jdbcType=TIMESTAMP}, #{item.status,jdbcType=TINYINT},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=INTEGER},
#{item.updateBy,jdbcType=INTEGER},
#{item.remark,jdbcType=VARCHAR})
#{item.remark,jdbcType=VARCHAR})
</foreach>
</foreach>
</insert>
</insert>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_device
insert into t_platform_device
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
@@ -428,7 +461,8 @@
...
@@ -428,7 +461,8 @@
remark = #{remark,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
</trim>
</trim>
</insert>
</insert>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.model.PlatformDevice"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
insert into t_platform_device
insert into t_platform_device
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
src/main/resources/mapper/PlatformUserMapper.xml
View file @
7eb234b
...
@@ -77,6 +77,21 @@
...
@@ -77,6 +77,21 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
</select>
<select
id=
"getUserActivityStatistic"
resultType=
"map"
>
select date_format(pu.last_login_time, '%Y-%m-%d') `lastLoginTime`,
count(pu.last_login_time) `count`
from t_platform_user pu
left join t_platform_customer pc on pc.id = pu.customer_id
<where>
pu.last_login_time >= #{startTime,jdbcType=TIMESTAMP}
and pu.last_login_time
<
#{endTime,jdbcType=TIMESTAMP}
<if
test=
"customerName != null and customerName != ''"
>
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by lastLoginTime
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment