Commit 7eb234b8 by tyfanchz

用户控制台总览统计

1 parent c8aa349f
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 = "/getStatisticDataForUserConsole", method = RequestMethod.GET) @RequestMapping(value = "/getUcSummaryStatistic", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public R getStatisticDataForUserConsole(String customerName) { public R getUcSummaryStatistic(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);
} }
} }
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);
}
\ No newline at end of file \ 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; 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);
}
\ No newline at end of file \ 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; 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);
} }
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"?> <?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)
from t_platform_app_download a from t_platform_app_download a
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 b.customer_name = #{customerName,jdbcType=VARCHAR} where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <select id="getAppDownloadStatistic" resultType="map">
<!--@mbg.generated--> select date_format(pad.create_time, '%Y-%m-%d') `appDownloadTime`,
delete from t_platform_app_download count(pad.create_time) `count`
where id = #{id,jdbcType=INTEGER} from t_platform_app_download pad
</delete> left join t_platform_customer pc on pc.id = pad.customer_id
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true"> <where>
<!--@mbg.generated--> pad.create_time >= #{startTime,jdbcType=TIMESTAMP}
insert into t_platform_app_download (customer_id, create_time, create_by, and pad.create_time &lt; #{endTime,jdbcType=TIMESTAMP}
remark) <if test="customerName != null and customerName != ''">
values (#{customerId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, and pc.customer_name = #{customerName,jdbcType=VARCHAR}
#{remark,jdbcType=VARCHAR}) </if>
</insert> </where>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true"> group by appDownloadTime
<!--@mbg.generated--> </select>
insert into t_platform_app_download
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id, <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
</if> <!--@mbg.generated-->
<if test="createTime != null"> select
create_time, <include refid="Base_Column_List"/>
</if> from t_platform_app_download
<if test="createBy != null"> where id = #{id,jdbcType=INTEGER}
create_by, </select>
</if>
<if test="remark != null and remark != ''"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
remark, <!--@mbg.generated-->
</if> delete
</trim> from t_platform_app_download
<trim prefix="values (" suffix=")" suffixOverrides=","> where id = #{id,jdbcType=INTEGER}
<if test="customerId != null"> </delete>
#{customerId,jdbcType=INTEGER}, <insert id="insert" keyColumn="id" keyProperty="id"
</if> parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
<if test="createTime != null"> <!--@mbg.generated-->
#{createTime,jdbcType=TIMESTAMP}, insert into t_platform_app_download (customer_id, create_time, create_by,
</if> remark)
<if test="createBy != null"> values (#{customerId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER}, #{createBy,jdbcType=INTEGER},
</if> #{remark,jdbcType=VARCHAR})
<if test="remark != null and remark != ''"> </insert>
#{remark,jdbcType=VARCHAR}, <insert id="insertSelective" keyColumn="id" keyProperty="id"
</if> parameterType="com.glsx.model.PlatformAppDownload" useGeneratedKeys="true">
</trim> <!--@mbg.generated-->
</insert> insert into t_platform_app_download
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformAppDownload"> <trim prefix="(" suffix=")" suffixOverrides=",">
<!--@mbg.generated--> <if test="customerId != null">
update t_platform_app_download customer_id,
<set> </if>
<if test="customerId != null"> <if test="createTime != null">
customer_id = #{customerId,jdbcType=INTEGER}, create_time,
</if> </if>
<if test="createTime != null"> <if test="createBy != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_by,
</if> </if>
<if test="createBy != null"> <if test="remark != null and remark != ''">
create_by = #{createBy,jdbcType=INTEGER}, remark,
</if> </if>
<if test="remark != null and remark != ''"> </trim>
remark = #{remark,jdbcType=VARCHAR}, <trim prefix="values (" suffix=")" suffixOverrides=",">
</if> <if test="customerId != null">
</set> #{customerId,jdbcType=INTEGER},
where id = #{id,jdbcType=INTEGER} </if>
</update> <if test="createTime != null">
<update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformAppDownload"> #{createTime,jdbcType=TIMESTAMP},
<!--@mbg.generated--> </if>
update t_platform_app_download <if test="createBy != null">
set customer_id = #{customerId,jdbcType=INTEGER}, #{createBy,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, </if>
create_by = #{createBy,jdbcType=INTEGER}, <if test="remark != null and remark != ''">
remark = #{remark,jdbcType=VARCHAR} #{remark,jdbcType=VARCHAR},
where id = #{id,jdbcType=INTEGER} </if>
</update> </trim>
<update id="updateBatch" parameterType="java.util.List"> </insert>
<!--@mbg.generated--> <update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformAppDownload">
update t_platform_app_download <!--@mbg.generated-->
<trim prefix="set" suffixOverrides=","> update t_platform_app_download
<trim prefix="customer_id = case" suffix="end,"> <set>
<foreach collection="list" index="index" item="item"> <if test="customerId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER} customer_id = #{customerId,jdbcType=INTEGER},
</foreach> </if>
</trim> <if test="createTime != null">
<trim prefix="create_time = case" suffix="end,"> create_time = #{createTime,jdbcType=TIMESTAMP},
<foreach collection="list" index="index" item="item"> </if>
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} <if test="createBy != null">
</foreach> create_by = #{createBy,jdbcType=INTEGER},
</trim> </if>
<trim prefix="create_by = case" suffix="end,"> <if test="remark != null and remark != ''">
<foreach collection="list" index="index" item="item"> remark = #{remark,jdbcType=VARCHAR},
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER} </if>
</foreach> </set>
</trim> where id = #{id,jdbcType=INTEGER}
<trim prefix="remark = case" suffix="end,"> </update>
<foreach collection="list" index="index" item="item"> <update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformAppDownload">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR} <!--@mbg.generated-->
</foreach> update t_platform_app_download
</trim> set customer_id = #{customerId,jdbcType=INTEGER},
</trim> create_time = #{createTime,jdbcType=TIMESTAMP},
where id in create_by = #{createBy,jdbcType=INTEGER},
<foreach close=")" collection="list" item="item" open="(" separator=", "> remark = #{remark,jdbcType=VARCHAR}
#{item.id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</foreach> </update>
</update> <update id="updateBatch" parameterType="java.util.List">
<update id="updateBatchSelective" parameterType="java.util.List"> <!--@mbg.generated-->
<!--@mbg.generated--> update t_platform_app_download
update t_platform_app_download <trim prefix="set" suffixOverrides=",">
<trim prefix="set" suffixOverrides=","> <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"> when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
<if test="item.customerId != null"> </foreach>
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER} </trim>
</if> <trim prefix="create_time = case" suffix="end,">
</foreach> <foreach collection="list" index="index" item="item">
</trim> when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
<trim prefix="create_time = case" suffix="end,"> </foreach>
<foreach collection="list" index="index" item="item"> </trim>
<if test="item.createTime != null"> <trim prefix="create_by = case" suffix="end,">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} <foreach collection="list" index="index" item="item">
</if> when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER}
</foreach> </foreach>
</trim> </trim>
<trim prefix="create_by = case" suffix="end,"> <trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
<if test="item.createBy != null"> when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=INTEGER} </foreach>
</if> </trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach> </foreach>
</trim> </update>
<trim prefix="remark = case" suffix="end,"> <update id="updateBatchSelective" parameterType="java.util.List">
<foreach collection="list" index="index" item="item"> <!--@mbg.generated-->
<if test="item.remark != null"> update t_platform_app_download
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR} <trim prefix="set" suffixOverrides=",">
</if> <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> </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 \ 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"?> <?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, a.activat_time,
a.activat_time, a.`status`,
a.`status`, a.create_time,
a.create_time, a.update_time,
a.update_time, a.create_by,
a.create_by, a.update_by,
a.update_by, a.remark
a.remark from t_platform_device a
from t_platform_device a 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 &gt;= apiCallVo.accessStartTime
and a.create_time &gt;= apiCallVo.accessStartTime </if>
</if> <if test="deviceVo.activatEndTime != null and deviceVo.activatEndTime != ''">
<if test="deviceVo.activatEndTime != null and deviceVo.activatEndTime != '' "> and a.create_time &lt;= apiCallVo.accessEndTime
and a.create_time &lt;= 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>
<select id="getDeviceCount" resultType="java.lang.Integer"> <select id="getDeviceCount" resultType="java.lang.Integer">
select count(1) select count(1)
from t_platform_device from t_platform_device
</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 </select>
</select>
<select id="getDeviceCountAuth" resultType="java.lang.Integer"> <select id="getDeviceCountAuth" resultType="java.lang.Integer">
select count(1) select count(1)
from t_platform_device a from t_platform_device a
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 b.customer_name = #{customerName,jdbcType=VARCHAR} where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <select id="getDeviceActivationStatistic" resultType="map">
<!--@mbg.generated--> select date_format(pd.activat_time, '%Y-%m-%d') `activateTime`,
delete from t_platform_device count(pd.activat_time) `count`
where id = #{id,jdbcType=INTEGER} from t_platform_device pd
</delete> left join t_platform_customer pc on pc.id = pd.customer_id
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true"> <where>
<!--@mbg.generated--> pd.activat_time >= #{startTime,jdbcType=TIMESTAMP}
insert into t_platform_device (device_sn, device_type, customer_id, and pd.activat_time &lt; #{endTime,jdbcType=TIMESTAMP}
activat_time, `status`, create_time, <if test="customerName != null and customerName != ''">
update_time, create_by, update_by, and pc.customer_name = #{customerName,jdbcType=VARCHAR}
remark) </if>
values (#{deviceSn,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR}, #{customerId,jdbcType=INTEGER}, </where>
#{activatTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, group by activateTime
#{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{updateBy,jdbcType=INTEGER}, </select>
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into t_platform_device select
<trim prefix="(" suffix=")" suffixOverrides=","> <include refid="Base_Column_List"/>
<if test="deviceSn != null and deviceSn != ''"> from t_platform_device
device_sn, where id = #{id,jdbcType=INTEGER}
</if> </select>
<if test="deviceType != null and deviceType != ''">
device_type, <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
</if> <!--@mbg.generated-->
<if test="customerId != null"> delete
customer_id, from t_platform_device
</if> where id = #{id,jdbcType=INTEGER}
<if test="activatTime != null"> </delete>
activat_time, <insert id="insert" keyColumn="id" keyProperty="id"
</if> parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<if test="status != null"> <!--@mbg.generated-->
`status`, insert into t_platform_device (device_sn, device_type, customer_id,
</if> activat_time, `status`, create_time,
<if test="createTime != null"> update_time, create_by, update_by,
create_time, remark)
</if> values (#{deviceSn,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR},
<if test="updateTime != null"> #{customerId,jdbcType=INTEGER},
update_time, #{activatTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT},
</if> #{createTime,jdbcType=TIMESTAMP},
<if test="createBy != null"> #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
create_by, #{updateBy,jdbcType=INTEGER},
</if> #{remark,jdbcType=VARCHAR})
<if test="updateBy != null"> </insert>
update_by, <insert id="insertSelective" keyColumn="id" keyProperty="id"
</if> parameterType="com.glsx.model.PlatformDevice" useGeneratedKeys="true">
<if test="remark != null and remark != ''"> <!--@mbg.generated-->
remark, insert into t_platform_device
</if> <trim prefix="(" suffix=")" suffixOverrides=",">
</trim> <if test="deviceSn != null and deviceSn != ''">
<trim prefix="values (" suffix=")" suffixOverrides=","> device_sn,
<if test="deviceSn != null and deviceSn != ''"> </if>
#{deviceSn,jdbcType=VARCHAR}, <if test="deviceType != null and deviceType != ''">
</if> device_type,
<if test="deviceType != null and deviceType != ''"> </if>
#{deviceType,jdbcType=VARCHAR}, <if test="customerId != null">
</if> customer_id,
<if test="customerId != null"> </if>
#{customerId,jdbcType=INTEGER}, <if test="activatTime != null">
</if> activat_time,
<if test="activatTime != null"> </if>
#{activatTime,jdbcType=TIMESTAMP}, <if test="status != null">
</if> `status`,
<if test="status != null"> </if>
#{status,jdbcType=TINYINT}, <if test="createTime != null">
</if> create_time,
<if test="createTime != null"> </if>
#{createTime,jdbcType=TIMESTAMP}, <if test="updateTime != null">
</if> update_time,
<if test="updateTime != null"> </if>
#{updateTime,jdbcType=TIMESTAMP}, <if test="createBy != null">
</if> create_by,
<if test="createBy != null"> </if>
#{createBy,jdbcType=INTEGER}, <if test="updateBy != null">
</if> update_by,
<if test="updateBy != null"> </if>
#{updateBy,jdbcType=INTEGER}, <if test="remark != null and remark != ''">
</if> remark,
<if test="remark != null and remark != ''"> </if>
#{remark,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
</trim> <if test="deviceSn != null and deviceSn != ''">
</insert> #{deviceSn,jdbcType=VARCHAR},
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformDevice"> </if>
<!--@mbg.generated--> <if test="deviceType != null and deviceType != ''">
update t_platform_device #{deviceType,jdbcType=VARCHAR},
<set> </if>
<if test="deviceSn != null and deviceSn != ''"> <if test="customerId != null">
device_sn = #{deviceSn,jdbcType=VARCHAR}, #{customerId,jdbcType=INTEGER},
</if> </if>
<if test="deviceType != null and deviceType != ''"> <if test="activatTime != null">
device_type = #{deviceType,jdbcType=VARCHAR}, #{activatTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="customerId != null"> <if test="status != null">
customer_id = #{customerId,jdbcType=INTEGER}, #{status,jdbcType=TINYINT},
</if> </if>
<if test="activatTime != null"> <if test="createTime != null">
activat_time = #{activatTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="status != null"> <if test="updateTime != null">
`status` = #{status,jdbcType=TINYINT}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="createTime != null"> <if test="createBy != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
</if> </if>
<if test="updateTime != null"> <if test="updateBy != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=INTEGER},
</if> </if>
<if test="createBy != null"> <if test="remark != null and remark != ''">
create_by = #{createBy,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
</if> </if>
<if test="updateBy != null"> </trim>
update_by = #{updateBy,jdbcType=INTEGER}, </insert>
</if> <update id="updateByPrimaryKeySelective" parameterType="com.glsx.model.PlatformDevice">
<if test="remark != null and remark != ''"> <!--@mbg.generated-->
remark = #{remark,jdbcType=VARCHAR}, update t_platform_device
</if> <set>
</set> <if test="deviceSn != null and deviceSn != ''">
where id = #{id,jdbcType=INTEGER} device_sn = #{deviceSn,jdbcType=VARCHAR},
</update> </if>
<update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformDevice"> <if test="deviceType != null and deviceType != ''">
<!--@mbg.generated--> device_type = #{deviceType,jdbcType=VARCHAR},
update t_platform_device </if>
set device_sn = #{deviceSn,jdbcType=VARCHAR}, <if test="customerId != null">
device_type = #{deviceType,jdbcType=VARCHAR}, customer_id = #{customerId,jdbcType=INTEGER},
customer_id = #{customerId,jdbcType=INTEGER}, </if>
activat_time = #{activatTime,jdbcType=TIMESTAMP}, <if test="activatTime != null">
`status` = #{status,jdbcType=TINYINT}, activat_time = #{activatTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP}, </if>
update_time = #{updateTime,jdbcType=TIMESTAMP}, <if test="status != null">
create_by = #{createBy,jdbcType=INTEGER}, `status` = #{status,jdbcType=TINYINT},
update_by = #{updateBy,jdbcType=INTEGER}, </if>
remark = #{remark,jdbcType=VARCHAR} <if test="createTime != null">
where id = #{id,jdbcType=INTEGER} create_time = #{createTime,jdbcType=TIMESTAMP},
</update> </if>
<update id="updateBatch" parameterType="java.util.List"> <if test="updateTime != null">
<!--@mbg.generated--> update_time = #{updateTime,jdbcType=TIMESTAMP},
update t_platform_device </if>
<trim prefix="set" suffixOverrides=","> <if test="createBy != null">
<trim prefix="device_sn = case" suffix="end,"> create_by = #{createBy,jdbcType=INTEGER},
<foreach collection="list" index="index" item="item"> </if>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR} <if test="updateBy != null">
</foreach> update_by = #{updateBy,jdbcType=INTEGER},
</trim> </if>
<trim prefix="device_type = case" suffix="end,"> <if test="remark != null and remark != ''">
<foreach collection="list" index="index" item="item"> remark = #{remark,jdbcType=VARCHAR},
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR} </if>
</foreach> </set>
</trim> where id = #{id,jdbcType=INTEGER}
<trim prefix="customer_id = case" suffix="end,"> </update>
<foreach collection="list" index="index" item="item"> <update id="updateByPrimaryKey" parameterType="com.glsx.model.PlatformDevice">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER} <!--@mbg.generated-->
</foreach> update t_platform_device
</trim> set device_sn = #{deviceSn,jdbcType=VARCHAR},
<trim prefix="activat_time = case" suffix="end,"> device_type = #{deviceType,jdbcType=VARCHAR},
<foreach collection="list" index="index" item="item"> customer_id = #{customerId,jdbcType=INTEGER},
when id = #{item.id,jdbcType=INTEGER} then #{item.activatTime,jdbcType=TIMESTAMP} activat_time = #{activatTime,jdbcType=TIMESTAMP},
</foreach> `status` = #{status,jdbcType=TINYINT},
</trim> create_time = #{createTime,jdbcType=TIMESTAMP},
<trim prefix="`status` = case" suffix="end,"> update_time = #{updateTime,jdbcType=TIMESTAMP},
<foreach collection="list" index="index" item="item"> create_by = #{createBy,jdbcType=INTEGER},
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=TINYINT} update_by = #{updateBy,jdbcType=INTEGER},
</foreach> remark = #{remark,jdbcType=VARCHAR}
</trim> where id = #{id,jdbcType=INTEGER}
<trim prefix="create_time = case" suffix="end,"> </update>
<foreach collection="list" index="index" item="item"> <update id="updateBatch" parameterType="java.util.List">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} <!--@mbg.generated-->
</foreach> update t_platform_device
</trim> <trim prefix="set" suffixOverrides=",">
<trim prefix="update_time = case" suffix="end,"> <trim prefix="device_sn = 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.updateTime,jdbcType=TIMESTAMP} when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</foreach> </foreach>
</trim> </trim>
<trim prefix="create_by = case" suffix="end,"> <trim prefix="device_type = 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.createBy,jdbcType=INTEGER} when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR}
</foreach> </foreach>
</trim> </trim>
<trim prefix="update_by = case" suffix="end,"> <trim prefix="customer_id = 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.updateBy,jdbcType=INTEGER} when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
</foreach> </foreach>
</trim> </trim>
<trim prefix="remark = 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.remark,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER}
</foreach> then #{item.activatTime,jdbcType=TIMESTAMP}
</trim> </foreach>
</trim> </trim>
where id in <trim prefix="`status` = case" suffix="end,">
<foreach close=")" collection="list" item="item" open="(" separator=", "> <foreach collection="list" index="index" item="item">
#{item.id,jdbcType=INTEGER} when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=TINYINT}
</foreach> </foreach>
</update> </trim>
<update id="updateBatchSelective" parameterType="java.util.List"> <trim prefix="create_time = case" suffix="end,">
<!--@mbg.generated--> <foreach collection="list" index="index" item="item">
update t_platform_device when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
<trim prefix="set" suffixOverrides=","> </foreach>
<trim prefix="device_sn = case" suffix="end,"> </trim>
<foreach collection="list" index="index" item="item"> <trim prefix="update_time = case" suffix="end,">
<if test="item.deviceSn != null"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
</if> </foreach>
</foreach> </trim>
</trim> <trim prefix="create_by = case" suffix="end,">
<trim prefix="device_type = 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.createBy,jdbcType=INTEGER}
<if test="item.deviceType != null"> </foreach>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceType,jdbcType=VARCHAR} </trim>
</if> <trim prefix="update_by = case" suffix="end,">
</foreach> <foreach collection="list" index="index" item="item">
</trim> when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=INTEGER}
<trim prefix="customer_id = case" suffix="end,"> </foreach>
<foreach collection="list" index="index" item="item"> </trim>
<if test="item.customerId != null"> <trim prefix="remark = case" suffix="end,">
when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER} <foreach collection="list" index="index" item="item">
</if> when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</foreach> </foreach>
</trim> </trim>
<trim prefix="activat_time = case" suffix="end,"> </trim>
<foreach collection="list" index="index" item="item"> where id in
<if test="item.activatTime != null"> <foreach close=")" collection="list" item="item" open="(" separator=", ">
when id = #{item.id,jdbcType=INTEGER} then #{item.activatTime,jdbcType=TIMESTAMP} #{item.id,jdbcType=INTEGER}
</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> </foreach>
</trim> </update>
<trim prefix="update_by = case" suffix="end,"> <update id="updateBatchSelective" parameterType="java.util.List">
<foreach collection="list" index="index" item="item"> <!--@mbg.generated-->
<if test="item.updateBy != null"> update t_platform_device
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=INTEGER} <trim prefix="set" suffixOverrides=",">
</if> <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> </foreach>
</trim> </update>
<trim prefix="remark = case" suffix="end,"> <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
<foreach collection="list" index="index" item="item"> useGeneratedKeys="true">
<if test="item.remark != null"> <!--@mbg.generated-->
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR} insert into t_platform_device
</if> (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> </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 \ 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 @@ ...@@ -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 &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"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!