Commit f38081a5 by tyfanchz

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

2 parents 975a9716 79eaa7f2
Showing 22 changed files with 299 additions and 55 deletions
package cn.com.glsx.openplatform.enums;
import cn.com.glsx.openplatform.exception.BusinessException;
/**
* <p>Description:
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
public enum MessageMethodEnum {
ADD(1, "增加"),
UPDATE(2, "修改"),
DELETE(3, "删除");
private final Integer code;
private final String msg;
MessageMethodEnum(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 cn.com.glsx.openplatform.model; package cn.com.glsx.openplatform.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/** /**
* <p>Description: * <p>Description:
......
package cn.com.glsx.openplatform.model;
import cn.com.glsx.framework.core.beans.BaseModel;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Table;
/**
* <p>Description:
* <p>Project: shop
*
* @author wbh
* @date 2020-12-15
*/
/**
* 设备管理表
*/
@Data
@Table(name = "t_platform_sub_message")
public class PlatformSubMessage extends BaseModel{
/**
* 消息类型ID
*/
@Column(name = "msg_id")
private Integer msgID;
/**
* 设备类型ID
*/
@Column(name = "device_type")
private Integer deviceType;
/**
* 推送地址
*/
@Column(name = "push_url")
private String pushUrl;
}
...@@ -19,13 +19,6 @@ public interface DeviceMgrService { ...@@ -19,13 +19,6 @@ public interface DeviceMgrService {
R getDeviceMgrList(Page page, DeviceVo deviceVo); R getDeviceMgrList(Page page, DeviceVo deviceVo);
/** /**
* 获取客服名
*
* @return
*/
List<String> getCustomerNameList();
/**
* 获取设备类型列表 * 获取设备类型列表
* *
* @return * @return
......
...@@ -14,32 +14,32 @@ public interface IndexService { ...@@ -14,32 +14,32 @@ public interface IndexService {
/** /**
* 根据客户名获取统计数量 * 根据客户名获取统计数量
* *
* @param customerName 客户名 * @param customerNameAuth 客户名
* @return * @return
*/ */
Map<String, Integer> getUcSummaryStatistic(String customerName); Map<String, Integer> getUcSummaryStatistic(String customerNameAuth);
/** /**
* 根据客户名获取设备激活数量 * 根据客户名获取设备激活数量
* *
* @param customerName 客户名 * @param customerNameAuth 客户名
* @return * @return
*/ */
List<Map<String, Object>> getUcDeviceActivationStatistic(String customerName); List<Map<String, Object>> getUcDeviceActivationStatistic(String customerNameAuth);
/** /**
* 根据客户名获取用户在线数量 * 根据客户名获取用户在线数量
* *
* @param customerName 客户名 * @param customerNameAuth 客户名
* @return * @return
*/ */
List<Map<String, Object>> getUcUserActivityStatistic(String customerName); List<Map<String, Object>> getUcUserActivityStatistic(String customerNameAuth);
/** /**
* 根据客户名获取app下载数量 * 根据客户名获取app下载数量
* *
* @param customerName 客户名 * @param customerNameAuth 客户名
* @return * @return
*/ */
List<Map<String, Object>> getUcAppDownloadStatistic(String customerName); List<Map<String, Object>> getUcAppDownloadStatistic(String customerNameAuth);
} }
...@@ -38,7 +38,17 @@ public interface OpenApiService { ...@@ -38,7 +38,17 @@ public interface OpenApiService {
* @param page * @param page
* @param start_time * @param start_time
* @param end_time * @param end_time
* @return 结果集
*/
Map<String, Object> getDeviceList(int appid, Page page, Date start_time, Date end_time);
/**
* 消息订阅
* @param msgID 消息类型ID
* @param deviceType 设备类型
* @param method
* @param pushUrl
* @return * @return
*/ */
Map<String, Object> getDeviceList(Integer appid, Page page, Date start_time, Date end_time); Map<String, Object> subscribeMessage(int msgID,int deviceType,int method,String pushUrl);
} }
...@@ -22,7 +22,7 @@ public interface UserMgrService { ...@@ -22,7 +22,7 @@ public interface UserMgrService {
* *
* @return * @return
*/ */
List<String> getCustomerNameList(); List<String> getCustomerNameList(String customerName);
/** /**
* 获取用户数量 * 获取用户数量
......
package cn.com.glsx.openplatform.util; package cn.com.glsx.openplatform.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import cn.com.glsx.openplatform.config.FdfsProperty; import cn.com.glsx.openplatform.config.FdfsProperty;
import com.github.tobato.fastdfs.domain.fdfs.StorePath; import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient; import com.github.tobato.fastdfs.service.FastFileStorageClient;
...@@ -14,6 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
/** /**
* <p>Description: FastDFS 文件操作工具类 * <p>Description: FastDFS 文件操作工具类
* <p>Project: shop * <p>Project: shop
......
package cn.com.glsx.openplatform.util; package cn.com.glsx.openplatform.util;
import org.springframework.stereotype.Component;
import org.springframework.util.Base64Utils;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import java.security.KeyFactory; import java.security.*;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey; import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec; import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.springframework.stereotype.Component;
import org.springframework.util.Base64Utils;
/** /**
......
...@@ -24,6 +24,11 @@ public class DeviceVo implements Serializable { ...@@ -24,6 +24,11 @@ public class DeviceVo implements Serializable {
private String customerName; private String customerName;
/** /**
* 客户名称(鉴权)
*/
private String customerNameAuth;
/**
* 类型 * 类型
*/ */
private String deviceType; private String deviceType;
...@@ -73,4 +78,12 @@ public class DeviceVo implements Serializable { ...@@ -73,4 +78,12 @@ public class DeviceVo implements Serializable {
public void setActivatEndTime(Date activatEndTime) { public void setActivatEndTime(Date activatEndTime) {
this.activatEndTime = activatEndTime; this.activatEndTime = activatEndTime;
} }
public String getCustomerNameAuth() {
return customerNameAuth;
}
public void setCustomerNameAuth(String customerNameAuth) {
this.customerNameAuth = customerNameAuth;
}
} }
package cn.com.glsx.openplatform.vo;
import lombok.Data;
import java.io.Serializable;
/**
* <p>Description:
* <p>Project: shop
*
* @author fengzhi
* @date 2020-12-23
*/
/**
* 设备
*/
@Data
public class OpenDeviceVo implements Serializable {
private Integer id;
/**
* 设备号
*/
private String sn;
/**
* 客户名称
*/
private String username;
/**
* 手机号
*/
private String mobile;
}
...@@ -28,6 +28,11 @@ public class UserVo implements Serializable { ...@@ -28,6 +28,11 @@ public class UserVo implements Serializable {
private String customerName; private String customerName;
/** /**
* 客户名称(鉴权)
*/
private String customerNameAuth;
/**
* 类型 * 类型
*/ */
private String deviceType; private String deviceType;
...@@ -77,4 +82,12 @@ public class UserVo implements Serializable { ...@@ -77,4 +82,12 @@ public class UserVo implements Serializable {
public void setRegisterEndTime(Date registerEndTime) { public void setRegisterEndTime(Date registerEndTime) {
this.registerEndTime = registerEndTime; this.registerEndTime = registerEndTime;
} }
public String getCustomerNameAuth() {
return customerNameAuth;
}
public void setCustomerNameAuth(String customerNameAuth) {
this.customerNameAuth = customerNameAuth;
}
} }
...@@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p>Description: * <p>Description:
...@@ -21,7 +20,7 @@ public interface PlatformCustomerMapper extends OreMapper<PlatformCustomer> { ...@@ -21,7 +20,7 @@ public interface PlatformCustomerMapper extends OreMapper<PlatformCustomer> {
List<PlatformCustomer> getCustomerMgrList(); List<PlatformCustomer> getCustomerMgrList();
List<String> getCustomerNameList(); List<String> getCustomerNameList(@Param("customerName") String customerName);
int getCustomerCount(); int getCustomerCount();
......
...@@ -2,10 +2,11 @@ package cn.com.glsx.openplatform.mapper; ...@@ -2,10 +2,11 @@ package cn.com.glsx.openplatform.mapper;
import cn.com.glsx.openplatform.model.PlatformDevice; import cn.com.glsx.openplatform.model.PlatformDevice;
import cn.com.glsx.openplatform.vo.DeviceVo; import cn.com.glsx.openplatform.vo.DeviceVo;
import com.github.pagehelper.Page; import cn.com.glsx.openplatform.vo.OpenDeviceVo;
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 org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,7 +35,9 @@ public interface PlatformDeviceMapper extends OreMapper<PlatformDevice> { ...@@ -34,7 +35,9 @@ public interface PlatformDeviceMapper extends OreMapper<PlatformDevice> {
List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerName") String customerName); List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerName") String customerName);
List<Map<String, Object>> getDeviceByTimeRangeAndCustID(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerID") String customerID); List<OpenDeviceVo> getDeviceByTimeRangeAndCustID(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerID") Integer customerID);
int getCountDeviceByTimeRangeAndCustID(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerID") Integer customerID);
int getDeviceCountByCustomerId(@Param("customerId") int customerId, @Param("deviceTypeStr") String deviceTypeStr); int getDeviceCountByCustomerId(@Param("customerId") int customerId, @Param("deviceTypeStr") String deviceTypeStr);
......
package cn.com.glsx.openplatform.mapper;
import cn.com.glsx.openplatform.model.PlatformSubMessage;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
/**
* <p>Description:
* <p>Project: shop
*
* @author wbh
* @date 2020-12-15
*/
@Mapper
public interface PlatformMessageMapper extends OreMapper<PlatformSubMessage> {
}
\ No newline at end of file \ No newline at end of file
...@@ -39,11 +39,6 @@ public class DeviceMgrServiceImpl implements DeviceMgrService { ...@@ -39,11 +39,6 @@ public class DeviceMgrServiceImpl implements DeviceMgrService {
} }
@Override @Override
public List<String> getCustomerNameList() {
return customerMapper.getCustomerNameList();
}
@Override
public List<String> getDeviceTypeList() { public List<String> getDeviceTypeList() {
return deviceMapper.getDeviceTypeList(); return deviceMapper.getDeviceTypeList();
} }
......
...@@ -35,11 +35,11 @@ public class IndexServiceImpl implements IndexService { ...@@ -35,11 +35,11 @@ public class IndexServiceImpl implements IndexService {
private PlatformAppDownloadMapper appDownloadMapper; private PlatformAppDownloadMapper appDownloadMapper;
@Override @Override
public Map<String, Integer> getUcSummaryStatistic(String customerName) { public Map<String, Integer> getUcSummaryStatistic(String customerNameAuth) {
Map<String, Integer> statisticMap = new HashMap<>(); Map<String, Integer> statisticMap = new HashMap<>();
int deviceCount = this.deviceMapper.getDeviceCountAuth(customerName); int deviceCount = this.deviceMapper.getDeviceCountAuth(customerNameAuth);
int userCount = this.userMapper.getUserCountAuth(customerName); int userCount = this.userMapper.getUserCountAuth(customerNameAuth);
int appDownloadCount = this.appDownloadMapper.getApiCallCountAuth(customerName); int appDownloadCount = this.appDownloadMapper.getApiCallCountAuth(customerNameAuth);
statisticMap.put("deviceCount", deviceCount); statisticMap.put("deviceCount", deviceCount);
statisticMap.put("userCount", userCount); statisticMap.put("userCount", userCount);
...@@ -48,28 +48,28 @@ public class IndexServiceImpl implements IndexService { ...@@ -48,28 +48,28 @@ public class IndexServiceImpl implements IndexService {
} }
@Override @Override
public List<Map<String, Object>> getUcDeviceActivationStatistic(String customerName) { public List<Map<String, Object>> getUcDeviceActivationStatistic(String customerNameAuth) {
List<Map<String, Object>> statisticList = this.deviceMapper.getDeviceActivationStatistic( List<Map<String, Object>> statisticList = this.deviceMapper.getDeviceActivationStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(), this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName); customerNameAuth);
return statisticList; return statisticList;
} }
@Override @Override
public List<Map<String, Object>> getUcUserActivityStatistic(String customerName) { public List<Map<String, Object>> getUcUserActivityStatistic(String customerNameAuth) {
List<Map<String, Object>> statisticList = this.userMapper.getUserActivityStatistic( List<Map<String, Object>> statisticList = this.userMapper.getUserActivityStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(), this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName); customerNameAuth);
return statisticList; return statisticList;
} }
@Override @Override
public List<Map<String, Object>> getUcAppDownloadStatistic(String customerName) { public List<Map<String, Object>> getUcAppDownloadStatistic(String customerNameAuth) {
List<Map<String, Object>> statisticList = this.appDownloadMapper.getAppDownloadStatistic( List<Map<String, Object>> statisticList = this.appDownloadMapper.getAppDownloadStatistic(
this.getStatisticStartTime(), this.getStatisticEndTime(), this.getStatisticStartTime(), this.getStatisticEndTime(),
customerName); customerNameAuth);
return statisticList; return statisticList;
} }
......
package cn.com.glsx.openplatform.service; package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.enums.MessageMethodEnum;
import cn.com.glsx.openplatform.mapper.PlatformCustomerMapper; import cn.com.glsx.openplatform.mapper.PlatformCustomerMapper;
import cn.com.glsx.openplatform.mapper.PlatformDeviceMapper; import cn.com.glsx.openplatform.mapper.PlatformDeviceMapper;
import cn.com.glsx.openplatform.mapper.PlatformMessageMapper;
import cn.com.glsx.openplatform.mapper.PlatformUserMapper; import cn.com.glsx.openplatform.mapper.PlatformUserMapper;
import cn.com.glsx.openplatform.model.PlatformCustomer; import cn.com.glsx.openplatform.model.PlatformCustomer;
import cn.com.glsx.openplatform.model.PlatformSubMessage;
import cn.com.glsx.openplatform.vo.OpenDeviceVo;
import cn.hutool.db.Page; import cn.hutool.db.Page;
import com.alibaba.dubbo.config.annotation.Service; import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
...@@ -31,6 +36,10 @@ public class OpenApiServiceImpl implements OpenApiService { ...@@ -31,6 +36,10 @@ public class OpenApiServiceImpl implements OpenApiService {
@Resource @Resource
private PlatformCustomerMapper customerMapper; private PlatformCustomerMapper customerMapper;
@Resource
private PlatformMessageMapper messageMapper;
/** /**
* 获取商户下的数据概况信息 * 获取商户下的数据概况信息
* *
...@@ -117,11 +126,75 @@ public class OpenApiServiceImpl implements OpenApiService { ...@@ -117,11 +126,75 @@ public class OpenApiServiceImpl implements OpenApiService {
} }
@Override @Override
public Map<String, Object> getDeviceList(Integer appid, Page page, Date start_time, Date end_time) { public Map<String, Object> subscribeMessage(int msgID, int deviceType, int method, String pushUrl) {
log.info("rpc==subscribeMessage开始===msgID:" + msgID + ",deviceType:" + deviceType + ",method:" + method + ",pushUrl:" + pushUrl);
//封装返回数据
Map<String, Object> res = new HashMap<>();
try {
//查询msgID是否存在
Example example = new Example(PlatformSubMessage.class);
example.createCriteria().andEqualTo("msg_id",msgID);
PlatformSubMessage message = messageMapper.selectOneByExample(example);
//新增
if(MessageMethodEnum.ADD.getCode()==method){
if(null != message){
//msgID存在,返回失败信息
res.put("success",false);
res.put("msg","新增失败,msgID存在");
return res;
}else {
//新增订阅消息
message = new PlatformSubMessage();
message.setMsgID(msgID);
message.setPushUrl(pushUrl);
message.setDeviceType(deviceType);
messageMapper.insert(message);
}
}
//更新
if(MessageMethodEnum.UPDATE.getCode()==method){
if(null != message){
//msgID存在,更新数据
message.setPushUrl(pushUrl);
message.setDeviceType(deviceType);
messageMapper.updateByPrimaryKey(message);
}else {
//不存在,新增数据
message = new PlatformSubMessage();
message.setMsgID(msgID);
message.setPushUrl(pushUrl);
message.setDeviceType(deviceType);
messageMapper.insert(message);
}
}
//删除
if(MessageMethodEnum.DELETE.getCode()==method){
if(null != message){
//msgID存在,逻辑删除数据
message.setDeletedFlag("1");
messageMapper.updateByPrimaryKey(message);
}
}
//执行成功
res.put("success",true);
}catch (Exception e){
res.put("success",false);
res.put("msg",e.getMessage());
return res;
}
log.info("rpc==subscribeMessage结果==" + res);
return res;
}
@Override
public Map<String, Object> getDeviceList(int appid, Page page, Date start_time, Date end_time) {
log.info("rpc==getDeviceList开始==appid:" + appid, "==page:" + page + "==start_time:" + start_time, "==end_time:" + start_time); log.info("rpc==getDeviceList开始==appid:" + appid, "==page:" + page + "==start_time:" + start_time, "==end_time:" + start_time);
//分页查询 //分页查询
PageHelper.startPage(page.getPageNumber(), page.getPageSize(), true); PageHelper.startPage(page.getPageNumber(), page.getPageSize(), true);
List<Map<String, Object>> deviceList = deviceMapper.getDeviceByTimeRangeAndCustID(start_time, end_time, appid + ""); List<OpenDeviceVo> deviceList = deviceMapper.getDeviceByTimeRangeAndCustID(start_time, end_time, appid);
//分页结果 //分页结果
PageInfo pageInfo = new PageInfo<>(deviceList); PageInfo pageInfo = new PageInfo<>(deviceList);
......
...@@ -36,8 +36,8 @@ public class UserMgrServiceImpl implements UserMgrService { ...@@ -36,8 +36,8 @@ public class UserMgrServiceImpl implements UserMgrService {
} }
@Override @Override
public List<String> getCustomerNameList() { public List<String> getCustomerNameList(String customerName) {
return customerMapper.getCustomerNameList(); return customerMapper.getCustomerNameList(customerName);
} }
@Override @Override
......
...@@ -193,11 +193,13 @@ ...@@ -193,11 +193,13 @@
left join t_sys_area b on a.province = b.id left join t_sys_area b on a.province = b.id
left join t_sys_area c on a.city = c.id left join t_sys_area c on a.city = c.id
left join t_sys_area d on a.area = d.id left join t_sys_area d on a.area = d.id
order by a.id desc
</select> </select>
<select id="getCustomerNameList" resultType="java.lang.String"> <select id="getCustomerNameList" resultType="java.lang.String">
select distinct customer_name select distinct customer_name
from t_platform_customer from t_platform_customer
where customer_name like '%${customerName}%'
</select> </select>
<select id="getCustomerCount" resultType="java.lang.Integer"> <select id="getCustomerCount" resultType="java.lang.Integer">
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<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,
...@@ -41,7 +42,10 @@ ...@@ -41,7 +42,10 @@
left join t_platform_customer b on a.customer_id = b.id left join t_platform_customer b on a.customer_id = b.id
where 1 = 1 where 1 = 1
<if test="customerName != null and customerName != ''"> <if test="customerName != null and customerName != ''">
and b.customer_name = #{customerName,jdbcType=VARCHAR} and b.customer_name like '%${customerName}%'
</if>
<if test="customerNameAuth != null and customerNameAuth != ''">
and b.customer_name = #{customerNameAuth,jdbcType=VARCHAR}
</if> </if>
<if test="deviceType != null and deviceType != ''"> <if test="deviceType != null and deviceType != ''">
and a.device_type = #{deviceType,jdbcType=VARCHAR} and a.device_type = #{deviceType,jdbcType=VARCHAR}
...@@ -127,12 +131,21 @@ ...@@ -127,12 +131,21 @@
</if> </if>
</select> </select>
<select id="getDeviceByTimeRangeAndCustID" resultType="java.util.Map"> <select id="getDeviceByTimeRangeAndCustID" resultType="cn.com.glsx.openplatform.vo.OpenDeviceVo">
select tpd.device_sn as sn,tpu.nickname as username,tpu.contact_number as mobile from t_platform_device tpd inner join t_platform_user tpu select tpd.device_sn as sn,tpu.nickname as username,tpu.contact_number as mobile from t_platform_device tpd inner join t_platform_user tpu
on tpd.user_id = tpu.id on tpd.user_id = tpu.id
where tpd.activat_time >= #{startTime,jdbcType=TIMESTAMP} where tpd.activat_time >= #{startTime,jdbcType=TIMESTAMP}
and tpd.activat_time &lt; #{endTime,jdbcType=TIMESTAMP} and tpd.activat_time &lt; #{endTime,jdbcType=TIMESTAMP}
and tpd.customer_id = #{customerID} and tpd.customer_id = #{customerID,jdbcType=INTEGER}
order by tpd.activat_time desc
</select>
<select id="getCountDeviceByTimeRangeAndCustID" resultType="java.lang.Integer">
select count(1) from t_platform_device tpd inner join t_platform_user tpu
on tpd.user_id = tpu.id
where tpd.activat_time >= #{startTime,jdbcType=TIMESTAMP}
and tpd.activat_time &lt; #{endTime,jdbcType=TIMESTAMP}
and tpd.customer_id = #{customerID,jdbcType=INTEGER}
order by tpd.activat_time desc order by tpd.activat_time desc
</select> </select>
</mapper> </mapper>
...@@ -53,7 +53,10 @@ ...@@ -53,7 +53,10 @@
left join t_sys_area d on a.city = d.id left join t_sys_area d on a.city = d.id
where 1 = 1 where 1 = 1
<if test="customerName != null and customerName != ''"> <if test="customerName != null and customerName != ''">
and b.customer_name = #{customerName,jdbcType=VARCHAR} and b.customer_name like '%${customerName}%'
</if>
<if test="customerNameAuth != null and customerNameAuth != ''">
and b.customer_name = #{customerNameAuth,jdbcType=VARCHAR}
</if> </if>
<if test="registerStartTime != null"> <if test="registerStartTime != null">
and a.create_time &gt;= #{registerStartTime,jdbcType=TIMESTAMP} and a.create_time &gt;= #{registerStartTime,jdbcType=TIMESTAMP}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!