Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
rpc-openplatform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c8b34494
authored
Jan 02, 2021
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加数据处理
1 parent
4c079730
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
2208 additions
and
0 deletions
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/ActivationData.java
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/CustomerActionStatistics.java
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/CustomerNetworkStatistics.java
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/DeviceActionDetail.java
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/DeviceNetworkDetail.java
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/ShipmentData.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/ActivationDataMapper.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/CustomerActionStatisticsMapper.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/CustomerNetworkStatisticsMapper.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/DeviceActionDetailMapper.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/DeviceNetworkDetailMapper.java
rpc-openplatform-container/src/main/resources/META-INF/orm/ActivationDataMapper.xml
rpc-openplatform-container/src/main/resources/META-INF/orm/CustomerActionStatisticsMapper.xml
rpc-openplatform-container/src/main/resources/META-INF/orm/CustomerNetworkStatisticsMapper.xml
rpc-openplatform-container/src/main/resources/META-INF/orm/DeviceActionDetailMapper.xml
rpc-openplatform-container/src/main/resources/META-INF/orm/DeviceNetworkDetailMapper.xml
rpc-openplatform-container/src/test/java/cn/com/glsx/openplatform/GenerateFakeData.java
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/ActivationData.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
model
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2020-12-29
*/
public
class
ActivationData
{
private
Integer
id
;
private
String
month
;
private
String
endMonth
;
private
Integer
customerId
;
private
String
customer
;
private
Integer
num
;
private
Byte
type
;
private
String
typeName
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getMonth
()
{
return
month
;
}
public
void
setMonth
(
String
month
)
{
this
.
month
=
month
;
}
public
String
getEndMonth
()
{
return
endMonth
;
}
public
void
setEndMonth
(
String
endMonth
)
{
this
.
endMonth
=
endMonth
;
}
public
Integer
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Integer
customerId
)
{
this
.
customerId
=
customerId
;
}
public
String
getCustomer
()
{
return
customer
;
}
public
void
setCustomer
(
String
customer
)
{
this
.
customer
=
customer
;
}
public
Integer
getNum
()
{
return
num
;
}
public
void
setNum
(
Integer
num
)
{
this
.
num
=
num
;
}
public
Byte
getType
()
{
return
type
;
}
public
void
setType
(
Byte
type
)
{
this
.
type
=
type
;
}
public
String
getTypeName
()
{
return
typeName
;
}
public
void
setTypeName
(
String
typeName
)
{
this
.
typeName
=
typeName
;
}
}
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/CustomerActionStatistics.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
model
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
/**
* 客户行为统计表
*/
public
class
CustomerActionStatistics
{
/**
* id
*/
private
Integer
id
;
/**
* 客户id t_platform_customer表的id
*/
private
Integer
customerId
;
/**
* 客户名称
*/
private
String
customerName
;
/**
* 行为类型
*/
private
String
type
;
/**
* 统计时间
*/
private
String
statisticsTime
;
/**
* 活跃数
*/
private
Integer
activeNumber
;
/**
* 激活增长数
*/
private
Integer
activationGrowth
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Integer
customerId
)
{
this
.
customerId
=
customerId
;
}
public
String
getCustomerName
()
{
return
customerName
;
}
public
void
setCustomerName
(
String
customerName
)
{
this
.
customerName
=
customerName
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getStatisticsTime
()
{
return
statisticsTime
;
}
public
void
setStatisticsTime
(
String
statisticsTime
)
{
this
.
statisticsTime
=
statisticsTime
;
}
public
Integer
getActiveNumber
()
{
return
activeNumber
;
}
public
void
setActiveNumber
(
Integer
activeNumber
)
{
this
.
activeNumber
=
activeNumber
;
}
public
Integer
getActivationGrowth
()
{
return
activationGrowth
;
}
public
void
setActivationGrowth
(
Integer
activationGrowth
)
{
this
.
activationGrowth
=
activationGrowth
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", customerId="
).
append
(
customerId
);
sb
.
append
(
", customerName="
).
append
(
customerName
);
sb
.
append
(
", type="
).
append
(
type
);
sb
.
append
(
", statisticsTime="
).
append
(
statisticsTime
);
sb
.
append
(
", activeNumber="
).
append
(
activeNumber
);
sb
.
append
(
", activationGrowth="
).
append
(
activationGrowth
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/CustomerNetworkStatistics.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
model
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
/**
* 客户联网统计表
*/
public
class
CustomerNetworkStatistics
{
/**
* id
*/
private
Integer
id
;
/**
* 客户id t_platform_customer表的id
*/
private
Integer
customerId
;
/**
* 客户名称
*/
private
String
customerName
;
/**
* 类型 1月 2年
*/
private
Byte
type
;
/**
* 统计时间
*/
private
String
statisticsTime
;
/**
* 活跃数
*/
private
Integer
activeNumber
;
/**
* 激活增长数
*/
private
Integer
activationGrowth
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Integer
customerId
)
{
this
.
customerId
=
customerId
;
}
public
String
getCustomerName
()
{
return
customerName
;
}
public
void
setCustomerName
(
String
customerName
)
{
this
.
customerName
=
customerName
;
}
public
Byte
getType
()
{
return
type
;
}
public
void
setType
(
Byte
type
)
{
this
.
type
=
type
;
}
public
String
getStatisticsTime
()
{
return
statisticsTime
;
}
public
void
setStatisticsTime
(
String
statisticsTime
)
{
this
.
statisticsTime
=
statisticsTime
;
}
public
Integer
getActiveNumber
()
{
return
activeNumber
;
}
public
void
setActiveNumber
(
Integer
activeNumber
)
{
this
.
activeNumber
=
activeNumber
;
}
public
Integer
getActivationGrowth
()
{
return
activationGrowth
;
}
public
void
setActivationGrowth
(
Integer
activationGrowth
)
{
this
.
activationGrowth
=
activationGrowth
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", customerId="
).
append
(
customerId
);
sb
.
append
(
", customerName="
).
append
(
customerName
);
sb
.
append
(
", type="
).
append
(
type
);
sb
.
append
(
", statisticsTime="
).
append
(
statisticsTime
);
sb
.
append
(
", activeNumber="
).
append
(
activeNumber
);
sb
.
append
(
", activationGrowth="
).
append
(
activationGrowth
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/DeviceActionDetail.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
model
;
import
java.util.Date
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
/**
* 设备行为明细表
*/
public
class
DeviceActionDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 设备号
*/
private
String
deviceSn
;
/**
* 行为类型
*/
private
String
type
;
/**
* 创建时间
*/
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getDeviceSn
()
{
return
deviceSn
;
}
public
void
setDeviceSn
(
String
deviceSn
)
{
this
.
deviceSn
=
deviceSn
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", deviceSn="
).
append
(
deviceSn
);
sb
.
append
(
", type="
).
append
(
type
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/DeviceNetworkDetail.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
model
;
import
java.util.Date
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
/**
* 设备联网明细表
*/
public
class
DeviceNetworkDetail
{
/**
* id
*/
private
Integer
id
;
/**
* 设备号
*/
private
String
deviceSn
;
/**
* 创建时间
*/
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getDeviceSn
()
{
return
deviceSn
;
}
public
void
setDeviceSn
(
String
deviceSn
)
{
this
.
deviceSn
=
deviceSn
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", deviceSn="
).
append
(
deviceSn
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/model/ShipmentData.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
model
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2020-12-29
*/
public
class
ShipmentData
{
private
Integer
id
;
private
String
goodsTime
;
private
Integer
goodsNum
;
private
Byte
type
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getGoodsTime
()
{
return
goodsTime
;
}
public
void
setGoodsTime
(
String
goodsTime
)
{
this
.
goodsTime
=
goodsTime
;
}
public
Integer
getGoodsNum
()
{
return
goodsNum
;
}
public
void
setGoodsNum
(
Integer
goodsNum
)
{
this
.
goodsNum
=
goodsNum
;
}
public
Byte
getType
()
{
return
type
;
}
public
void
setType
(
Byte
type
)
{
this
.
type
=
type
;
}
@Override
public
String
toString
()
{
return
"ShipmentData{"
+
"id="
+
id
+
", goodsTime='"
+
goodsTime
+
'\''
+
", goodsNum="
+
goodsNum
+
", type="
+
type
+
'}'
;
}
}
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/ActivationDataMapper.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
mapper
;
import
java.util.List
;
import
cn.com.glsx.openplatform.model.ActivationData
;
import
cn.com.glsx.openplatform.model.ShipmentData
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2020-12-29
*/
@Mapper
public
interface
ActivationDataMapper
{
List
<
ActivationData
>
getActivationList
();
int
updateDeviceActivation
(
@Param
(
"data"
)
ActivationData
data
,
@Param
(
"startTimeStr"
)
String
startTimeStr
,
@Param
(
"endTimeStr"
)
String
endTimeStr
,
@Param
(
"num"
)
int
num
);
List
<
ShipmentData
>
getShipmentList
();
}
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/CustomerActionStatisticsMapper.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
mapper
;
import
cn.com.glsx.openplatform.model.CustomerActionStatistics
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
@Mapper
public
interface
CustomerActionStatisticsMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
CustomerActionStatistics
record
);
int
insertOrUpdate
(
CustomerActionStatistics
record
);
int
insertOrUpdateSelective
(
CustomerActionStatistics
record
);
int
insertSelective
(
CustomerActionStatistics
record
);
CustomerActionStatistics
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
CustomerActionStatistics
record
);
int
updateByPrimaryKey
(
CustomerActionStatistics
record
);
int
updateBatch
(
List
<
CustomerActionStatistics
>
list
);
int
updateBatchSelective
(
List
<
CustomerActionStatistics
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
CustomerActionStatistics
>
list
);
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/CustomerNetworkStatisticsMapper.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
mapper
;
import
cn.com.glsx.openplatform.model.CustomerNetworkStatistics
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
@Mapper
public
interface
CustomerNetworkStatisticsMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
CustomerNetworkStatistics
record
);
int
insertOrUpdate
(
CustomerNetworkStatistics
record
);
int
insertOrUpdateSelective
(
CustomerNetworkStatistics
record
);
int
insertSelective
(
CustomerNetworkStatistics
record
);
CustomerNetworkStatistics
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
CustomerNetworkStatistics
record
);
int
updateByPrimaryKey
(
CustomerNetworkStatistics
record
);
int
updateBatch
(
List
<
CustomerNetworkStatistics
>
list
);
int
updateBatchSelective
(
List
<
CustomerNetworkStatistics
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
CustomerNetworkStatistics
>
list
);
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/DeviceActionDetailMapper.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
cn.com.glsx.openplatform.model.DeviceActionDetail
;
import
cn.com.glsx.openplatform.model.PlatformDevice
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
@Mapper
public
interface
DeviceActionDetailMapper
{
int
countByMonth
(
@Param
(
"startMonth"
)
Date
startMonth
,
@Param
(
"endMonth"
)
Date
endMonth
);
List
<
PlatformDevice
>
selectByMonth
(
@Param
(
"startMonth"
)
Date
startMonth
,
@Param
(
"endMonth"
)
Date
endMonth
,
@Param
(
"count"
)
Integer
count
);
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
DeviceActionDetail
record
);
int
insertOrUpdate
(
DeviceActionDetail
record
);
int
insertOrUpdateSelective
(
DeviceActionDetail
record
);
int
insertSelective
(
DeviceActionDetail
record
);
DeviceActionDetail
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
DeviceActionDetail
record
);
int
updateByPrimaryKey
(
DeviceActionDetail
record
);
int
updateBatch
(
List
<
DeviceActionDetail
>
list
);
int
updateBatchSelective
(
List
<
DeviceActionDetail
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
DeviceActionDetail
>
list
);
}
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/DeviceNetworkDetailMapper.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
.
mapper
;
import
cn.com.glsx.openplatform.model.DeviceNetworkDetail
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2021-01-02
*/
@Mapper
public
interface
DeviceNetworkDetailMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
DeviceNetworkDetail
record
);
int
insertOrUpdate
(
DeviceNetworkDetail
record
);
int
insertOrUpdateSelective
(
DeviceNetworkDetail
record
);
int
insertSelective
(
DeviceNetworkDetail
record
);
DeviceNetworkDetail
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
DeviceNetworkDetail
record
);
int
updateByPrimaryKey
(
DeviceNetworkDetail
record
);
int
updateBatch
(
List
<
DeviceNetworkDetail
>
list
);
int
updateBatchSelective
(
List
<
DeviceNetworkDetail
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
DeviceNetworkDetail
>
list
);
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-container/src/main/resources/META-INF/orm/ActivationDataMapper.xml
0 → 100644
View file @
c8b3449
<?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">
<mapper
namespace=
"cn.com.glsx.openplatform.mapper.ActivationDataMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.openplatform.model.ActivationData"
>
<!--@mbg.generated-->
<!--@Table t_activation_data-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"month"
jdbcType=
"VARCHAR"
property=
"month"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"customer"
jdbcType=
"VARCHAR"
property=
"customer"
/>
<result
column=
"num"
jdbcType=
"INTEGER"
property=
"num"
/>
<result
column=
"type"
jdbcType=
"TINYINT"
property=
"type"
/>
</resultMap>
<select
id=
"getActivationList"
resultType=
"cn.com.glsx.openplatform.model.ActivationData"
>
select id, month, customer_id customerId, customer, num, type
from t_activation_data
order by month;
</select>
<update
id=
"updateDeviceActivation"
>
update t_platform_device
set customer_id = #{data.customerId,jdbcType=INTEGER},
activat_time = from_unixtime(
unix_timestamp(#{data.month,jdbcType=VARCHAR}) + floor(
rand() * (
unix_timestamp(#{data.endMonth,jdbcType=VARCHAR})
- unix_timestamp(#{data.month,jdbcType=VARCHAR}) + 1
)
)
)
where customer_id is null
and create_time > #{startTimeStr,jdbcType=VARCHAR}
and create_time
<
= #{endTimeStr,jdbcType=VARCHAR}
and device_type = #{data.typeName,jdbcType=VARCHAR}
order by rand()
limit #{num,jdbcType=INTEGER}
</update>
<select
id=
"getShipmentList"
resultType=
"cn.com.glsx.openplatform.model.ShipmentData"
>
select id, goods_time goodsTime, goods_num goodsNum, type
from t_shipment_data
</select>
</mapper>
rpc-openplatform-container/src/main/resources/META-INF/orm/CustomerActionStatisticsMapper.xml
0 → 100644
View file @
c8b3449
<?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">
<mapper
namespace=
"cn.com.glsx.openplatform.mapper.CustomerActionStatisticsMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
>
<!--@mbg.generated-->
<!--@Table t_customer_action_statistics-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"customer_name"
jdbcType=
"VARCHAR"
property=
"customerName"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"statistics_time"
jdbcType=
"VARCHAR"
property=
"statisticsTime"
/>
<result
column=
"active_number"
jdbcType=
"INTEGER"
property=
"activeNumber"
/>
<result
column=
"activation_growth"
jdbcType=
"INTEGER"
property=
"activationGrowth"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id, customer_id, customer_name, `type`, statistics_time, active_number, activation_growth
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_customer_action_statistics
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete
from t_customer_action_statistics
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_customer_action_statistics (customer_id, customer_name, `type`,
statistics_time, active_number, activation_growth)
values (#{customerId,jdbcType=INTEGER}, #{customerName,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{statisticsTime,jdbcType=VARCHAR}, #{activeNumber,jdbcType=INTEGER},
#{activationGrowth,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_customer_action_statistics
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"customerId != null"
>
customer_id,
</if>
<if
test=
"customerName != null and customerName != ''"
>
customer_name,
</if>
<if
test=
"type != null and type != ''"
>
`type`,
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time,
</if>
<if
test=
"activeNumber != null"
>
active_number,
</if>
<if
test=
"activationGrowth != null"
>
activation_growth,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"customerId != null"
>
#{customerId,jdbcType=INTEGER},
</if>
<if
test=
"customerName != null and customerName != ''"
>
#{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null and type != ''"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
#{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
#{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
#{activationGrowth,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
>
<!--@mbg.generated-->
update t_customer_action_statistics
<set>
<if
test=
"customerId != null"
>
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if
test=
"customerName != null and customerName != ''"
>
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null and type != ''"
>
`type` = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
active_number = #{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
activation_growth = #{activationGrowth,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
>
<!--@mbg.generated-->
update t_customer_action_statistics
set customer_id = #{customerId,jdbcType=INTEGER},
customer_name = #{customerName,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
active_number = #{activeNumber,jdbcType=INTEGER},
activation_growth = #{activationGrowth,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateBatch"
parameterType=
"java.util.List"
>
<!--@mbg.generated-->
update t_customer_action_statistics
<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=
"customer_name = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.customerName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"`type` = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"statistics_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.statisticsTime,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"active_number = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.activeNumber,jdbcType=INTEGER}
</foreach>
</trim>
<trim
prefix=
"activation_growth = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.activationGrowth,jdbcType=INTEGER}
</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_customer_action_statistics
<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=
"customer_name = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.customerName != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.customerName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"`type` = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.type != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"statistics_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.statisticsTime != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.statisticsTime,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"active_number = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.activeNumber != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.activeNumber,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim
prefix=
"activation_growth = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.activationGrowth != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.activationGrowth,jdbcType=INTEGER}
</if>
</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_customer_action_statistics
(customer_id, customer_name, `type`, statistics_time, active_number,
activation_growth)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.customerId,jdbcType=INTEGER}, #{item.customerName,jdbcType=VARCHAR},
#{item.type,jdbcType=VARCHAR},
#{item.statisticsTime,jdbcType=VARCHAR}, #{item.activeNumber,jdbcType=INTEGER},
#{item.activationGrowth,jdbcType=INTEGER})
</foreach>
</insert>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_customer_action_statistics
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
customer_id,
customer_name,
`type`,
statistics_time,
active_number,
activation_growth,
</trim>
values
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
#{customerId,jdbcType=INTEGER},
#{customerName,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{statisticsTime,jdbcType=VARCHAR},
#{activeNumber,jdbcType=INTEGER},
#{activationGrowth,jdbcType=INTEGER},
</trim>
on duplicate key update
<trim
suffixOverrides=
","
>
<if
test=
"id != null"
>
id = #{id,jdbcType=INTEGER},
</if>
customer_id = #{customerId,jdbcType=INTEGER},
customer_name = #{customerName,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
active_number = #{activeNumber,jdbcType=INTEGER},
activation_growth = #{activationGrowth,jdbcType=INTEGER},
</trim>
</insert>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerActionStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_customer_action_statistics
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"customerId != null"
>
customer_id,
</if>
<if
test=
"customerName != null and customerName != ''"
>
customer_name,
</if>
<if
test=
"type != null and type != ''"
>
`type`,
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time,
</if>
<if
test=
"activeNumber != null"
>
active_number,
</if>
<if
test=
"activationGrowth != null"
>
activation_growth,
</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=
"customerName != null and customerName != ''"
>
#{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null and type != ''"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
#{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
#{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
#{activationGrowth,jdbcType=INTEGER},
</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=
"customerName != null and customerName != ''"
>
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null and type != ''"
>
`type` = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
active_number = #{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
activation_growth = #{activationGrowth,jdbcType=INTEGER},
</if>
</trim>
</insert>
</mapper>
rpc-openplatform-container/src/main/resources/META-INF/orm/CustomerNetworkStatisticsMapper.xml
0 → 100644
View file @
c8b3449
<?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">
<mapper
namespace=
"cn.com.glsx.openplatform.mapper.CustomerNetworkStatisticsMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
>
<!--@mbg.generated-->
<!--@Table t_customer_network_statistics-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"customer_id"
jdbcType=
"INTEGER"
property=
"customerId"
/>
<result
column=
"customer_name"
jdbcType=
"VARCHAR"
property=
"customerName"
/>
<result
column=
"type"
jdbcType=
"TINYINT"
property=
"type"
/>
<result
column=
"statistics_time"
jdbcType=
"VARCHAR"
property=
"statisticsTime"
/>
<result
column=
"active_number"
jdbcType=
"INTEGER"
property=
"activeNumber"
/>
<result
column=
"activation_growth"
jdbcType=
"INTEGER"
property=
"activationGrowth"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id, customer_id, customer_name, `type`, statistics_time, active_number, activation_growth
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_customer_network_statistics
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete
from t_customer_network_statistics
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_customer_network_statistics (customer_id, customer_name, `type`,
statistics_time, active_number, activation_growth)
values (#{customerId,jdbcType=INTEGER}, #{customerName,jdbcType=VARCHAR},
#{type,jdbcType=TINYINT},
#{statisticsTime,jdbcType=VARCHAR}, #{activeNumber,jdbcType=INTEGER},
#{activationGrowth,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_customer_network_statistics
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"customerId != null"
>
customer_id,
</if>
<if
test=
"customerName != null and customerName != ''"
>
customer_name,
</if>
<if
test=
"type != null"
>
`type`,
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time,
</if>
<if
test=
"activeNumber != null"
>
active_number,
</if>
<if
test=
"activationGrowth != null"
>
activation_growth,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"customerId != null"
>
#{customerId,jdbcType=INTEGER},
</if>
<if
test=
"customerName != null and customerName != ''"
>
#{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=TINYINT},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
#{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
#{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
#{activationGrowth,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
>
<!--@mbg.generated-->
update t_customer_network_statistics
<set>
<if
test=
"customerId != null"
>
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if
test=
"customerName != null and customerName != ''"
>
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
`type` = #{type,jdbcType=TINYINT},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
active_number = #{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
activation_growth = #{activationGrowth,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
>
<!--@mbg.generated-->
update t_customer_network_statistics
set customer_id = #{customerId,jdbcType=INTEGER},
customer_name = #{customerName,jdbcType=VARCHAR},
`type` = #{type,jdbcType=TINYINT},
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
active_number = #{activeNumber,jdbcType=INTEGER},
activation_growth = #{activationGrowth,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateBatch"
parameterType=
"java.util.List"
>
<!--@mbg.generated-->
update t_customer_network_statistics
<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=
"customer_name = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.customerName,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"`type` = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=TINYINT}
</foreach>
</trim>
<trim
prefix=
"statistics_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.statisticsTime,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"active_number = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.activeNumber,jdbcType=INTEGER}
</foreach>
</trim>
<trim
prefix=
"activation_growth = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.activationGrowth,jdbcType=INTEGER}
</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_customer_network_statistics
<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=
"customer_name = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.customerName != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.customerName,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"`type` = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.type != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=TINYINT}
</if>
</foreach>
</trim>
<trim
prefix=
"statistics_time = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.statisticsTime != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.statisticsTime,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"active_number = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.activeNumber != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.activeNumber,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim
prefix=
"activation_growth = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.activationGrowth != null"
>
when id = #{item.id,jdbcType=INTEGER}
then #{item.activationGrowth,jdbcType=INTEGER}
</if>
</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_customer_network_statistics
(customer_id, customer_name, `type`, statistics_time, active_number,
activation_growth)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.customerId,jdbcType=INTEGER}, #{item.customerName,jdbcType=VARCHAR},
#{item.type,jdbcType=TINYINT},
#{item.statisticsTime,jdbcType=VARCHAR}, #{item.activeNumber,jdbcType=INTEGER},
#{item.activationGrowth,jdbcType=INTEGER})
</foreach>
</insert>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_customer_network_statistics
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
customer_id,
customer_name,
`type`,
statistics_time,
active_number,
activation_growth,
</trim>
values
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
#{customerId,jdbcType=INTEGER},
#{customerName,jdbcType=VARCHAR},
#{type,jdbcType=TINYINT},
#{statisticsTime,jdbcType=VARCHAR},
#{activeNumber,jdbcType=INTEGER},
#{activationGrowth,jdbcType=INTEGER},
</trim>
on duplicate key update
<trim
suffixOverrides=
","
>
<if
test=
"id != null"
>
id = #{id,jdbcType=INTEGER},
</if>
customer_id = #{customerId,jdbcType=INTEGER},
customer_name = #{customerName,jdbcType=VARCHAR},
`type` = #{type,jdbcType=TINYINT},
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
active_number = #{activeNumber,jdbcType=INTEGER},
activation_growth = #{activationGrowth,jdbcType=INTEGER},
</trim>
</insert>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.CustomerNetworkStatistics"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_customer_network_statistics
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"customerId != null"
>
customer_id,
</if>
<if
test=
"customerName != null and customerName != ''"
>
customer_name,
</if>
<if
test=
"type != null"
>
`type`,
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time,
</if>
<if
test=
"activeNumber != null"
>
active_number,
</if>
<if
test=
"activationGrowth != null"
>
activation_growth,
</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=
"customerName != null and customerName != ''"
>
#{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=TINYINT},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
#{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
#{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
#{activationGrowth,jdbcType=INTEGER},
</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=
"customerName != null and customerName != ''"
>
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
`type` = #{type,jdbcType=TINYINT},
</if>
<if
test=
"statisticsTime != null and statisticsTime != ''"
>
statistics_time = #{statisticsTime,jdbcType=VARCHAR},
</if>
<if
test=
"activeNumber != null"
>
active_number = #{activeNumber,jdbcType=INTEGER},
</if>
<if
test=
"activationGrowth != null"
>
activation_growth = #{activationGrowth,jdbcType=INTEGER},
</if>
</trim>
</insert>
</mapper>
rpc-openplatform-container/src/main/resources/META-INF/orm/DeviceActionDetailMapper.xml
0 → 100644
View file @
c8b3449
<?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">
<mapper
namespace=
"cn.com.glsx.openplatform.mapper.DeviceActionDetailMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
>
<!--@mbg.generated-->
<!--@Table t_device_action_detail-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"device_sn"
jdbcType=
"VARCHAR"
property=
"deviceSn"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id, device_sn, `type`, create_time
</sql>
<select
id=
"countByMonth"
resultType=
"int"
>
select count(1)
from t_platform_device
<where>
<if
test=
"startMonth != null"
>
and activat_time >= #{startMonth,jdbcType=TIMESTAMP}
</if>
<if
test=
"endMonth != null"
>
and activat_time
<
#{endMonth,jdbcType=TIMESTAMP}
</if>
</where>
</select>
<select
id=
"selectByMonth"
resultType=
"cn.com.glsx.openplatform.model.PlatformDevice"
>
select id, device_sn deviceSn, device_type deviceType, customer_id customerId,
user_id userId, activat_time activatTime, status, create_time createTime,
update_time updateTime, create_by createBy, update_by updateBy, remark
from t_platform_device
<where>
<if
test=
"startMonth != null"
>
and activat_time >= #{startMonth,jdbcType=TIMESTAMP}
</if>
<if
test=
"endMonth != null"
>
and activat_time
<
#{endMonth,jdbcType=TIMESTAMP}
</if>
</where>
<if
test=
"count != null"
>
limit #{count,jdbcType=INTEGER}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_device_action_detail
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete
from t_device_action_detail
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_device_action_detail (device_sn, `type`, create_time)
values (#{deviceSn,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_device_action_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"deviceSn != null and deviceSn != ''"
>
device_sn,
</if>
<if
test=
"type != null and type != ''"
>
`type`,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"deviceSn != null and deviceSn != ''"
>
#{deviceSn,jdbcType=VARCHAR},
</if>
<if
test=
"type != null and type != ''"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
>
<!--@mbg.generated-->
update t_device_action_detail
<set>
<if
test=
"deviceSn != null and deviceSn != ''"
>
device_sn = #{deviceSn,jdbcType=VARCHAR},
</if>
<if
test=
"type != null and type != ''"
>
`type` = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
>
<!--@mbg.generated-->
update t_device_action_detail
set device_sn = #{deviceSn,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateBatch"
parameterType=
"java.util.List"
>
<!--@mbg.generated-->
update t_device_action_detail
<trim
prefix=
"set"
suffixOverrides=
","
>
<trim
prefix=
"device_sn = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"`type` = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
</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>
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_device_action_detail
<trim
prefix=
"set"
suffixOverrides=
","
>
<trim
prefix=
"device_sn = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.deviceSn != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"`type` = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.type != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
</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>
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_device_action_detail
(device_sn, `type`, create_time)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.deviceSn,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_device_action_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
device_sn,
`type`,
create_time,
</trim>
values
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
#{deviceSn,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
</trim>
on duplicate key update
<trim
suffixOverrides=
","
>
<if
test=
"id != null"
>
id = #{id,jdbcType=INTEGER},
</if>
device_sn = #{deviceSn,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
</trim>
</insert>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceActionDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_device_action_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"deviceSn != null and deviceSn != ''"
>
device_sn,
</if>
<if
test=
"type != null and type != ''"
>
`type`,
</if>
<if
test=
"createTime != null"
>
create_time,
</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=
"type != null and type != ''"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</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=
"type != null and type != ''"
>
`type` = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
</mapper>
rpc-openplatform-container/src/main/resources/META-INF/orm/DeviceNetworkDetailMapper.xml
0 → 100644
View file @
c8b3449
<?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">
<mapper
namespace=
"cn.com.glsx.openplatform.mapper.DeviceNetworkDetailMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
>
<!--@mbg.generated-->
<!--@Table t_device_network_detail-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"device_sn"
jdbcType=
"VARCHAR"
property=
"deviceSn"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id, device_sn, create_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!--@mbg.generated-->
select
<include
refid=
"Base_Column_List"
/>
from t_device_network_detail
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete
from t_device_network_detail
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_device_network_detail (device_sn, create_time)
values (#{deviceSn,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<selectKey
order=
"AFTER"
keyProperty=
"id"
resultType=
"integer"
>
select LAST_INSERT_ID()
</selectKey>
insert into t_device_network_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"deviceSn != null and deviceSn != ''"
>
device_sn,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"deviceSn != null and deviceSn != ''"
>
#{deviceSn,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
>
<!--@mbg.generated-->
update t_device_network_detail
<set>
<if
test=
"deviceSn != null and deviceSn != ''"
>
device_sn = #{deviceSn,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
>
<!--@mbg.generated-->
update t_device_network_detail
set device_sn = #{deviceSn,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateBatch"
parameterType=
"java.util.List"
>
<!--@mbg.generated-->
update t_device_network_detail
<trim
prefix=
"set"
suffixOverrides=
","
>
<trim
prefix=
"device_sn = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</foreach>
</trim>
<trim
prefix=
"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>
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_device_network_detail
<trim
prefix=
"set"
suffixOverrides=
","
>
<trim
prefix=
"device_sn = case"
suffix=
"end,"
>
<foreach
collection=
"list"
index=
"index"
item=
"item"
>
<if
test=
"item.deviceSn != null"
>
when id = #{item.id,jdbcType=INTEGER} then #{item.deviceSn,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim
prefix=
"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>
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_device_network_detail
(device_sn, create_time)
values
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(#{item.deviceSn,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_device_network_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
device_sn,
create_time,
</trim>
values
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
#{deviceSn,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
</trim>
on duplicate key update
<trim
suffixOverrides=
","
>
<if
test=
"id != null"
>
id = #{id,jdbcType=INTEGER},
</if>
device_sn = #{deviceSn,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
</trim>
</insert>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"cn.com.glsx.openplatform.model.DeviceNetworkDetail"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
insert into t_device_network_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"deviceSn != null and deviceSn != ''"
>
device_sn,
</if>
<if
test=
"createTime != null"
>
create_time,
</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=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</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=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
</mapper>
rpc-openplatform-container/src/test/java/cn/com/glsx/openplatform/GenerateFakeData.java
0 → 100644
View file @
c8b3449
package
cn
.
com
.
glsx
.
openplatform
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
cn.com.glsx.openplatform.mapper.ActivationDataMapper
;
import
cn.com.glsx.openplatform.mapper.PlatformDeviceMapper
;
import
cn.com.glsx.openplatform.model.ActivationData
;
import
cn.com.glsx.openplatform.model.PlatformDevice
;
import
cn.com.glsx.openplatform.model.ShipmentData
;
import
cn.hutool.core.date.DateField
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
/**
* <p>Description:
* <p>Project: rpc-openplatform-container
*
* @author wbh
* @date 2020-12-29
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
Main
.
class
)
public
class
GenerateFakeData
{
private
static
final
Map
<
Byte
,
String
>
TYPE_MAP
=
new
HashMap
<>();
static
{
TYPE_MAP
.
put
((
byte
)
1
,
"通信模组"
);
TYPE_MAP
.
put
((
byte
)
2
,
"核心板"
);
TYPE_MAP
.
put
((
byte
)
3
,
"PCBA"
);
}
@Autowired
private
ActivationDataMapper
activationDataMapper
;
@Autowired
private
PlatformDeviceMapper
deviceMapper
;
@Test
public
void
test1
()
{
List
<
ShipmentData
>
shipmentList
=
activationDataMapper
.
getShipmentList
();
for
(
ShipmentData
shipmentData
:
shipmentList
)
{
String
goodsTime
=
shipmentData
.
getGoodsTime
();
int
goodsNum
=
shipmentData
.
getGoodsNum
()
+
RandomUtil
.
randomInt
(
1000
,
2000
);
Byte
type
=
shipmentData
.
getType
();
DateTime
startTime
=
DateUtil
.
parse
(
goodsTime
,
"yyyy-MM-dd"
);
while
(
goodsNum
>
0
)
{
int
serialNum
=
0
;
int
year
=
startTime
.
getField
(
DateField
.
YEAR
);
int
month
=
startTime
.
getField
(
DateField
.
MONTH
);
int
day
=
startTime
.
getField
(
DateField
.
DAY_OF_MONTH
);
startTime
=
startTime
.
setField
(
DateField
.
HOUR_OF_DAY
,
RandomUtil
.
randomInt
(
24
))
.
setField
(
DateField
.
MINUTE
,
RandomUtil
.
randomInt
(
60
))
.
setField
(
DateField
.
SECOND
,
RandomUtil
.
randomInt
(
60
));
int
currentNum
=
goodsNum
>
5000
?
RandomUtil
.
randomInt
(
4000
,
5000
)
:
goodsNum
;
for
(
int
i
=
0
;
i
<
currentNum
;
i
++)
{
String
sn
=
String
.
format
(
"%d0%02d%02d%02d%04d"
,
type
,
year
%
100
,
month
,
day
,
serialNum
);
PlatformDevice
record
=
new
PlatformDevice
();
record
.
setDeviceSn
(
sn
);
record
.
setDeviceType
(
TYPE_MAP
.
get
(
type
));
record
.
setStatus
(
1
);
record
.
setCreateTime
(
startTime
);
record
.
setUpdateTime
(
record
.
getCreateTime
());
record
.
setCreateBy
(
0
);
record
.
setUpdateBy
(
0
);
deviceMapper
.
insert
(
record
);
serialNum
++;
}
goodsNum
-=
currentNum
;
startTime
=
startTime
.
offset
(
DateField
.
DAY_OF_MONTH
,
-
1
);
}
}
}
@Test
public
void
dataHanlder
()
throws
Exception
{
//查询数据库
List
<
ActivationData
>
activationList
=
activationDataMapper
.
getActivationList
();
for
(
ActivationData
activationData
:
activationList
)
{
activationData
.
setTypeName
(
TYPE_MAP
.
get
(
activationData
.
getType
()));
String
month
=
activationData
.
getMonth
();
activationData
.
setEndMonth
(
getCurrentMonthLastDay
(
month
)
+
" 23:59:59"
);
//String currentMonth = month;
//根据obj中month字段获取上月第一天和最后一天
int
num
=
activationData
.
getNum
();
//obj中number
//int real = 0;
//int time = 1;
//do {
String
startTime
=
getPreMonthOneDay
(
month
,
-
9
);
String
endTime
=
getPreMonthLastDay
(
month
,
-
1
);
//currentMonth = startTime;
int
j
=
activationDataMapper
.
updateDeviceActivation
(
activationData
,
startTime
+
" 00:00:00"
,
endTime
+
" 23:59:59"
,
num
);
//real += j;
//time--;
//} while (real < num && time > 0);
}
}
/**
* 从当前时间获取上个月的第一天
*/
private
String
getPreMonthOneDay
(
String
startDate
,
int
num
)
throws
Exception
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
c
=
getPreMonth
(
startDate
,
num
);
//获取某月最小天数
int
firstDay
=
c
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
);
//设置日历中月份的最小天数
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
firstDay
);
// 上个月第一天
String
startTime
=
format
.
format
(
c
.
getTime
());
return
startTime
;
}
/**
* 从当前时间获取上个月的最后一天
*/
private
String
getPreMonthLastDay
(
String
startDate
,
int
num
)
throws
Exception
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
c2
=
getPreMonth
(
startDate
,
num
);
int
lastDay
=
c2
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
);
c2
.
set
(
Calendar
.
DAY_OF_MONTH
,
lastDay
);
String
endTime
=
format
.
format
(
c2
.
getTime
());
return
endTime
;
}
private
String
getCurrentMonthLastDay
(
String
month
)
throws
Exception
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
c
=
Calendar
.
getInstance
();
Date
date
=
format
.
parse
(
month
);
c
.
setTime
(
date
);
int
lastDay
=
c
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
);
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
lastDay
);
String
endTime
=
format
.
format
(
c
.
getTime
());
return
endTime
;
}
/**
* 从当前时间"yyyy-MM-dd"格式获取上个月的时间
*/
private
Calendar
getPreMonth
(
String
startDate
,
int
num
)
throws
Exception
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
c
=
Calendar
.
getInstance
();
Date
date
=
format
.
parse
(
startDate
);
c
.
setTime
(
date
);
c
.
add
(
Calendar
.
MONTH
,
num
);
return
c
;
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment