Commit 7eb234b8 by tyfanchz

用户控制台总览统计

1 parent c8aa349f
package com.glsx.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.glsx.model.PlatformUser;
import com.glsx.service.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.UserVo;
import io.swagger.annotations.Api;
import org.oreframework.web.ui.Pagination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -16,10 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author deployer name
* @version V1.0
......@@ -52,6 +51,9 @@ public class IndexController {
@Autowired
private AppDownloadMgrService appDownloadMgrService;
@Autowired
private IndexService indexService;
@RequestMapping(value = "/getStatisticData", method = RequestMethod.GET)
@ResponseBody
public R getStatisticData() {
......@@ -106,21 +108,32 @@ public class IndexController {
return R.ok().data(hashMap);
}
@RequestMapping(value = "/getStatisticDataForUserConsole", method = RequestMethod.GET)
@RequestMapping(value = "/getUcSummaryStatistic", method = RequestMethod.GET)
@ResponseBody
public R getStatisticDataForUserConsole(String customerName) {
Map<String, Integer> hashMap = new HashMap<>();
public R getUcSummaryStatistic(String customerName) {
Map<String, Integer> statisticMap = this.indexService.getUcSummaryStatistic(customerName);
int deviceCountAuth = deviceMgrService.getDeviceCountAuth(customerName);
int userCountAuth = userMgrService.getUserCountAuth(customerName);
return R.ok().data(statisticMap);
}
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);
hashMap.put("userCount", userCountAuth);
hashMap.put("apiCallCount", apiCallCountAuth);
@RequestMapping(value = "/getUcUserActivityStatistic", method = RequestMethod.GET)
public R getUcUserActivityStatistic(String customerName) {
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);
}
}
package com.glsx.mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.glsx.model.PlatformAppDownload;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* <p>Description:
......@@ -35,4 +37,7 @@ public interface PlatformAppDownloadMapper {
int updateBatchSelective(List<PlatformAppDownload> list);
int getApiCallCountAuth(String customerName);
}
\ No newline at end of file
List<Map<String, Object>> getAppDownloadStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
}
package com.glsx.mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.glsx.model.PlatformDevice;
import com.glsx.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>Description:
* <p>Project: shop
......@@ -46,4 +46,7 @@ public interface PlatformDeviceMapper {
Map<String, Integer> getDeviceGraphData();
int getDeviceCountAuth(@Param("customerName") String customerName);
}
\ No newline at end of file
List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
}
package com.glsx.mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.glsx.model.PlatformUser;
import com.glsx.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
......@@ -40,4 +42,7 @@ public interface PlatformUserMapper {
int getUserCount();
int getUserCountAuth(@Param("customerName") String customerName);
List<Map<String, Object>> getUserActivityStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
}
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);
}
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;
}
}
<?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">
<resultMap id="BaseResultMap" type="com.glsx.model.PlatformAppDownload">
<!--@mbg.generated-->
<!--@Table t_platform_app_download-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="customer_id" jdbcType="INTEGER" property="customerId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_by" jdbcType="INTEGER" property="createBy" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, customer_id, create_time, create_by, remark
</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>
<resultMap id="BaseResultMap" type="com.glsx.model.PlatformAppDownload">
<!--@mbg.generated-->
<!--@Table t_platform_app_download-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="customer_id" jdbcType="INTEGER" property="customerId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="INTEGER" property="createBy"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, customer_id, create_time, create_by, remark
</sql>
<select id="getApiCallCountAuth" resultType="java.lang.Integer">
select count(1)
from t_platform_app_download a
left join t_platform_customer b
on a.customer_id = b.id
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<select id="getApiCallCountAuth" resultType="java.lang.Integer">
select count(1)
from t_platform_app_download a
left join t_platform_customer b
on a.customer_id = b.id
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from t_platform_app_download
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download (customer_id, create_time, create_by,
remark)
values (#{customerId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformAppDownload">
<!--@mbg.generated-->
update t_platform_app_download
<set>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformAppDownload">
<!--@mbg.generated-->
update t_platform_app_download
set customer_id = #{customerId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_app_download
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_app_download
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</if>
<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 &lt; #{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">
<!--@mbg.generated-->
delete
from t_platform_app_download
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download (customer_id, create_time, create_by,
remark)
values (#{customerId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformAppDownload">
<!--@mbg.generated-->
update t_platform_app_download
<set>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformAppDownload">
<!--@mbg.generated-->
update t_platform_app_download
set customer_id = #{customerId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_app_download
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</if>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_app_download
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.customerId,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
customer_id,
create_time,
create_by,
remark,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{customerId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
customer_id = #{customerId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
</update>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
customer_id,
create_time,
create_by,
remark,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{customerId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
customer_id = #{customerId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>
<?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">
<resultMap id="BaseResultMap" type="com.glsx.model.PlatformDevice">
<!--@mbg.generated-->
<!--@Table t_platform_device-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="device_sn" jdbcType="VARCHAR" property="deviceSn" />
<result column="device_type" jdbcType="VARCHAR" property="deviceType" />
<result column="customer_id" jdbcType="INTEGER" property="customerId" />
<result column="customer_name" jdbcType="INTEGER" property="customerName" />
<result column="activat_time" jdbcType="TIMESTAMP" property="activatTime" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_by" jdbcType="INTEGER" property="createBy" />
<result column="update_by" jdbcType="INTEGER" property="updateBy" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, device_sn, device_type, customer_id, activat_time, `status`, create_time, update_time,
create_by, update_by, remark
</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>
<resultMap id="BaseResultMap" type="com.glsx.model.PlatformDevice">
<!--@mbg.generated-->
<!--@Table t_platform_device-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="device_sn" jdbcType="VARCHAR" property="deviceSn"/>
<result column="device_type" jdbcType="VARCHAR" property="deviceType"/>
<result column="customer_id" jdbcType="INTEGER" property="customerId"/>
<result column="customer_name" jdbcType="INTEGER" property="customerName"/>
<result column="activat_time" jdbcType="TIMESTAMP" property="activatTime"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_by" jdbcType="INTEGER" property="createBy"/>
<result column="update_by" jdbcType="INTEGER" property="updateBy"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, device_sn, device_type, customer_id, activat_time, `status`, create_time, update_time,
create_by, update_by, remark
</sql>
<select id="getDeviceMgrList" resultMap="BaseResultMap">
select
a.id,
a.device_sn,
a.device_type,
b.customer_name,
a.activat_time,
a.`status`,
a.create_time,
a.update_time,
a.create_by,
a.update_by,
a.remark
from t_platform_device a
left join t_platform_customer b
on a.customer_id = b.id
where 1 = 1
<if test="deviceVo.customerName != null and deviceVo.customerName != '' ">
and b.customer_name = #{deviceVo.customerName,jdbcType=VARCHAR}
</if>
<if test="deviceVo.deviceType != null and deviceVo.deviceType != '' ">
and a.device_type = #{deviceVo.deviceType,jdbcType=VARCHAR}
</if>
<if test="deviceVo.activatStartTime != null and deviceVo.activatStartTime != '' ">
and a.create_time &gt;= apiCallVo.accessStartTime
</if>
<if test="deviceVo.activatEndTime != null and deviceVo.activatEndTime != '' ">
and a.create_time &lt;= apiCallVo.accessEndTime
</if>
</select>
<select id="getDeviceMgrList" resultMap="BaseResultMap">
select a.id,
a.device_sn,
a.device_type,
b.customer_name,
a.activat_time,
a.`status`,
a.create_time,
a.update_time,
a.create_by,
a.update_by,
a.remark
from t_platform_device a
left join t_platform_customer b
on a.customer_id = b.id
where 1 = 1
<if test="deviceVo.customerName != null and deviceVo.customerName != ''">
and b.customer_name = #{deviceVo.customerName,jdbcType=VARCHAR}
</if>
<if test="deviceVo.deviceType != null and deviceVo.deviceType != ''">
and a.device_type = #{deviceVo.deviceType,jdbcType=VARCHAR}
</if>
<if test="deviceVo.activatStartTime != null and deviceVo.activatStartTime != ''">
and a.create_time &gt;= apiCallVo.accessStartTime
</if>
<if test="deviceVo.activatEndTime != null and deviceVo.activatEndTime != ''">
and a.create_time &lt;= apiCallVo.accessEndTime
</if>
</select>
<select id="getDeviceTypeList" resultType="java.lang.String">
select distinct
device_type
from t_platform_device
</select>
<select id="getDeviceTypeList" resultType="java.lang.String">
select distinct device_type
from t_platform_device
</select>
<select id="getDeviceCount" resultType="java.lang.Integer">
select count(1)
from t_platform_device
</select>
<select id="getDeviceCount" resultType="java.lang.Integer">
select count(1)
from t_platform_device
</select>
<select id="getDeviceGraphData" resultType="java.util.Map">
select
device_type,
count(id)
from t_platform_device
group by device_type
</select>
<select id="getDeviceGraphData" resultType="java.util.Map">
select device_type,
count(id)
from t_platform_device
group by device_type
</select>
<select id="getDeviceCountAuth" resultType="java.lang.Integer">
select count(1)
from t_platform_device a
left join t_platform_customer b
on a.customer_id = b.id
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<select id="getDeviceCountAuth" resultType="java.lang.Integer">
select count(1)
from t_platform_device a
left join t_platform_customer b
on a.customer_id = b.id
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from t_platform_device
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device (device_sn, device_type, customer_id,
activat_time, `status`, create_time,
update_time, create_by, update_by,
remark)
values (#{deviceSn,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR}, #{customerId,jdbcType=INTEGER},
#{activatTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{updateBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceSn != null and deviceSn != ''">
device_sn,
</if>
<if test="deviceType != null and deviceType != ''">
device_type,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="activatTime != null">
activat_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceSn != null and deviceSn != ''">
#{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
#{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
#{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformDevice">
<!--@mbg.generated-->
update t_platform_device
<set>
<if test="deviceSn != null and deviceSn != ''">
device_sn = #{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
device_type = #{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
activat_time = #{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformDevice">
<!--@mbg.generated-->
update t_platform_device
set device_sn = #{deviceSn,jdbcType=VARCHAR},
device_type = #{deviceType,jdbcType=VARCHAR},
customer_id = #{customerId,jdbcType=INTEGER},
activat_time = #{activatTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_device
<trim prefix="set" suffixOverrides=",">
<trim prefix="device_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="device_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="activat_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.activatTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=TINYINT}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_device
<trim prefix="set" suffixOverrides=",">
<trim prefix="device_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.deviceSn != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="device_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.deviceType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="activat_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.activatTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.activatTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.status != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=TINYINT}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</if>
<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 &lt; #{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">
<!--@mbg.generated-->
delete
from t_platform_device
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device (device_sn, device_type, customer_id,
activat_time, `status`, create_time,
update_time, create_by, update_by,
remark)
values (#{deviceSn,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR},
#{customerId,jdbcType=INTEGER},
#{activatTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
#{updateBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceSn != null and deviceSn != ''">
device_sn,
</if>
<if test="deviceType != null and deviceType != ''">
device_type,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="activatTime != null">
activat_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceSn != null and deviceSn != ''">
#{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
#{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
#{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformDevice">
<!--@mbg.generated-->
update t_platform_device
<set>
<if test="deviceSn != null and deviceSn != ''">
device_sn = #{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
device_type = #{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
activat_time = #{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformDevice">
<!--@mbg.generated-->
update t_platform_device
set device_sn = #{deviceSn,jdbcType=VARCHAR},
device_type = #{deviceType,jdbcType=VARCHAR},
customer_id = #{customerId,jdbcType=INTEGER},
activat_time = #{activatTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_device
<trim prefix="set" suffixOverrides=",">
<trim prefix="device_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="device_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="activat_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER}
then #{item.activatTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=TINYINT}
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=INTEGER}
</if>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update t_platform_device
<trim prefix="set" suffixOverrides=",">
<trim prefix="device_sn = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.deviceSn != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="device_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.deviceType != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.deviceType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.customerId,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="activat_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.activatTime != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.activatTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.status != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=TINYINT}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="update_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateTime != null">
when id = #{item.id,jdbcType=INTEGER}
then #{item.updateTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="update_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updateBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</if>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
(device_sn, device_type, customer_id, activat_time, `status`, create_time,
update_time,
create_by, update_by, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.deviceSn,jdbcType=VARCHAR}, #{item.deviceType,jdbcType=VARCHAR},
#{item.customerId,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})
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
(device_sn, device_type, customer_id, activat_time, `status`, create_time, update_time,
create_by, update_by, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.deviceSn,jdbcType=VARCHAR}, #{item.deviceType,jdbcType=VARCHAR}, #{item.customerId,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})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
device_sn,
device_type,
customer_id,
activat_time,
`status`,
create_time,
update_time,
create_by,
update_by,
remark,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{deviceSn,jdbcType=VARCHAR},
#{deviceType,jdbcType=VARCHAR},
#{customerId,jdbcType=INTEGER},
#{activatTime,jdbcType=TIMESTAMP},
#{status,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{updateBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
device_sn = #{deviceSn,jdbcType=VARCHAR},
device_type = #{deviceType,jdbcType=VARCHAR},
customer_id = #{customerId,jdbcType=INTEGER},
activat_time = #{activatTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="deviceSn != null and deviceSn != ''">
device_sn,
</if>
<if test="deviceType != null and deviceType != ''">
device_type,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="activatTime != null">
activat_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="deviceSn != null and deviceSn != ''">
#{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
#{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
#{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="deviceSn != null and deviceSn != ''">
device_sn = #{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
device_type = #{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
activat_time = #{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
device_sn,
device_type,
customer_id,
activat_time,
`status`,
create_time,
update_time,
create_by,
update_by,
remark,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{deviceSn,jdbcType=VARCHAR},
#{deviceType,jdbcType=VARCHAR},
#{customerId,jdbcType=INTEGER},
#{activatTime,jdbcType=TIMESTAMP},
#{status,jdbcType=TINYINT},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{updateBy,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
device_sn = #{deviceSn,jdbcType=VARCHAR},
device_type = #{deviceType,jdbcType=VARCHAR},
customer_id = #{customerId,jdbcType=INTEGER},
activat_time = #{activatTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into t_platform_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="deviceSn != null and deviceSn != ''">
device_sn,
</if>
<if test="deviceType != null and deviceType != ''">
device_type,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="activatTime != null">
activat_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="deviceSn != null and deviceSn != ''">
#{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
#{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
#{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="deviceSn != null and deviceSn != ''">
device_sn = #{deviceSn,jdbcType=VARCHAR},
</if>
<if test="deviceType != null and deviceType != ''">
device_type = #{deviceType,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="activatTime != null">
activat_time = #{activatTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=INTEGER},
</if>
<if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>
......@@ -77,6 +77,21 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</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 &lt; #{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">
<!--@mbg.generated-->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!