Commit a09cea1b by 杨林龙

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/glsx/controller/IndexController.java
#	src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
#	src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
#	src/main/resources/mapper/PlatformDeviceMapper.xml
#	src/main/resources/mapper/PlatformUserMapper.xml
2 parents 8c8d60b0 17f29119
package com.glsx.controller;
import java.util.List;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.glsx.model.PlatformApi;
import com.glsx.model.PlatformApiCall;
import com.glsx.service.ApiCallMgrService;
import com.glsx.vo.ApiCallVo;
import com.glsx.vo.R;
import io.swagger.annotations.Api;
import org.oreframework.web.ui.Pagination;
import org.oreframework.web.ui.ResponseEntity;
import org.oreframework.web.ui.ResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -19,8 +16,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.List;
@Api
@RestController
@RequestMapping(value = "/apicallmgr")
......@@ -35,9 +30,9 @@ public class ApiCallMgrController {
@RequestMapping(value = "/getApiCallMgrList", method = RequestMethod.GET)
@ResponseBody
public R getApiCallMgrList(Pagination pagination, ApiCallVo apiCallVo) {
public R getApiCallMgrList(ApiCallVo apiCallVo) {
//PageHelper注入分页和要分页的查询之前不能有其它查询,不然分页到第一个查询上面
Page<PlatformApiCall> page = PageHelper.startPage(pagination.getCurrentPage(), pagination.getPageSize(), true);
Page<PlatformApiCall> page = PageHelper.startPage(apiCallVo.getCurrentPage(), apiCallVo.getPageSize(), true);
List<PlatformApiCall> apiMgrList = apiCallMgrService.getApiCallMgrList(apiCallVo);
......
package com.glsx.controller;
import java.util.HashMap;
import java.util.List;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.glsx.model.PlatformCustomer;
import com.glsx.model.PlatformDevice;
import com.glsx.service.DeviceMgrService;
import com.glsx.vo.DeviceVo;
import com.glsx.vo.R;
import io.swagger.annotations.Api;
import org.oreframework.web.ui.Pagination;
import org.oreframework.web.ui.ResponseEntity;
import org.oreframework.web.ui.ResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -19,9 +17,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;
@Api
@RestController
@RequestMapping(value = "/devicemgr")
......@@ -36,9 +31,10 @@ public class DeviceMgrController {
@RequestMapping(value = "/getDeviceMgrList", method = RequestMethod.GET)
@ResponseBody
public R getDeviceMgrList(Pagination pagination, DeviceVo deviceVo) {
public R getDeviceMgrList(DeviceVo deviceVo) {
//PageHelper注入分页和要分页的查询之前不能有其它查询,不然分页到第一个查询上面
Page<PlatformDevice> page = PageHelper.startPage(pagination.getCurrentPage(), pagination.getPageSize(), true);
Page<PlatformDevice> page = PageHelper.startPage(deviceVo.getCurrentPage(),
deviceVo.getPageSize(), true);
List<PlatformDevice> deviceMgrList = deviceMgrService.getDeviceMgrList(deviceVo);
......
......@@ -52,6 +52,9 @@ public class IndexController {
@Autowired
private AppDownloadMgrService appDownloadMgrService;
@Autowired
private IndexService indexService;
@RequestMapping(value = "/getStatisticData", method = RequestMethod.GET)
@ResponseBody
public R getStatisticData() {
......@@ -98,40 +101,35 @@ public class IndexController {
return R.ok().data(hashMap);
}
@RequestMapping(value = "/getStatisticDataForUserConsole", method = RequestMethod.GET)
@ResponseBody
public R getStatisticDataForUserConsole1(String customerName) {
Map<String, Integer> hashMap = new HashMap<>();
int deviceCountAuth = deviceMgrService.getDeviceCountAuth(customerName);
int userCountAuth = userMgrService.getUserCountAuth(customerName);
int apiCallCountAuth = appDownloadMgrService.getApiCallCountAuth(customerName);
hashMap.put("deviceCount", deviceCountAuth);
hashMap.put("userCount", userCountAuth);
hashMap.put("apiCallCount", apiCallCountAuth);
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<>();
int deviceCountAuth = deviceMgrService.getDeviceCountAuth(customerName);
public R getUcSummaryStatistic(String customerName) {
Map<String, Integer> statisticMap = this.indexService.getUcSummaryStatistic(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) {
Map<String, Integer> statisticMap = this.indexService
.getUcDeviceActivationStatistic(customerName);
return R.ok().data(statisticMap);
}
hashMap.put("deviceCount", deviceCountAuth);
hashMap.put("userCount", userCountAuth);
hashMap.put("apiCallCount", apiCallCountAuth);
@RequestMapping(value = "/getUcUserActivityStatistic", method = RequestMethod.GET)
public R getUcUserActivityStatistic(String customerName) {
Map<String, Integer> statisticMap = this.indexService
.getUcUserActivityStatistic(customerName);
return R.ok().data(statisticMap);
}
return R.ok().data(hashMap);
@RequestMapping(value = "/getUcAppDownloadStatistic", method = RequestMethod.GET)
public R getUcAppDownloadStatistic(String customerName) {
Map<String, Integer> statisticMap = this.indexService
.getUcAppDownloadStatistic(customerName);
return R.ok().data(statisticMap);
}
}
package com.glsx.controller;
import java.util.List;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.glsx.model.PlatformUser;
......@@ -7,9 +8,6 @@ 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.oreframework.web.ui.ResponseEntity;
import org.oreframework.web.ui.ResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,8 +16,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.List;
@Api
@RestController
@RequestMapping(value = "/usermgr")
......@@ -34,9 +30,10 @@ public class UserMgrController {
@RequestMapping(value = "/getUserMgrList", method = RequestMethod.GET)
@ResponseBody
public R getUserMgrList(Pagination pagination, UserVo userVo) {
public R getUserMgrList(UserVo userVo) {
//PageHelper注入分页和要分页的查询之前不能有其它查询,不然分页到第一个查询上面
Page<PlatformUser> page = PageHelper.startPage(pagination.getCurrentPage(), pagination.getPageSize(), true);
Page<PlatformUser> page = PageHelper.startPage(userVo.getCurrentPage(),
userVo.getPageSize(), true);
List<PlatformUser> userMgrList = userMgrService.getUserMgrList(userVo);
......
package com.glsx.enums;
import com.glsx.exception.BusinessException;
/**
* <p>Description:
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
public enum ResultCodeEnum {
SUCCESS(200, "成功"),
SERVER_ERROR(500, "系统异常"),
;
private final Integer code;
private final String msg;
ResultCodeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
public BusinessException exception() {
return new BusinessException(this.code, this.msg);
}
}
package com.glsx.exception;
/**
* <p>Description: 业务异常
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
public class BusinessException extends RuntimeException {
private Integer code;
private String message;
public BusinessException() {}
public BusinessException(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String getMessage() {
return this.message;
}
}
package com.glsx.exception;
import com.glsx.enums.ResultCodeEnum;
import com.glsx.vo.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* <p>Description:
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ExceptionHandler({BusinessException.class})
public R handleBusinessException(BusinessException e) {
this.logger.error("!!!! ERROR", e);
return R.error(e.getCode(), e.getMessage());
}
@ExceptionHandler({Throwable.class})
public R handlerOtherException(Throwable e) {
this.logger.error("!!!! ERROR", e);
return R.error(ResultCodeEnum.SERVER_ERROR.getCode(),
ResultCodeEnum.SERVER_ERROR.getMsg());
}
}
......@@ -4,8 +4,6 @@ import com.glsx.model.PlatformAppDownload;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>Description:
* <p>Project: shop
......@@ -36,4 +34,7 @@ public interface PlatformAppDownloadMapper {
int updateBatchSelective(List<PlatformAppDownload> list);
int getApiCallCountAuth(@Param("customerName") String customerName);
List<Map<String, Object>> getAppDownloadStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.glsx.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -43,9 +44,13 @@ public interface PlatformDeviceMapper {
int getDeviceCount();
List<Map<String, Integer>> getDeviceGraphData();
Map<String, Integer> getDeviceGraphData();
int getDeviceCountAuth(@Param("customerName") String customerName);
List<Map<String, Integer>> getDeviceAccessTrendList();
List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
}
\ No newline at end of file
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;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>Description:
* <p>Project: shop
......@@ -41,4 +42,7 @@ public interface PlatformUserMapper {
int getUserCount();
int getUserCountAuth(@Param("customerName") String customerName);
}
\ No newline at end of file
List<Map<String, Object>> getUserActivityStatistic(@Param("startTime") Date startTime,
@Param("endTime") Date endTime, @Param("customerName") String customerName);
}
......@@ -2,6 +2,7 @@ package com.glsx.model;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* <p>Description:
......@@ -16,6 +17,23 @@ import java.util.Date;
*/
public class PlatformUser implements Serializable {
/**
* 客户名称
*/
private String customerName;
/**
* 省份名称
*/
private String provinceName;
/**
* 城市名称
*/
private String cityName;
/**
* 主键
*/
private Integer id;
......@@ -51,13 +69,9 @@ public class PlatformUser implements Serializable {
private Integer customerId;
/**
* 客户名称
*/
private String customerName;
/**
* 最后登录时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastLoginTime;
/**
......@@ -68,11 +82,13 @@ public class PlatformUser implements Serializable {
/**
* 创建时间 注册时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
......@@ -90,6 +106,30 @@ public class PlatformUser implements Serializable {
*/
private String remark;
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public Integer getId() {
return id;
}
......@@ -202,25 +242,19 @@ public class PlatformUser implements Serializable {
this.remark = remark;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
@Override
public String toString() {
return "PlatformUser{" +
"id=" + id +
"customerName='" + customerName + '\'' +
", provinceName='" + provinceName + '\'' +
", cityName='" + cityName + '\'' +
", id=" + id +
", nickname='" + nickname + '\'' +
", contactNumber='" + contactNumber + '\'' +
", wechatId='" + wechatId + '\'' +
", province=" + province +
", city=" + city +
", customerId=" + customerId +
", customerName='" + customerName + '\'' +
", lastLoginTime=" + lastLoginTime +
", appAccountId=" + appAccountId +
", createTime=" + createTime +
......@@ -230,4 +264,4 @@ public class PlatformUser implements Serializable {
", remark='" + remark + '\'' +
'}';
}
}
\ No newline at end of file
}
package com.glsx.service;
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);
Map<String, Integer> getUcDeviceActivationStatistic(String customerName);
Map<String, Integer> getUcUserActivityStatistic(String customerName);
Map<String, Integer> getUcAppDownloadStatistic(String customerName);
}
package com.glsx.service.impl;
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 Map<String, Integer> getUcDeviceActivationStatistic(String customerName) {
Map<String, Integer> statisticMap;
List<Map<String, Object>> columnList = this.deviceMapper.getDeviceActivationStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName);
statisticMap = this.convertColumnToMap(columnList);
return statisticMap;
}
@Override
public Map<String, Integer> getUcUserActivityStatistic(String customerName) {
Map<String, Integer> statisticMap;
List<Map<String, Object>> columnList = this.userMapper.getUserActivityStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName);
statisticMap = this.convertColumnToMap(columnList);
return statisticMap;
}
@Override
public Map<String, Integer> getUcAppDownloadStatistic(String customerName) {
Map<String, Integer> statisticMap;
List<Map<String, Object>> columnList = this.appDownloadMapper.getAppDownloadStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName);
statisticMap = this.convertColumnToMap(columnList);
return statisticMap;
}
private Date getStatisticStartTime() {
return DateUtil.beginOfDay(new Date());
}
private Date getStatisticEndTime() {
return DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -31);
}
private Map<String, Integer> convertColumnToMap(List<Map<String, Object>> columnList) {
Map<String, Integer> statisticMap = new HashMap<>();
for (Map<String, Object> columnMap : columnList) {
statisticMap.put((String) columnMap.get("time"), (Integer) columnMap.get("count"));
}
return statisticMap;
}
}
......@@ -2,6 +2,7 @@ package com.glsx.vo;
import java.io.Serializable;
import java.util.Date;
import org.oreframework.web.ui.Pagination;
/**
* <p>Description:
......@@ -14,7 +15,7 @@ import java.util.Date;
/**
* api调用表
*/
public class ApiCallVo implements Serializable {
public class ApiCallVo extends Pagination implements Serializable {
/**
* 访问开始时间
*/
......@@ -40,4 +41,4 @@ public class ApiCallVo implements Serializable {
public void setAccessEndTime(Date accessEndTime) {
this.accessEndTime = accessEndTime;
}
}
\ No newline at end of file
}
......@@ -2,6 +2,7 @@ package com.glsx.vo;
import java.io.Serializable;
import java.util.Date;
import org.oreframework.web.ui.Pagination;
/**
* <p>Description:
......@@ -14,7 +15,7 @@ import java.util.Date;
/**
* 设备管理表
*/
public class DeviceVo implements Serializable {
public class DeviceVo extends Pagination implements Serializable {
/**
* 客户名称
*/
......@@ -66,4 +67,4 @@ public class DeviceVo implements Serializable {
public void setActivatEndTime(Date activatEndTime) {
this.activatEndTime = activatEndTime;
}
}
\ No newline at end of file
}
......@@ -3,6 +3,7 @@ package com.glsx.vo;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.glsx.enums.ResultCodeEnum;
/**
* 返回数据
......@@ -16,11 +17,10 @@ public class R extends HashMap<String, Object> {
private final static String DATA_KEY = "data";
private final static String LIST_KEY = "list";
private final static String ITEMS_KEY = "items";
private final static String PAGE_KEY = "page";
private final static String TOTAL_PAGES_KEY = "totalPages";
private final static String TOTAL_ELEMENTS_KEY = "totalElements";
private final static int SUCCESS_CODE = 200;
private final static int SUCCESS_CODE = ResultCodeEnum.SUCCESS.getCode();
public R() {
put(CODE_KEY, SUCCESS_CODE);
......@@ -28,11 +28,11 @@ public class R extends HashMap<String, Object> {
}
public static R error() {
return error(500, "未知异常,请联系管理员");
return error(ResultCodeEnum.SERVER_ERROR);
}
public static R error(String msg) {
return error(500, msg);
return error(ResultCodeEnum.SERVER_ERROR.getCode(), msg);
}
public static R error(int code, String msg) {
......@@ -49,6 +49,13 @@ public class R extends HashMap<String, Object> {
return r;
}
public static R error(ResultCodeEnum resultCodeEnum) {
R r = new R();
r.put(CODE_KEY, resultCodeEnum.getCode());
r.put(MSG_KEY, resultCodeEnum.getMsg());
return r;
}
public static R ok(String msg) {
R r = new R();
r.put(MSG_KEY, msg);
......
......@@ -2,6 +2,7 @@ package com.glsx.vo;
import java.io.Serializable;
import java.util.Date;
import org.oreframework.web.ui.Pagination;
/**
* <p>Description:
......@@ -14,7 +15,11 @@ import java.util.Date;
/**
* 设备管理表
*/
public class UserVo implements Serializable {
public class UserVo extends Pagination implements Serializable {
/**
* 客户ID
*/
private Integer customerId;
/**
* 客户名称
*/
......@@ -66,4 +71,4 @@ public class UserVo implements Serializable {
public void setRegisterEndTime(Date registerEndTime) {
this.registerEndTime = registerEndTime;
}
}
\ No newline at end of file
}
<?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') `time`,
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 time
</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>
......@@ -88,7 +88,7 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<select id="getDeviceAccessTrendList" resultType="java.util.Map">
<select id="getDeviceAccessTrendList" resultType="java.util.Map">
select
date_format(activat_time,'%Y-%m-%d') as activat_time,
count(id)
......@@ -96,6 +96,21 @@
group by activat_time
</select>
<select id="getDeviceActivationStatistic" resultType="map">
select date_format(pd.activat_time, '%Y-%m-%d') `time`,
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 time
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from t_platform_device
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!